utils

package
v0.0.0-...-889d575 Latest Latest
Warning

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

Go to latest
Published: Dec 29, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrIndRes  = errors.New("indetermined result")
	ErrIterMin = errors.New("minimum iteration not met")
)

Functions

func Abs

func Abs[T constraints.Float](x T) T

Abs returns the absolute value of x.

Special cases are:

Abs(±Inf) = +Inf
Abs(NaN) = NaN

func FastInvSqrt

func FastInvSqrt[T constraints.Float](input T, iterations int) (output T, err error)

FastInvSqrt implements Quake III's Fast Inverse Square Root algorythm for Float types (64 and 32) Input: - input: float radicand - iterations: integer with the required estimation iterations (Newton-Raphson approximation) Output: - output: inverse square root - error

func FastInvSqrt32

func FastInvSqrt32(input float32, iterations int) (output float32, err error)

FastInvSqrt32 implements Quake III's Fast Inverse Square Root algorythm for float32 types Input: - input: float 32 radicand - iterations: integer with the required estimation iterations (Newton-Raphson approximation) Output: - output: inverse square root - error

func FastInvSqrt64

func FastInvSqrt64(input float64, iterations int) (output float64, err error)

FastInvSqrt64 implements Quake III's Fast Inverse Square Root algorythm for float32 types Input: - input: float 64 radicand - iterations: integer with the required estimation iterations (Newton-Raphson approximation) Output: - output: inverse square root - error

func IsNaN

func IsNaN[T constraints.Float](f T) (is bool)

IsNaN reports whether f is an IEEE 754 “not-a-number” value.

func NaN

func NaN[T constraints.Float]() (out T)

NaN returns an IEEE 754 “not-a-number” value.

Types

This section is empty.

Jump to

Keyboard shortcuts

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