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
/
Copy pathcosf.c.i.go
90 lines (86 loc) · 1.91 KB
/
cosf.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
package libc
import unsafe "unsafe"
var _cgos_c1pio2_cosf float64 = float64(int32(1)) * 1.5707963267948966
var _cgos_c2pio2_cosf float64 = float64(int32(2)) * 1.5707963267948966
var _cgos_c3pio2_cosf float64 = float64(int32(3)) * 1.5707963267948966
var _cgos_c4pio2_cosf float64 = float64(int32(4)) * 1.5707963267948966
func Cosf(x float32) float32 {
var y float64
var ix uint32
var n uint32
var sign uint32
for {
ix = *(*uint32)(unsafe.Pointer(&_cgoz_18_cosf{x}))
if true {
break
}
}
sign = ix >> int32(31)
ix &= uint32(2147483647)
if ix <= uint32(1061752794) {
if ix < uint32(964689920) {
for {
if 4 == 4 {
fp_force_evalf(x + 1.329228e+36)
} else if 4 == 8 {
fp_force_eval(float64(x + 1.329228e+36))
} else {
fp_force_evall(float64(x + 1.329228e+36))
}
if true {
break
}
}
return float32(1.0)
}
return __cosdf(float64(x))
}
if ix <= uint32(1081824209) {
if ix > uint32(1075235811) {
return -__cosdf(func() float64 {
if sign != 0 {
return float64(x) + _cgos_c2pio2_cosf
} else {
return float64(x) - _cgos_c2pio2_cosf
}
}())
} else if sign != 0 {
return __sindf(float64(x) + _cgos_c1pio2_cosf)
} else {
return __sindf(_cgos_c1pio2_cosf - float64(x))
}
}
if ix <= uint32(1088565717) {
if ix > uint32(1085271519) {
return __cosdf(func() float64 {
if sign != 0 {
return float64(x) + _cgos_c4pio2_cosf
} else {
return float64(x) - _cgos_c4pio2_cosf
}
}())
} else if sign != 0 {
return __sindf(float64(-x) - _cgos_c3pio2_cosf)
} else {
return __sindf(float64(x) - _cgos_c3pio2_cosf)
}
}
if ix >= uint32(2139095040) {
return x - x
}
n = uint32(__rem_pio2f(x, &y))
switch n & uint32(3) {
case uint32(0):
return __cosdf(y)
case uint32(1):
return __sindf(-y)
case uint32(2):
return -__cosdf(y)
default:
return __sindf(y)
}
return 0
}
type _cgoz_18_cosf struct {
_f float32
}