Source file
src/math/frexp.go
Documentation: math
1
2
3
4
5 package math
6
7
8
9
10
11
12
13
14
15
16 func Frexp(f float64) (frac float64, exp int)
17
18 func frexp(f float64) (frac float64, exp int) {
19
20 switch {
21 case f == 0:
22 return f, 0
23 case IsInf(f, 0) || IsNaN(f):
24 return f, 0
25 }
26 f, exp = normalize(f)
27 x := Float64bits(f)
28 exp += int((x>>shift)&mask) - bias + 1
29 x &^= mask << shift
30 x |= (-1 + bias) << shift
31 frac = Float64frombits(x)
32 return
33 }
34
View as plain text