-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhalf.go
More file actions
37 lines (27 loc) · 1 KB
/
half.go
File metadata and controls
37 lines (27 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// Package half provides half-precision floating-point types.
package half
// Float defines the common interface for half-precision floating-point types.
// Method names align with math/big.Float and math package conventions.
type Float interface {
// Float32 returns the float32 representation.
Float32() float32
// Float64 returns the float64 representation.
Float64() float64
// Bits returns the IEEE 754 binary representation as uint16.
Bits() uint16
// IsNaN reports whether f is NaN.
IsNaN() bool
// IsInf reports whether f is infinity.
// sign > 0: +Inf, sign < 0: -Inf, sign == 0: either.
IsInf(sign int) bool
// IsFinite reports whether f is finite (not Inf or NaN).
IsFinite() bool
// IsNormal reports whether f is normal (not zero, subnormal, Inf, or NaN).
IsNormal() bool
// Sign returns -1 if f < 0, 0 if f == 0 or NaN, +1 if f > 0.
Sign() int
// Signbit reports whether f is negative or negative zero.
Signbit() bool
// String returns the decimal representation.
String() string
}