Re: Rob's going to hate me... (Remainder bug)

new topic     » goto parent     » topic index » view thread      » older message » newer message

Urzumph wrote:
> Heh, twice in a week, lol
> ? remainder(100,0.01)
> gives 0.01 and I am sure that's not supposed to happen
> This is reproducable with all numbers <= 0.2
> for some reason, all numbers > .2 work as they should.
> Also, this only affects numbers which are cleanly divisable.
> ? remainder(100.001,0.01) returns 0.001 as it should

Don't lol too hard.
Your first one wasn't a bug, and neither is this one.

This remainder issue came up on the mailing list
a few years ago. It's basically an incarnation of the old
"0.1 (0.01 etc.) can't be represented exactly on
Intel hardware" problem. Once or twice every year
someone on this list is shocked to find that
floating-point calculations aren't perfectly exact,
and the error can sometimes be magnified into an
obviously incorrect answer...

http://www.listfilter.com/cgi-bin/esearch.exu?fromMonth=2&fromYear=5&toMonth=2&toYear=5&postedBy=rds&keywords=remainder

(the URL might wrap - be careful)

Regards,
    Rob Craig
    Rapid Deployment Software
    http://www.RapidEuphoria.com

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu