Source File
float.go
Belonging Package
runtime
// Copyright 2017 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.package runtimeimportvar inf = float64frombits(0x7FF0000000000000)// isNaN reports whether f is an IEEE 754 ``not-a-number'' value.func ( float64) ( bool) {// IEEE 754 says that only NaNs satisfy f != f.return !=}// isFinite reports whether f is neither NaN nor an infinity.func ( float64) bool {return !isNaN( - )}// isInf reports whether f is an infinity.func ( float64) bool {return !isNaN() && !isFinite()}// Abs returns the absolute value of x.//// Special cases are:// Abs(±Inf) = +Inf// Abs(NaN) = NaNfunc ( float64) float64 {const = 1 << 63return float64frombits(float64bits() &^ )}// copysign returns a value with the magnitude// of x and the sign of y.func (, float64) float64 {const = 1 << 63return float64frombits(float64bits()&^ | float64bits()&)}// Float64bits returns the IEEE 754 binary representation of f.func ( float64) uint64 {return *(*uint64)(unsafe.Pointer(&))}// Float64frombits returns the floating point number corresponding// the IEEE 754 binary representation b.func ( uint64) float64 {return *(*float64)(unsafe.Pointer(&))}