Trouble understanding rem_pio2_kernel

I’m having trouble understanding Base.Math.rem_pio2_kernel.
Consider the following:

julia> const rempio2 = Base.Math.rem_pio2_kernel
rem_pio2_kernel (generic function with 2 methods)

julia> rempio2(0.0)
(-1, Base.Math.DoubleFloat64(1.5707963267948966, 6.12323399538461e-17))

julia> rempio2(nextfloat(0.0))
(1, Base.Math.DoubleFloat64(-1.5707963267948966, -6.12323399538461e-17))

julia> rempio2(prevfloat(0.0))
(-1, Base.Math.DoubleFloat64(1.5707963267948966, 6.12323399538461e-17))

julia> rempio2(10000.0)
(6366, Base.Math.DoubleFloat64(0.310583623688122, -5.7722118981828364e-18))

julia> rempio2(1e8)
(1, Base.Math.DoubleFloat64(0.3718988077091178, 2.2854919533097746e-17))

Everything seems OK until the last one; I was expecting the first entry to be 1e8 / (pi/2) approximately.

It’s also surprising that the first result returned is never 0.

There is some documentation, but I agree it could probably be improved.

The first value k has the property that

mod(k, 4) == mod(round(x / (pi/2)), 4)

if computed exactly.