input value
remainder elements
factor of π/2
var y = [ 0.0, 0.0 ];
var n = rempio2( 128.0, y );
// returns 81
var y1 = y[ 0 ];
// returns ~0.765
var y2 = y[ 1 ];
// returns ~3.618e-17
var y = [ 0.0, 0.0 ];
var n = rempio2( NaN, y );
// returns 0
var y1 = y[ 0 ];
// returns NaN
var y2 = y[ 1 ];
// returns NaN
Computes
x - nπ/2 = r
.Notes
n
and stores the remainderr
as the two numbersy[0]
andy[1]
, such thaty[0] + y[1] = r
.2^20 * π/2
in magnitude, the function only returns the last three binary digits ofn
and not the full result.