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
/
exp2.c.i.go
146 lines (139 loc) · 4.18 KB
/
exp2.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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
package libc
import unsafe "unsafe"
func _cgos_specialcase_exp2(tmp float64, sbits uint64, ki uint64) float64 {
var scale float64
var y float64
if ki&uint64(2147483648) == uint64(0) {
sbits -= 4503599627370496
scale = *(*float64)(unsafe.Pointer(&_cgoz_18_exp2{sbits}))
y = float64(int32(2)) * (scale + scale*tmp)
return eval_as_double(y)
}
sbits += 4602678819172646912
scale = *(*float64)(unsafe.Pointer(&_cgoz_19_exp2{sbits}))
y = scale + scale*tmp
if y < 1.0 {
var hi float64
var lo float64
lo = scale - y + scale*tmp
hi = 1.0 + y
lo = 1.0 - hi + y + lo
y = eval_as_double(hi+lo) - 1.0
if int32(1) != 0 && y == 0.0 {
y = float64(0.0)
}
fp_force_eval(fp_barrier(2.2250738585072014e-308) * 2.2250738585072014e-308)
}
y = 2.2250738585072014e-308 * y
return eval_as_double(y)
}
type _cgoz_18_exp2 struct {
_i uint64
}
type _cgoz_19_exp2 struct {
_i uint64
}
func _cgos_top12_exp2(x float64) uint32 {
return uint32(*(*uint64)(unsafe.Pointer(&_cgoz_20_exp2{x})) >> int32(52))
}
type _cgoz_20_exp2 struct {
_f float64
}
func Exp2(x float64) float64 {
var abstop uint32
var ki uint64
var idx uint64
var top uint64
var sbits uint64
var kd float64
var r float64
var r2 float64
var scale float64
var tail float64
var tmp float64
abstop = _cgos_top12_exp2(x) & uint32(2047)
if func() int64 {
if abstop-_cgos_top12_exp2(5.5511151231257827e-17) >= _cgos_top12_exp2(512.0)-_cgos_top12_exp2(5.5511151231257827e-17) {
return 1
} else {
return 0
}
}() == int64(0) {
if abstop-_cgos_top12_exp2(5.5511151231257827e-17) >= uint32(2147483648) {
return func() float64 {
if int32(1) != 0 {
return 1.0 + x
} else {
return 1.0
}
}()
}
if abstop >= _cgos_top12_exp2(1024.0) {
if *(*uint64)(unsafe.Pointer(&_cgoz_21_exp2{x})) == *(*uint64)(unsafe.Pointer(&_cgoz_22_exp2{float64(-X__builtin_inff())})) {
return float64(0.0)
}
if abstop >= _cgos_top12_exp2(float64(X__builtin_inff())) {
return 1.0 + x
}
if !(*(*uint64)(unsafe.Pointer(&_cgoz_23_exp2{x}))>>int32(63) != 0) {
return __math_oflow(uint32(0))
} else if *(*uint64)(unsafe.Pointer(&_cgoz_24_exp2{x})) >= *(*uint64)(unsafe.Pointer(&_cgoz_25_exp2{-1075.0})) {
return __math_uflow(uint32(0))
}
}
if uint64(2)**(*uint64)(unsafe.Pointer(&_cgoz_26_exp2{x})) > uint64(2)**(*uint64)(unsafe.Pointer(&_cgoz_27_exp2{928.0})) {
abstop = uint32(0)
}
}
kd = eval_as_double(x + __exp_data.exp2_shift)
ki = *(*uint64)(unsafe.Pointer(&_cgoz_28_exp2{kd}))
kd -= __exp_data.exp2_shift
r = x - kd
idx = uint64(2) * (ki % uint64(128))
top = ki << 45
tail = *(*float64)(unsafe.Pointer(&_cgoz_29_exp2{*(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint64)(unsafe.Pointer(&__exp_data.tab)))) + uintptr(idx)*8))}))
sbits = *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint64)(unsafe.Pointer(&__exp_data.tab)))) + uintptr(idx+uint64(1))*8)) + top
r2 = r * r
tmp = tail + r**(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp_data.exp2_poly)))) + uintptr(int32(0))*8)) + r2*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp_data.exp2_poly)))) + uintptr(int32(1))*8))+r**(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp_data.exp2_poly)))) + uintptr(int32(2))*8))) + r2*r2*(*(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp_data.exp2_poly)))) + uintptr(int32(3))*8))+r**(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp_data.exp2_poly)))) + uintptr(int32(4))*8)))
if func() int64 {
if abstop == uint32(0) {
return 1
} else {
return 0
}
}() == int64(0) {
return _cgos_specialcase_exp2(tmp, sbits, ki)
}
scale = *(*float64)(unsafe.Pointer(&_cgoz_30_exp2{sbits}))
return eval_as_double(scale + scale*tmp)
}
type _cgoz_21_exp2 struct {
_f float64
}
type _cgoz_22_exp2 struct {
_f float64
}
type _cgoz_23_exp2 struct {
_f float64
}
type _cgoz_24_exp2 struct {
_f float64
}
type _cgoz_25_exp2 struct {
_f float64
}
type _cgoz_26_exp2 struct {
_f float64
}
type _cgoz_27_exp2 struct {
_f float64
}
type _cgoz_28_exp2 struct {
_f float64
}
type _cgoz_29_exp2 struct {
_i uint64
}
type _cgoz_30_exp2 struct {
_i uint64
}