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
/
expf.c.i.go
73 lines (68 loc) · 1.9 KB
/
expf.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
package libc
import unsafe "unsafe"
func _cgos_top12_expf(x float32) uint32 {
return *(*uint32)(unsafe.Pointer(&_cgoz_18_expf{x})) >> int32(20)
}
type _cgoz_18_expf struct {
_f float32
}
func Expf(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_expf(x) & uint32(2047)
if func() int64 {
if abstop >= _cgos_top12_expf(88.0) {
return 1
} else {
return 0
}
}() == int64(0) {
if *(*uint32)(unsafe.Pointer(&_cgoz_19_expf{x})) == *(*uint32)(unsafe.Pointer(&_cgoz_20_expf{-X__builtin_inff()})) {
return float32(0.0)
}
if abstop >= _cgos_top12_expf(X__builtin_inff()) {
return x + x
}
if x > 88.7228317 {
return __math_oflowf(uint32(0))
}
if x < -103.972076 {
return __math_uflowf(uint32(0))
}
}
z = __exp2f_data.invln2_scaled * xd
kd = eval_as_double(z + __exp2f_data.shift)
ki = *(*uint64)(unsafe.Pointer(&_cgoz_21_expf{kd}))
kd -= __exp2f_data.shift
r = z - 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_expf{t}))
z = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly_scaled)))) + uintptr(int32(0))*8))*r + *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly_scaled)))) + uintptr(int32(1))*8))
r2 = r * r
y = *(*float64)(unsafe.Pointer(uintptr(unsafe.Pointer((*float64)(unsafe.Pointer(&__exp2f_data.poly_scaled)))) + uintptr(int32(2))*8))*r + float64(int32(1))
y = z*r2 + y
y = y * s
return eval_as_float(float32(y))
}
type _cgoz_19_expf struct {
_f float32
}
type _cgoz_20_expf struct {
_f float32
}
type _cgoz_21_expf struct {
_f float64
}
type _cgoz_22_expf struct {
_i uint64
}