float16

package
v14.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 12, 2023 License: Apache-2.0, BSD-2-Clause, BSD-3-Clause, + 7 more Imports: 2 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Num

type Num struct {
	// contains filtered or unexported fields
}

Num represents a half-precision floating point value (float16) stored on 16 bits.

See https://en.wikipedia.org/wiki/Half-precision_floating-point_format for more informations.

func Max

func Max(first Num, rest ...Num) Num

Max returns the largest Decimal128 that was passed in the arguments

func Min

func Min(first Num, rest ...Num) Num

Min returns the smallest Decimal128 that was passed in the arguments

func New

func New(f float32) Num

New creates a new half-precision floating point value from the provided float32 value.

func (Num) Abs

func (n Num) Abs() Num

func (Num) Add

func (n Num) Add(rhs Num) Num

func (Num) Cmp

func (n Num) Cmp(other Num) int

Cmp compares the numbers represented by n and other and returns:

+1 if n > other
 0 if n == other
-1 if n < other

func (Num) Div

func (n Num) Div(rhs Num) Num

func (Num) Float32

func (f Num) Float32() float32

func (Num) Greater

func (n Num) Greater(other Num) bool

Greater returns true if the value represented by n is > other

func (Num) GreaterEqual

func (n Num) GreaterEqual(other Num) bool

GreaterEqual returns true if the value represented by n is >= other

func (Num) Less

func (n Num) Less(other Num) bool

Less returns true if the value represented by n is < other

func (Num) LessEqual

func (n Num) LessEqual(other Num) bool

LessEqual returns true if the value represented by n is <= other

func (Num) Mul

func (n Num) Mul(rhs Num) Num

func (Num) Negate

func (n Num) Negate() Num

func (Num) Sign

func (n Num) Sign() int

func (Num) String

func (f Num) String() string

func (Num) Sub

func (n Num) Sub(rhs Num) Num

func (Num) Uint16

func (f Num) Uint16() uint16

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL