Depending on what language/program/whatever you're using, it'll either round towards -inf (as apparently they've patched this one to do), or towards 0. The mathematical definition of the term "floor" is -inf, so I guess this change makes it "more correct." But God help you if you have a program that relied on the previous behavior.
But God help you if you have a program that relied on the previous behavior.
Well, IIUC, that would just entail converting all floors on negative numbers to ceils: double floorToZero (double n) {
return (n < 0) ? ceil(n) : floor(n); }
Re: (Score:0)
Re: (Score:2)
"floor" is one of those functions... ugh.
Depending on what language/program/whatever you're using, it'll either round towards -inf (as apparently they've patched this one to do), or towards 0. The mathematical definition of the term "floor" is -inf, so I guess this change makes it "more correct." But God help you if you have a program that relied on the previous behavior.
Re:make (Score:2, Informative)
Well, IIUC, that would just entail converting all floors on negative numbers to ceils:
double floorToZero (double n)
{
return (n < 0) ? ceil(n) : floor(n);
}
Re: (Score:2)
Once you notice the bug... after possibly years of extremely subtle incorrect accounting errors.
I'm not saying it's hard to fix. It's hard to find.