SLEEFPirates.jl

SLEEFPirates._ilogbk — Method
ilogbk(x) -> Int

Returns 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^exponent

where significand ∈ [1, 2).

source
SLEEFPirates._split_exponent — Method

A 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.

source
SLEEFPirates.atan — Method
atan(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.

source
SLEEFPirates.atan_fast — Method
atan2_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.

source
SLEEFPirates.divby3 — Method

Algorithm:

    movsxd  rax, edi
    imul    rax, rax, 1431655766
    mov     rcx, rax
    shr     rcx, 63
    shr     rax, 32
    add     eax, ecx
    ret
source
SLEEFPirates.ilogb — Method
ilogb(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 Int is the machine wordsize)
    • x = 0 returns FP_ILOGB0
    • x = ±Inf returns INT_MAX
    • x = NaN returns FP_ILOGBNAN
source
SLEEFPirates.log — Method
log(x)

Compute the natural logarithm of x. The inverse of the natural logarithm is the natural expoenential function exp(x)

source
SLEEFPirates.log_fast — Method
log_fast(x)

Compute the natural logarithm of x. The inverse of the natural logarithm is the natural expoenential function exp(x)

source
SLEEFPirates.sincos — Function
sincos(x)

Compute the sin and cosine of x simultaneously, where the output is in radians, returning a tuple.

source
SLEEFPirates.sincos_fast — Function
sincos_fast(x)

Compute the sin and cosine of x simultaneously, where the output is in radians, returning a tuple.

source