gcc/ChangeLog:
[official-gcc.git] / libgo / go / math / unsafe.go
blob5ae67420f4dc029dfb0bc816378520ef42a09d2d
1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 package math
7 import "unsafe"
9 // Float32bits returns the IEEE 754 binary representation of f.
10 func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) }
12 // Float32frombits returns the floating point number corresponding
13 // to the IEEE 754 binary representation b.
14 func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) }
16 // Float64bits returns the IEEE 754 binary representation of f.
17 func Float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) }
19 // Float64frombits returns the floating point number corresponding
20 // the IEEE 754 binary representation b.
21 func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) }