
On Mon, May 20, 2013 at 8:54 AM, Bakhtiyor Zokhidov <bakhtiyor_zokhidov@mail.ru> wrote:
what about the following example:
new_ceil(-0.24, 0.25) -0.0
ceil rounds toward +inf (and floor towards -inf) -- this is exactly what you want if you're doing what I think you are...(note that round() rounds towards and away from zero -- so different for negative numbers...) the minus sign means "minus 0.0", which is a seemingly odd floating point thing -- but FP numbers have a sign bit, which, in this case, is set to negative, even though, mathematically speaking, 0.0 doesn't have a sign. But it will compare to 0.0 as you'd expect: In [8]: -0.0 == 0.0 Out[8]: True In [9]: -0.0 < 0.0 Out[9]: False -Chris -- Christopher Barker, Ph.D. Oceanographer Emergency Response Division NOAA/NOS/OR&R (206) 526-6959 voice 7600 Sand Point Way NE (206) 526-6329 fax Seattle, WA 98115 (206) 526-6317 main reception Chris.Barker@noaa.gov