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 runtime
import
var inf = float64frombits(0x7FF0000000000000)
// isNaN reports whether f is an IEEE 754 “not-a-number” value.
func isNaN( float64) ( bool) {
// IEEE 754 says that only NaNs satisfy f != f.
return !=
}
// isFinite reports whether f is neither NaN nor an infinity.
func isFinite( float64) bool {
return !isNaN( - )
}
// isInf reports whether f is an infinity.
func isInf( float64) bool {
return !isNaN() && !isFinite()
}
// abs returns the absolute value of x.
//
// Special cases are:
//
// abs(±Inf) = +Inf
// abs(NaN) = NaN
func abs( float64) float64 {
const = 1 << 63
return float64frombits(float64bits() &^ )
}
// copysign returns a value with the magnitude
// of x and the sign of y.
func copysign(, float64) float64 {
const = 1 << 63
return float64frombits(float64bits()&^ | float64bits()&)
}
// float64bits returns the IEEE 754 binary representation of f.
func float64bits( float64) uint64 {
return *(*uint64)(unsafe.Pointer(&))
}
// float64frombits returns the floating point number corresponding
// the IEEE 754 binary representation b.
func float64frombits( uint64) float64 {
return *(*float64)(unsafe.Pointer(&))
}
The pages are generated with Golds v0.7.0-preview. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |