diff options
author | Russ Cox <rsc@golang.org> | 2009-01-22 16:23:44 -0800 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2009-01-22 16:23:44 -0800 |
commit | 29760f278cf9110e9e165af3f8aa53a89ff94f86 (patch) | |
tree | ece2442553c8681e8134d2201e6201e1e429adb8 /src/lib/math/sqrt.go | |
parent | ca01b9bdc8fc325f98c57b1949942edfc00867f7 (diff) | |
download | golang-29760f278cf9110e9e165af3f8aa53a89ff94f86.tar.gz |
move math routines from package sys to package math,
though they still build in src/runtime.
use cgo instead of hand-written wrappers.
R=r
DELTA=740 (289 added, 300 deleted, 151 changed)
OCL=23326
CL=23331
Diffstat (limited to 'src/lib/math/sqrt.go')
-rw-r--r-- | src/lib/math/sqrt.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/math/sqrt.go b/src/lib/math/sqrt.go index cf256b25c..466b92771 100644 --- a/src/lib/math/sqrt.go +++ b/src/lib/math/sqrt.go @@ -4,6 +4,8 @@ package math +import "math" + /* * sqrt returns the square root of its floating * point argument. Newton's method. @@ -12,18 +14,18 @@ package math */ func Sqrt(arg float64) float64 { - if sys.IsInf(arg, 1) { + if IsInf(arg, 1) { return arg; } if arg <= 0 { if arg < 0 { - return sys.NaN(); + return NaN(); } return 0; } - x,exp := sys.Frexp(arg); + x,exp := Frexp(arg); for x < 0.5 { x = x*2; exp = exp-1; |