|
On 9/20/2010 4:45 AM, HyperHacker wrote:
[snipped all] Note that a number displayed as -0.0000 could also be a very small negative number rounded to fit the display, e.g.:=('%f'):format(-0.00000001)-0.000000 %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.
Ironic. -- Cheers, Kein-Hong Man (esq.) Kuala Lumpur, Malaysia