SLEEFPirates.jl
SLEEFPirates._ilogbkSLEEFPirates._ldexpkSLEEFPirates._split_exponentSLEEFPirates.acosSLEEFPirates.acos_fastSLEEFPirates.acoshSLEEFPirates.asinSLEEFPirates.asin_fastSLEEFPirates.asinhSLEEFPirates.atanSLEEFPirates.atanSLEEFPirates.atan_fastSLEEFPirates.atan_fastSLEEFPirates.atanhSLEEFPirates.cbrtSLEEFPirates.cbrt_fastSLEEFPirates.cosSLEEFPirates.cos_fastSLEEFPirates.coshSLEEFPirates.divby3SLEEFPirates.hypotSLEEFPirates.ilogbSLEEFPirates.logSLEEFPirates.log10SLEEFPirates.log1pSLEEFPirates.log2SLEEFPirates.log_fastSLEEFPirates.powSLEEFPirates.sinSLEEFPirates.sin_fastSLEEFPirates.sincosSLEEFPirates.sincos_fastSLEEFPirates.sinhSLEEFPirates.tanSLEEFPirates.tan_fastSLEEFPirates.tanh
SLEEFPirates._ilogbk — Methodilogbk(x) -> IntReturns the integral part of the logarithm of |x|, using 2 as base for the logarithm; in other words this returns the binary exponent of x so that
x = significand × 2^exponentwhere significand ∈ [1, 2).
SLEEFPirates._ldexpk — Methodldexpk(a, n)Computes a × 2^n.
SLEEFPirates._split_exponent — MethodA helper function for ldexpk
First note that r = (q >> n) << n clears the lowest n bits of q, i.e. returns 2^n where n is the largest integer such that q >= 2^n
For numbers q less than 2^m the following code does the same as the above snippet r = ( (q>>v + q) >> n - q>>v ) << n For numbers larger than or equal to 2^v this subtracts 2^n from q for q>>n times.
The function returns q(input) := q(output) + offset*r
In the code for ldexpk we actually use m = ( (m>>n + m) >> n - m>>m ) << (n-2). So that x has to be multplied by u four times x = x*u*u*u*u to put the value of the offset exponent amount back in.
SLEEFPirates.acos — Methodacos(x)Compute the inverse cosine of x, where the output is in radians.
SLEEFPirates.acos_fast — Methodacos_fast(x)Compute the inverse cosine of x, where the output is in radians.
SLEEFPirates.acosh — Methodacosh(x)Compute the inverse hyperbolic cosine of x.
SLEEFPirates.asin — Methodasin(x)Compute the inverse sine of x, where the output is in radians.
SLEEFPirates.asin_fast — Methodasin_fast(x)Compute the inverse sine of x, where the output is in radians.
SLEEFPirates.asinh — Methodasinh(x)Compute the inverse hyperbolic sine of x.
SLEEFPirates.atan — Methodatan(x)Compute the inverse tangent of x, where the output is in radians.
SLEEFPirates.atan — Methodatan(x, y)Compute the inverse tangent of x/y, using the signs of both x and y to determine the quadrant of the return value.
SLEEFPirates.atan_fast — Methodatan_fast(x)Compute the inverse tangent of x, where the output is in radians.
SLEEFPirates.atan_fast — Methodatan2_fast(x, y)Compute the inverse tangent of x/y, using the signs of both x and y to determine the quadrant of the return value.
SLEEFPirates.atanh — Methodatanh(x)Compute the inverse hyperbolic tangent of x.
SLEEFPirates.cbrt — Methodcbrt(x)Return x^{1/3}. The prefix operator ∛ is equivalent to cbrt.
SLEEFPirates.cbrt_fast — Methodcbrt_fast(x)Return x^{1/3}.
SLEEFPirates.cos — Functioncos(x)Compute the cosine of x, where the output is in radians.
SLEEFPirates.cos_fast — Functioncos_fast(x)Compute the cosine of x, where the output is in radians.
SLEEFPirates.cosh — Methodcosh(x)Compute hyperbolic cosine of x.
SLEEFPirates.divby3 — MethodAlgorithm:
movsxd rax, edi
imul rax, rax, 1431655766
mov rcx, rax
shr rcx, 63
shr rax, 32
add eax, ecx
retSLEEFPirates.hypot — Methodhypot(x,y)Compute the hypotenuse \sqrt{x^2+y^2} avoiding overflow and underflow.
SLEEFPirates.ilogb — Methodilogb(x)Returns the integral part of the logarithm of abs(x), using base 2 for the logarithm. In other words, this computes the binary exponent of x such that
x = significand × 2^exponent,where significand ∈ [1, 2).
- Exceptional cases (where
Intis the machine wordsize)x = 0returnsFP_ILOGB0x = ±InfreturnsINT_MAXx = NaNreturnsFP_ILOGBNAN
SLEEFPirates.log — Methodlog(x)Compute the natural logarithm of x. The inverse of the natural logarithm is the natural expoenential function exp(x)
SLEEFPirates.log10 — Methodlog10(x)Returns the base 10 logarithm of x.
SLEEFPirates.log1p — Methodlog1p(x)Accurately compute the natural logarithm of 1+x.
SLEEFPirates.log2 — Methodlog2(x)Returns the base 2 logarithm of x.
SLEEFPirates.log_fast — Methodlog_fast(x)Compute the natural logarithm of x. The inverse of the natural logarithm is the natural expoenential function exp(x)
SLEEFPirates.pow — Methodpow(x, y)
Exponentiation operator, returns x raised to the power y.
SLEEFPirates.sin — Functionsin(x)Compute the sine of x, where the output is in radians.
SLEEFPirates.sin_fast — Functionsin_fast(x)Compute the sine of x, where the output is in radians.
SLEEFPirates.sincos — Functionsincos(x)Compute the sin and cosine of x simultaneously, where the output is in radians, returning a tuple.
SLEEFPirates.sincos_fast — Functionsincos_fast(x)Compute the sin and cosine of x simultaneously, where the output is in radians, returning a tuple.
SLEEFPirates.sinh — Methodsinh(x)Compute hyperbolic sine of x.
SLEEFPirates.tan — Functiontan(x)Compute the tangent of x, where the output is in radians.
SLEEFPirates.tan_fast — Functiontan_fast(x)Compute the tangent of x, where the output is in radians.
SLEEFPirates.tanh — Methodtanh(x)Compute hyperbolic tangent of x.