mirror of
https://github.com/golang/go
synced 2024-11-25 09:07:58 -07:00
minor int/float fixes
R=ken OCL=18032 CL=18032
This commit is contained in:
parent
11a978adf5
commit
9cdb8bd502
@ -7,7 +7,7 @@
|
||||
package main
|
||||
|
||||
func
|
||||
pow10(pow int) double
|
||||
pow10(pow int) float64
|
||||
{
|
||||
if pow < 0 { return 1/pow10(-pow); }
|
||||
if pow > 0 { return pow10(pow-1)*10; }
|
||||
@ -15,9 +15,9 @@ pow10(pow int) double
|
||||
}
|
||||
|
||||
func
|
||||
close(da double, ia, ib int64, pow int) bool
|
||||
close(da float64, ia, ib int64, pow int) bool
|
||||
{
|
||||
db := double(ia) / double(ib);
|
||||
db := float64(ia) / float64(ib);
|
||||
db *= pow10(pow);
|
||||
|
||||
if da == 0 {
|
||||
|
@ -20,7 +20,7 @@ func main() {
|
||||
}
|
||||
var l = len(s);
|
||||
for w, i, j := 0,0,0; i < l; i += w {
|
||||
var r int32;
|
||||
var r int;
|
||||
r, w = sys.stringtorune(s, i);
|
||||
if w == 0 { panic("zero width in string") }
|
||||
if r != chars[j] { panic("wrong value from string") }
|
||||
@ -43,7 +43,7 @@ func main() {
|
||||
a[10] = 0xaa;
|
||||
a[11] = 0x9e;
|
||||
for w, i, j := 0,0,0; i < L; i += w {
|
||||
var r int32;
|
||||
var r int;
|
||||
r, w = sys.bytestorune(&a[0], i, L);
|
||||
if w == 0 { panic("zero width in bytes") }
|
||||
if r != chars[j] { panic("wrong value from bytes") }
|
||||
|
Loading…
Reference in New Issue
Block a user