Trigonometry-related functions. More...
Functions | |
uint64_t | sp::fixed_phase_reduce (float input) |
Reduces a single-precision floating-point number modulo 2 pi. More... | |
float | sp::float_phase_reduce (float input) |
Map the input to the interval [-float(pi), float(pi)] by reducing modulo 2 pi. More... | |
Trigonometry-related functions.
uint64_t sp::fixed_phase_reduce | ( | float | input | ) |
Reduces a single-precision floating-point number modulo 2 pi.
The result is returned multiplied by 2^64 / (2pi).
NOT to be used if the input is already in the interval [-1/128, 1/128].
The most difficult input is 10838702 (this being rather jolly close to an integer multiple of 2 pi).
float sp::float_phase_reduce | ( | float | input | ) |
Map the input to the interval [-float(pi), float(pi)] by reducing modulo 2 pi.
Here float(pi) := sp::bitcast<float>(0x40490fdb) is the closest IEEE 754 single-precision float to the mathematical constant pi.