math

package
v0.0.0-...-3d984ba Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2018 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package math provides basic constants and mathematical functions.

Index

Constants

View Source
const (
	MaxFloat32 = 3.40282346638528859811704183484516925440e+38
	MaxFloat64 = 1.797693134862315708145274237317043567981e+308
)

Variables

This section is empty.

Functions

func Abs

func Abs(x float64) float64

Abs returns the absolute value of x.

Special cases are:

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

func Abs32

func Abs32(x float32) float32

Abs32 is like Abs but for float32.

func Ceil

func Ceil(x float64) float64

Ceil returns the least integer value greater than or equal to x.

Special cases are:

Ceil(±0) = ±0
Ceil(±Inf) = ±Inf
Ceil(NaN) = NaN

func Float32bits

func Float32bits(f float32) uint32

Float32bits returns the IEEE 754 binary representation of f.

func Float32frombits

func Float32frombits(b uint32) float32

Float32frombits returns the floating point number corresponding to the IEEE 754 binary representation b.

func Float64bits

func Float64bits(f float64) uint64

Float64bits returns the IEEE 754 binary representation of f.

func Float64frombits

func Float64frombits(b uint64) float64

Float64frombits returns the floating point number corresponding the IEEE 754 binary representation b.

func Floor

func Floor(x float64) float64

Floor returns the greatest integer value less than or equal to x.

Special cases are:

Floor(±0) = ±0
Floor(±Inf) = ±Inf
Floor(NaN) = NaN

func Frexpi

func Frexpi(f float64) (int64, int)

func Frexpi32

func Frexpi32(f float32) (int32, int)

func Inf

func Inf(sign int) float64

Inf returns positive infinity if sign >= 0, negative infinity if sign < 0.

func Inf32

func Inf32(sign int) float32

Inf32 is like Inf but for float32.

func IsInf

func IsInf(f float64, sign int) bool

IsInf reports whether f is an infinity, according to sign. If sign > 0, IsInf reports whether f is positive infinity. If sign < 0, IsInf reports whether f is negative infinity. If sign == 0, IsInf reports whether f is either infinity.

func IsInf32

func IsInf32(f float32, sign int) bool

IsInf32 is like IsInf but for float32.

func IsNaN

func IsNaN(f float64) (is bool)

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

func IsNaN32

func IsNaN32(f float32) (is bool)

IsNaN32 is like IsNaN but for float32.

func Modf

func Modf(f float64) (int float64, frac float64)

Modf returns integer and fractional floating-point numbers that sum to f. Both values have the same sign as f.

Special cases are:

Modf(±Inf) = ±Inf, NaN
Modf(NaN) = NaN, NaN

func MulDiv

func MulDiv(x, m, d uint64) uint64

MulDiv returns uint64(uint128(x) * uint128(m) / uint128(d)).

func MulDivUp

func MulDivUp(x, m, d uint64) uint64

func NaN

func NaN() float64

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

func NaN32

func NaN32() float32

NaN32 is like NaN but for float32.

func Signbit

func Signbit(x float64) bool

Signbit returns true if x is negative or negative zero.

func Signbit32

func Signbit32(x float32) bool

Signbit32 is like Signbit but for float32.

func Trunc

func Trunc(x float64) float64

Trunc returns the integer value of x.

Special cases are:

Trunc(±0) = ±0
Trunc(±Inf) = ±Inf
Trunc(NaN) = NaN

Types

This section is empty.

Directories

Path Synopsis
Package rand provides functions that can be used to generate pseudorandom numbers.
Package rand provides functions that can be used to generate pseudorandom numbers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳