[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Why do some math functions return -0
- From: KHMan <keinhong@...>
- Date: Mon, 20 Sep 2010 10:11:18 +0800
On 9/20/2010 4:45 AM, HyperHacker wrote:
Note that a number displayed as -0.0000 could also be a very small
negative number rounded to fit the display, e.g.:
%f rounds to six places by default. This is the proper meaning of
negative zero - a negative value that rounded to zero.
The last sentence is wrong. No book on computer arithmetic
discusses a negative zero in such a fashion. Do not mix negative
zeros with rounding behaviour. It is misleading with respect to
the standard use of the terminology.
It'd probably save you a lot of headache in the future to read up on
how floating-point works, as it has a lot of potential pitfalls.
Kein-Hong Man (esq.)
Kuala Lumpur, Malaysia