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

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

----- Original Message ----- 
From: "Urzumph" <Urzumph at HotPOP.com>
To: "Mailing List" <EUforum at topica.com>
Subject: Rob's going to hate me... (Remainder bug)


> 
> 
> 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
> 
> Running Euphoria 2.4
> 

Try this then...

function rmder(atom a, atom b)
atom x
    x = a / b
    return (x - floor(x)) * b
end function


? remainder(100, 0.01)
? rmder(100, 0.01)

? remainder(100, 0.2)
? rmder(100, 0.2)

? remainder(100, 1.01)
? rmder(100, 1.01)

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

Search



Quick Links

User menu

Not signed in.

Misc Menu