Re: Rob's going to hate me... (Remainder bug)
- Posted by "Derek Parnell" <ddparnell at bigpond.com> Nov 07, 2003
- 585 views
----- 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)