fix64

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 28, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Shift        int32 = 32
	FractionMask int64 = (1 << Shift) - 1
	IntegerMask        = ^FractionMask
)
View Source
const (
	Zero   int64 = 0
	Neg1   int64 = -1 << Shift
	One    int64 = 1 << Shift
	Two    int64 = 2 << Shift
	Three  int64 = 3 << Shift
	Four   int64 = 4 << Shift
	Half         = One >> 1
	Pi     int64 = 13493037705 // (int64)(Math.PI * 65536.0) << 16;
	Pi2    int64 = 26986075409
	PiHalf int64 = 6746518852
	E      int64 = 11674931555
)

Constants

View Source
const (
	MinValue int64 = -9223372036854775808
	MaxValue int64 = 9223372036854775807
)
View Source
const (
	RcpLn2    int64 = 0x171547652 // 1.0 / log(2.0) ~= 1.4426950408889634
	RcpLog2E  int64 = 2977044471  // 1.0 / log2(e) ^= 0.6931471805599453
	RcpHalfPi int32 = 683565276   // 1.0 / (4.0 * 0.5 * Math.PI);  // the 4.0 factor converts directly to s2.30
)

Private constants

Variables

This section is empty.

Functions

func Abs

func Abs(v int64) int64

Abs Returns the absolute (positive) value of v.

func Acos

func Acos(x int64) int64

func AcosFast

func AcosFast(x int64) int64

func AcosFastest

func AcosFastest(x int64) int64

func Add

func Add(a, b int64) int64

Add Adds the two FP numbers together.

func Asin

func Asin(x int64) int64

func AsinFast

func AsinFast(x int64) int64

func AsinFastest

func AsinFastest(x int64) int64

func Atan

func Atan(x int64) int64

func Atan2

func Atan2(y, x int64) int64

func Atan2Fast

func Atan2Fast(y, x int64) int64

func Atan2Fastest

func Atan2Fastest(y, x int64) int64

func AtanFast

func AtanFast(x int64) int64

func AtanFastest

func AtanFastest(x int64) int64

func Ceil

func Ceil(v int64) int64

Ceil Round up to nearest integer.

func CeilToInt

func CeilToInt(v int64) int32

CeilToInt Converts a fp-point value into an integer by rounding it up to nearest integer.

func Clamp

func Clamp(a, min, max int64) int64

Clamp Returns the value clamped between min and max.

func Cos

func Cos(x int64) int64

func CosFast

func CosFast(x int64) int64

func CosFastest

func CosFastest(x int64) int64

func Div

func Div(a, b int64) int64

Div Calculates division approximation.

func DivFast

func DivFast(a, b int64) int64

DivFast Calculates division approximation.

func DivFastest

func DivFastest(a, b int64) int64

DivFastest Calculates division approximation.

func DivPrecise

func DivPrecise(argA, argB int64) int64

DivPrecise Divides two FP values.

func Exp

func Exp(x int64) int64

func Exp2

func Exp2(x int64) int64

Exp2 Calculates the base 2 exponent.

func Exp2Fast

func Exp2Fast(x int64) int64

Exp2Fast Calculates the base 2 exponent.

func Exp2Fastest

func Exp2Fastest(x int64) int64

Exp2Fastest Calculates the base 2 exponent.

func ExpFast

func ExpFast(x int64) int64

func ExpFastest

func ExpFastest(x int64) int64

func Floor

func Floor(v int64) int64

Floor Round down to nearest integer.

func FloorToInt

func FloorToInt(v int64) int32

FloorToInt Converts a fp-point value into an integer by rounding it down to nearest integer.

func Fract

func Fract(v int64) int64

Fract Returns the fractional part of x. Equal to 'x - floor(x)'.

func FromFloat32

func FromFloat32(v float32) int64

FromFloat32 Converts a float32 to a fp-point value.

func FromFloat64

func FromFloat64(v float64) int64

FromFloat64 Converts a float64 to a fp-point value.

func FromInt32

func FromInt32(v int32) int64

FromInt32 Converts an integer to a fp-point value.

func FromInt64

func FromInt64(v int64) int64

FromInt64 Converts an integer to a fp-point value.

func Lerp

func Lerp(a, b, t int64) int64

Lerp Linearly interpolate from a to b by t.

func Log

func Log(x int64) int64

Log Natural logarithm (base e).

func Log2

func Log2(x int64) int64

func Log2Fast

func Log2Fast(x int64) int64

func Log2Fastest

func Log2Fastest(x int64) int64

func LogFast

func LogFast(x int64) int64

LogFast Natural logarithm (base e).

func LogFastest

func LogFastest(x int64) int64

LogFastest Natural logarithm (base e).

func Max

func Max(a, b int64) int64

Max Returns the maximum of the two values.

func Min

func Min(a, b int64) int64

Min Returns the minimum of the two values.

func Mod

func Mod(a, b int64) int64

Mod Divides two FP values and returns the modulus.

func Mul

func Mul(a, b int64) int64

Mul Multiplies two FP values together.

func MulIntLongLong

func MulIntLongLong(a int32, b int64) int64

func MulIntLongLow

func MulIntLongLow(a int32, b int64) int32

func Nabs

func Nabs(v int64) int64

Nabs Negative absolute value (returns -abs(x)).

func Pow

func Pow(x, exponent int64) int64

Pow Calculates x to the power of the exponent.

func PowFast

func PowFast(x, exponent int64) int64

PowFast Calculates x to the power of the exponent.

func PowFastest

func PowFastest(x, exponent int64) int64

PowFastest Calculates x to the power of the exponent.

func RSqrt

func RSqrt(x int64) int64

RSqrt Calculates the reciprocal square root.

func RSqrtFast

func RSqrtFast(x int64) int64

RSqrtFast Calculates the reciprocal square root.

func RSqrtFastest

func RSqrtFastest(x int64) int64

RSqrtFastest Calculates the reciprocal square root.

func Rcp

func Rcp(x int64) int64

Rcp Calculates reciprocal approximation.

func RcpFast

func RcpFast(x int64) int64

RcpFast Calculates reciprocal approximation.

func RcpFastest

func RcpFastest(x int64) int64

RcpFastest Calculates reciprocal approximation.

func Round

func Round(v int64) int64

Round to nearest integer.

func RoundToInt

func RoundToInt(v int64) int32

RoundToInt Converts a fp-point value into an integer by rounding it to nearest integer.

func Sign

func Sign(v int64) int32

Sign Returns the sign of the value (-1 if negative, 0 if zero, 1 if positive).

func Sin

func Sin(x int64) int64

func SinFast

func SinFast(x int64) int64

func SinFastest

func SinFastest(x int64) int64

func Sqrt

func Sqrt(x int64) int64

func SqrtFast

func SqrtFast(x int64) int64

func SqrtFastest

func SqrtFastest(x int64) int64

func SqrtPrecise

func SqrtPrecise(a int64) int64

SqrtPrecise Calculates the square root of the given number.

func Sub

func Sub(a, b int64) int64

Sub Subtracts the two FP numbers from each other.

func Tan

func Tan(x int64) int64

func TanFast

func TanFast(x int64) int64

func TanFastest

func TanFastest(x int64) int64

func ToFloat32

func ToFloat32(v int64) float32

ToFloat32 Converts a FP value into a float.

func ToFloat64

func ToFloat64(v int64) float64

ToFloat64 Converts a fp-point value into a float64.

func ToString

func ToString(v int64) string

ToString Converts the value to a human readable string.

Types

This section is empty.

Jump to

Keyboard shortcuts

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