Categorygithub.com/arl/math32
modulepackage
0.2.0
Repository: https://github.com/arl/math32.git
Documentation: pkg.go.dev

# README

math32 - float32 wrapper for math Go package

Build Status Coverage Go Report Card GoDoc

Package math32 provides basic constants and mathematical functions for 32 bits floating point, based off the standard Go math package.

License

The documentation of every math32 wrapper function is the same as the equivalent function of the standard Go math package. Also, the tests are heavily based off the tests of the standard Go math package. For those reasons, use of this source code is governed by the same BSD-style license as the Go source code, which says:

Copyright (c) 2009 The Go Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  • Neither the name of Google Inc. nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

# Functions

Abs returns the absolute value of x.
Acos returns the arccosine, in radians, of x.
Acosh returns the inverse hyperbolic cosine of x.
Approx returns true if x ~= y.
ApproxEpsilon returns true if x ~= y, using provided epsilon value.
Asin returns the arcsine, in radians, of x.
Asinh returns the inverse hyperbolic sine of x.
Atan returns the arctangent, in radians, of x.
Atan2 returns the arc tangent of y/x, using the signs of the two to determine the quadrant of the return value.
Atanh returns the inverse hyperbolic tangent of x.
Cbrt returns the cube root of x.
Ceil returns the least integer value greater than or equal to x.
Copysign returns a value with the magnitude of x and the sign of y.
Cos returns the cosine of the radian argument x.
Cosh returns the hyperbolic cosine of x.
Dim returns the maximum of x-y or 0.
Erf returns the error function of x.
Erfc returns the complementary error function of x.
Erfinv returns the inverse error function of x.
Exp returns e**x, the base-e exponential of x.
Exp2 returns 2**x, the base-2 exponential of x.
Expm1 returns e**x - 1, the base-e exponential of x minus 1.
Floor returns the greatest integer value less than or equal to x.
FMA returns x * y + z, computed with only one rounding.
Frexp breaks f into a normalized fraction and an integral power of two.
Gamma returns the Gamma function of x.
Hypot returns Sqrt(p*p + q*q), taking care to avoid unnecessary overflow and underflow.
Ilog2 returns the uint32 value that is log2(v).
Inf returns positive infinity if sign >= 0, negative infinity if sign < 0.
IsInf reports whether f is an infinity, according to sign.
IsNaN reports whether f is an IEEE 754 ``not-a-number'' value.
J0 returns the order-zero Bessel function of the first kind.
J1 returns the order-one Bessel function of the first kind.
Jn returns the order-n Bessel function of the first kind.
Ldexp is the inverse of Frexp.
Lgamma returns the natural logarithm and sign (-1 or +1) of Gamma(x).
Log returns the natural logarithm of x.
Log10 returns the decimal logarithm of x.
Log1p returns the natural logarithm of 1 plus its argument x.
Log2 returns the binary logarithm of x.
Logb returns the binary exponent of x.
Max returns the larger of x or y.
Min returns the smaller of x or y.
MinInt32 returns the minimum of two int32 values.
Mod returns the floating-point remainder of x/y.
Modf returns integer and fractional floating-point numbers that sum to f.
NaN returns an IEEE 754 ``not-a-number'' value.
Nextafter32 returns the next representable float32 value after x towards y.
NextPow2 returns the next power of 2 of v, or v if v is a power of 2.
Pow returns x**y, the base-x exponential of y.
Pow10 returns 10**n, the base-10 exponential of n.
Remainder returns the IEEE 754 floating-point remainder of x/y.
RoundToEven returns the nearest integer, rounding ties to even.
Signbit reports whether x is negative or negative zero.
Sin returns the sine of the radian argument x.
Sincos returns Sin(x), Cos(x).
Sinh returns the hyperbolic sine of x.
Sqr returns the square of x.
Sqrt returns the square root of x.
Trunc returns the integer value of x.
Y0 returns the order-zero Bessel function of the second kind.
Y1 returns the order-one Bessel function of the second kind.
Yn returns the order-n Bessel function of the second kind.

# Variables

CosTable is a table allowing fast access to cosine values of an angle in degree.
SinTable is a table allowing fast access to sine values of an angle in degree.