This repository has been archived by the owner on May 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
acos.c.i.go
93 lines (89 loc) · 2.38 KB
/
acos.c.i.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
package libc
import unsafe "unsafe"
var _cgos_pio2_hi_acos float64 = 1.5707963267948966
var _cgos_pio2_lo_acos float64 = 6.123233995736766e-17
var _cgos_pS0_acos float64 = 0.16666666666666666
var _cgos_pS1_acos float64 = -0.32556581862240092
var _cgos_pS2_acos float64 = 0.20121253213486293
var _cgos_pS3_acos float64 = -0.040055534500679411
var _cgos_pS4_acos float64 = 7.9153499428981453e-4
var _cgos_pS5_acos float64 = 3.4793310759602117e-5
var _cgos_qS1_acos float64 = -2.4033949117344142
var _cgos_qS2_acos float64 = 2.0209457602335057
var _cgos_qS3_acos float64 = -0.68828397160545329
var _cgos_qS4_acos float64 = 0.077038150555901935
func _cgos_R_acos(z float64) float64 {
var p float64
var q float64
p = z * (_cgos_pS0_acos + z*(_cgos_pS1_acos+z*(_cgos_pS2_acos+z*(_cgos_pS3_acos+z*(_cgos_pS4_acos+z*_cgos_pS5_acos)))))
q = 1.0 + z*(_cgos_qS1_acos+z*(_cgos_qS2_acos+z*(_cgos_qS3_acos+z*_cgos_qS4_acos)))
return p / q
}
func Acos(x float64) float64 {
var z float64
var w float64
var s float64
var c float64
var df float64
var hx uint32
var ix uint32
for {
hx = uint32(*(*uint64)(unsafe.Pointer(&_cgoz_18_acos{x})) >> int32(32))
if true {
break
}
}
ix = hx & uint32(2147483647)
if ix >= uint32(1072693248) {
var lx uint32
for {
lx = uint32(*(*uint64)(unsafe.Pointer(&_cgoz_19_acos{x})))
if true {
break
}
}
if ix-uint32(1072693248)|lx == uint32(0) {
if hx>>int32(31) != 0 {
return float64(int32(2))*_cgos_pio2_hi_acos + float64(7.52316385e-37)
}
return float64(int32(0))
}
return float64(int32(0)) / (x - x)
}
if ix < uint32(1071644672) {
if ix <= uint32(1012924416) {
return _cgos_pio2_hi_acos + float64(7.52316385e-37)
}
return _cgos_pio2_hi_acos - (x - (_cgos_pio2_lo_acos - x*_cgos_R_acos(x*x)))
}
if hx>>int32(31) != 0 {
z = (1.0 + x) * 0.5
s = Sqrt(z)
w = _cgos_R_acos(z)*s - _cgos_pio2_lo_acos
return float64(int32(2)) * (_cgos_pio2_hi_acos - (s + w))
}
z = (1.0 - x) * 0.5
s = Sqrt(z)
df = s
for {
df = *(*float64)(unsafe.Pointer(&_cgoz_20_acos{uint64(*(*uint64)(unsafe.Pointer(&_cgoz_21_acos{df}))>>int32(32))<<int32(32) | uint64(0)}))
if true {
break
}
}
c = (z - df*df) / (s + df)
w = _cgos_R_acos(z)*s + c
return float64(int32(2)) * (df + w)
}
type _cgoz_18_acos struct {
_f float64
}
type _cgoz_19_acos struct {
_f float64
}
type _cgoz_20_acos struct {
_i uint64
}
type _cgoz_21_acos struct {
_f float64
}