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
/
atan.c.i.go
124 lines (120 loc) · 4.22 KB
/
atan.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
package libc
import unsafe "unsafe"
var _cgos_atanhi_atan [4]float64 = [4]float64{0.46364760900080609, 0.78539816339744828, 0.98279372324732905, 1.5707963267948966}
var _cgos_atanlo_atan [4]float64 = [4]float64{2.2698777452961687e-17, 3.061616997868383e-17, 1.3903311031230998e-17, 6.123233995736766e-17}
var _cgos_aT_atan [11]float64 = [11]float64{0.33333333333332932, -0.19999999999876483, 0.14285714272503466, -0.11111110405462356, 0.090908871334365065, -0.0769187620504483, 0.066610731373875312, -0.058335701337905735, 0.049768779946159324, -0.036531572744216916, 0.016285820115365782}
func Atan(x float64) float64 {
var w float64
var s1 float64
var s2 float64
var z float64
var ix uint32
var sign uint32
var id int32
for {
ix = uint32(*(*uint64)(unsafe.Pointer(&_cgoz_18_atan{x})) >> int32(32))
if true {
break
}
}
sign = ix >> int32(31)
ix &= uint32(2147483647)
if ix >= uint32(1141899264) {
if func() int32 {
if 8 == 4 {
return func() int32 {
if X__FLOAT_BITS(float32(x))&uint32(2147483647) > uint32(2139095040) {
return 1
} else {
return 0
}
}()
} else {
return func() int32 {
if 8 == 8 {
return func() int32 {
if X__DOUBLE_BITS(x)&9223372036854775807 > 9218868437227405312 {
return 1
} else {
return 0
}
}()
} else {
return func() int32 {
if X__fpclassifyl(float64(x)) == int32(0) {
return 1
} else {
return 0
}
}()
}
}()
}
}() != 0 {
return x
}
z = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_atanhi_atan)))) + uintptr(int32(3))*8)) + float64(7.52316385e-37)
return func() float64 {
if sign != 0 {
return -z
} else {
return z
}
}()
}
if ix < uint32(1071382528) {
if ix < uint32(1044381696) {
if ix < uint32(1048576) {
for {
if 4 == 4 {
fp_force_evalf(float32(x))
} else if 4 == 8 {
fp_force_eval(float64(float32(x)))
} else {
fp_force_evall(float64(float32(x)))
}
if true {
break
}
}
}
return x
}
id = -1
} else {
x = Fabs(x)
if ix < uint32(1072889856) {
if ix < uint32(1072037888) {
id = int32(0)
x = (2.0*x - 1.0) / (2.0 + x)
} else {
id = int32(1)
x = (x - 1.0) / (x + 1.0)
}
} else if ix < uint32(1073971200) {
id = int32(2)
x = (x - 1.5) / (1.0 + 1.5*x)
} else {
id = int32(3)
x = -1.0 / x
}
}
z = x * x
w = z * z
s1 = z * (*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(0))*8)) + w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(2))*8))+w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(4))*8))+w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(6))*8))+w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(8))*8))+w**(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(10))*8)))))))
s2 = w * (*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(1))*8)) + w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(3))*8))+w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(5))*8))+w*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(7))*8))+w**(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_aT_atan)))) + uintptr(int32(9))*8))))))
if id < int32(0) {
return x - x*(s1+s2)
}
z = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_atanhi_atan)))) + uintptr(id)*8)) - (x*(s1+s2) - *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&_cgos_atanlo_atan)))) + uintptr(id)*8)) - x)
return func() float64 {
if sign != 0 {
return -z
} else {
return z
}
}()
}
type _cgoz_18_atan struct {
_f float64
}