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.
4
5package math
6
7import "unsafe"
8
9// Float32bits returns the IEEE 754 binary representation of f.
10func Float32bits(f float32) uint32 { return *(*uint32)(unsafe.Pointer(&f)) }
11
12// Float32frombits returns the floating point number corresponding
13// to the IEEE 754 binary representation b.
14func Float32frombits(b uint32) float32 { return *(*float32)(unsafe.Pointer(&b)) }
15
16// Float64bits returns the IEEE 754 binary representation of f.
17func Float64bits(f float64) uint64 { return *(*uint64)(unsafe.Pointer(&f)) }
18
19// Float64frombits returns the floating point number corresponding
20// the IEEE 754 binary representation b.
21func Float64frombits(b uint64) float64 { return *(*float64)(unsafe.Pointer(&b)) }
22