While looking at implementing floating point modulus in double-precision on an x86 CPU, I found the FPREM instruction and proceeded to test the practical precision in some cases, one being
1e48 mod 1.5
The FPREM implementation returns 1 as result, which looked "right" to me (as 1e48 is not a multiple of 3).
Then I checked against Wolfram Alpha but it returned 0 (http://www.wolframalpha.com/input/?i=1e48+mod+1.5%29)... now I am having doubts, is Wolfram failing or are FPREM and my expectation wrong?
Also in case Wolfram is failing, is there an online high-precision resource I could use to compare floating point modulus precision?
The true value of $10^n$ mod $1.5$ is $1$ for all positive integers $n$. Wolfram Alpha gets it right for $n \le 16$, and wrong for (it seems) all $n \ge 17$.
Wolfram Alpha gets
1e17 mod 3
right, but1e17 mod 3.0
wrong. So a loss of floating-point precision is to blame.