ok... I think -0.0 is mathematically wrong but in a program it is true. What I suspect is that if -0.0 doesn't affect on result (e.g., 2*(-0.0 + 2) or (-0.0-2)*2 ) . If it does not affect results it would be good for me Thanks
Понедельник, 20 мая 2013, 9:03 -07:00 от Chris Barker - NOAA Federal <chris.bar...@noaa.gov>: >On Mon, May 20, 2013 at 8:54 AM, Bakhtiyor Zokhidov >< bakhtiyor_zokhi...@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.bar...@noaa.gov >_______________________________________________ >NumPy-Discussion mailing list >NumPy-Discussion@scipy.org >http://mail.scipy.org/mailman/listinfo/numpy-discussion
_______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion