redo and clean up math.

R=r
DELTA=243  (60 added, 72 deleted, 111 changed)
OCL=22909
CL=22912
This commit is contained in:
Russ Cox 2009-01-15 19:11:32 -08:00
parent 293c8f8c65
commit 2c8d9a5619
12 changed files with 170 additions and 182 deletions

View file

@ -13,11 +13,6 @@ import "math"
* Arctan is called after appropriate range reduction.
*/
const
(
pio2 = .15707963267948966192313216e1
)
export func Asin(arg float64) float64 {
var temp, x float64;
var sign bool;
@ -34,7 +29,7 @@ export func Asin(arg float64) float64 {
temp = Sqrt(1 - x*x);
if x > 0.7 {
temp = pio2 - Atan(temp/x);
temp = Pi/2 - Atan(temp/x);
} else {
temp = Atan(x/temp);
}
@ -49,5 +44,5 @@ export func Acos(arg float64) float64 {
if arg > 1 || arg < -1 {
return sys.NaN();
}
return pio2 - Asin(arg);
return Pi/2 - Asin(arg);
}