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.
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.
This cursed wrongness of many implementations of floor (returning closest integer not further from zero) has caused me no end of hassle through many different environments. The bugs can be quite subtle, but significant, and occasionally really weird. This uncertainty in floor behavior is not limited to c-libraries, but can also be encountered in some higher-level analysis packages, such as in graphical programming environments and interactive data analysis packages. After being bitten in the butt too many t
Yeah, it's a huge fucking pain. One of those functions you have to look up for every environment-- even though you know exactly what it's "supposed" to do, you have no idea if it's right in any given environment.
I haven't gone as far as just writing my own all the time, but if the library version is prone to changing from one implementation to another, I really should... that's a bug waiting to happen.
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: (Score:2)
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.
This cursed wrongness of many implementations of floor (returning closest integer not further from zero) has caused me no end of hassle through many different environments. The bugs can be quite subtle, but significant, and occasionally really weird. This uncertainty in floor behavior is not limited to c-libraries, but can also be encountered in some higher-level analysis packages, such as in graphical programming environments and interactive data analysis packages. After being bitten in the butt too many t
Re:make (Score:2)
Yeah, it's a huge fucking pain. One of those functions you have to look up for every environment-- even though you know exactly what it's "supposed" to do, you have no idea if it's right in any given environment.
I haven't gone as far as just writing my own all the time, but if the library version is prone to changing from one implementation to another, I really should... that's a bug waiting to happen.