From: Calamitas Date: 2007-09-03T19:29:08+09:00 Subject: Re: Bug in % (Float)? On 03/09/07, Morton Goldberg wrote: > On Sep 2, 2007, at 7:57 PM, Calamitas wrote: > > Well, the smallest n for which m_mod_n(1.0, 1.0 / n) is way off is n = > > 93. If it's any consolation though, among the first million n, there > > are only 78161 for which m_mod_n doesn't give something zeroish. There > > are 497886 such n for which Ruby's built-in % is off. > > That is a real consolation :) > > Seriously, to me, this is the most convincing argument you've come up > with in support of your position that finding a better method for > computing % with floats is a lost cause. In theory, I think it's possible to do % in a way that enforces that 1.0 % (1.0 / n) equals 0.0 or something close to it. This could be done by shifting the discontinuity slightly. But it creates a bias that may be detrimental to other applications. > > Will you let me know what Wolfram Research answers? > > Certainly. I'll pass it on directly to your gmail account. It may be > some time before I get an answer since they are a bit swamped right > now with problems arising from their new Mathematica 6 release, and > my query is a minor side-issue from their POV. Ok, thanks. Regards, Peter