[Issue 3171] % not implemented correctly for floats

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Jul 14 01:49:31 PDT 2009


http://d.puremagic.com/issues/show_bug.cgi?id=3171


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug at yahoo.com.au




--- Comment #2 from Don <clugdbug at yahoo.com.au>  2009-07-14 01:49:30 PDT ---
(In reply to comment #1)
> As to why the code generator doesn't use FPREM1 instead of FPREM, there's the
> following comment: "We don't use fprem1 because for some inexplicable
> reason we get -5 when we do _modulo(15, 10)"
> 
> This could be a bug in older CPUs.

It isn't a bug. That's what the IEEE remainder specifies.
Note that C's fmod is NOT the same as IEEE remainder.

15/10 = 1.5, so there's a choice of n == 1 or n==2. The standard specifies even
n in such cases, so r == a - b*n == 15 - 2*10 == -5.

That's kind of... weird, highly non-intuitive, and not terribly useful. I'm
pretty sure that that behaviour would be unpopular.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list