Panorama unicorns


#1

I have an irrational bias against minus zero, i,e., -0. I have reports that display that value. It has not caused any calculation errors, but it still bothers me. I also discovered that:
abs(-0) ==> 0
but if variable=-0,
abs(variable) ==> -0, surprising, no?
Fortunately, however,
-(-0) ==> 0, yes!
and
-0=0 ==> TRUE
It just proves that nothing is more annoying in the world of numbers than nothing and that nothing in the world of numbers is more annoying than nothing.


#2

Also
-1 * 0 ==> -0 -1 * -0 ==> 0 -0 + 0 ==> 0

Adding zero to any value will eliminate -0, while leaving other values unchanged.

PS zero factorial is one, so -(-0) ==> 0! is slightly misleading. :wink:

Dave


#3

Good point; I removed the “!”.


#4

The floating point format actually has both a positive and a negative 0 https://en.wikipedia.org/wiki/IEEE_floating_point which is why -1*0 is -0. A possibly more common reason to see negative 0 displayed would be that a very small negative number is being rounded by an output pattern.

If you are using an output pattern of #.## to display a financial value, for example, -0.00 might just be a negative value that is closer to 0, than it is to -0.01. Using pattern(round(Total,0.01),"#.##") instead of just pattern(Total,"#.##") should give you 0.00 instead of -0.00.

Dave