simon,

The IEEE Standard for Floating-Point Arithmetic (IEEE 754) defines sets of 
binary and decimal floating-point data, which consist of finite numbers 
(including signed zeros and subnormal numbers), infinities, and special 
"not a number" values (NaNs).

Signed Zero: https://en.wikipedia.org/wiki/Signed_zero

Peter

On Sunday, March 12, 2017 at 2:10:30 PM UTC-4, simon place wrote:
>
> when trying to compare two floats, for testing, i ran into the usual 
> problems with rounding.
>
> so, i thought, a nice way out would be to compare their fixed precision 
> formatted strings.
>
> which works except, fmt "%f" fixed precision still contains an unnecessary 
> rounding issue;
>
> when the float is very near zero, (it can be slightly above or below 
> depending on rounding), fmt adds a '-' or it doesn't, meaning you get for 
> example "-0.00000"
>
> why have just one value, zero, at which two floats, which are the same to 
> the precision, print differently?
>  
> this doesn't seem to be 'human readable' output, no human would add the 
> unnecessary '-'.
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to