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
/
exp2f.c.i.go
72 lines (67 loc) · 1.86 KB
/
exp2f.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
package libc
import unsafe "unsafe"
func _cgos_top12_exp2f(x float32) uint32 {
return *(*uint32)(unsafe.Pointer(&_cgoz_18_exp2f{x})) >> int32(20)
}
type _cgoz_18_exp2f struct {
_f float32
}
func Exp2f(x float32) float32 {
var abstop uint32
var ki uint64
var t uint64
var kd float64
var xd float64
var z float64
var r float64
var r2 float64
var y float64
var s float64
xd = float64(x)
abstop = _cgos_top12_exp2f(x) & uint32(2047)
if func() int64 {
if abstop >= _cgos_top12_exp2f(128.0) {
return 1
} else {
return 0
}
}() == int64(0) {
if *(*uint32)(unsafe.Pointer(&_cgoz_19_exp2f{x})) == *(*uint32)(unsafe.Pointer(&_cgoz_20_exp2f{-X__builtin_inff()})) {
return float32(0.0)
}
if abstop >= _cgos_top12_exp2f(X__builtin_inff()) {
return x + x
}
if x > 0.0 {
return __math_oflowf(uint32(0))
}
if x <= -150.0 {
return __math_uflowf(uint32(0))
}
}
kd = eval_as_double(xd + __exp2f_data.shift_scaled)
ki = *(*uint64)(unsafe.Pointer(&_cgoz_21_exp2f{kd}))
kd -= __exp2f_data.shift_scaled
r = xd - kd
t = *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer((*uint64)(unsafe.Pointer(&__exp2f_data.tab)))) + uintptr(ki%uint64(32))*8))
t += ki << 47
s = *(*float64)(unsafe.Pointer(&_cgoz_22_exp2f{t}))
z = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly)))) + uintptr(int32(0))*8))*r + *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly)))) + uintptr(int32(1))*8))
r2 = r * r
y = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly)))) + uintptr(int32(2))*8))*r + float64(int32(1))
y = z*r2 + y
y = y * s
return eval_as_float(float32(y))
}
type _cgoz_19_exp2f struct {
_f float32
}
type _cgoz_20_exp2f struct {
_f float32
}
type _cgoz_21_exp2f struct {
_f float64
}
type _cgoz_22_exp2f struct {
_i uint64
}