# handling of negative zero, '-0', - medium quirk - solved?

In addition to issue #603 (closed), there are a few more points where the handling of '-0' in gnumeric is a bit weak:

'-0' typed without apostrophes in cell A1 results in '−0', while.

'=-0' in B1 -> yields '0', ok, but

'=A1' in C1 -> '−0', ?,

Attention! when changing the operands in the formulas or cell references, '0' and '-0' are often not recalculated,

not corrected, the results 'stick' to the cells and can't be replaced with it's opposite!

I.e. if you mistyped you have to delete the cell first before you try again, otherwise you can get unexpected

deviations from unexpected results.

'=abs(A1)' in A2 -> '0', ok,

'=sign(A1)' in A3 -> '0', ??,

'=int(A1)' in A4 -> '−0', ???,

'=ceil(A1)' in A5 -> '0', recently fixed,

'=trunc(A1)' in A6 -> '−0', ???,

'=floor(A1)' in A7 -> '0', ok,

'=ceiling(A1)' in A8 -> '0', ok,

'=round(A1)' in A9 -> '−0', ???,

'=rounddown(A1)' in A10 -> '−0', ???,

'=roundup(A1)' in A11 -> '−0', ???,

'=value(A1)' in A12 -> '−0', ???,

'=text(A1, "0")' in A13 -> '0', ok,

Funny:
copy A1:A13 to C1:C13 ( ctrl-c - ctrl-v ),

change C1 to '0',

and see that the minuses in C4, C6 and C9:C12 are kept, ???,

the problems are not limited to '-0' as origin:

'=int(-5e-324)' in A15 -> '−0', ???,

'=trunc(-0.9999999999999994)' in A16 -> '−0', ???,

'=floor(-0.9999999999999994)' in A17 -> '−0', ???,

'=ceiling(-5e-324)' in A18 -> '−0', ???,

'=round(-0.49999999999999983)' in A19 -> '−0', ???,

'=rounddown(-0.9999999999999994)' in A20 -> '−0', ???,

'=roundup(-5e-324)' in A21 -> '−0, ???,

even funnier:

copy A15:A21 into C15:C21 ( ctrl-c - ctrl-v ),

delete the minuses of the significands in C15:C21,

and see that the resulting cell contents still show '−0', ???,

that way you get a cell C19 with the formula '=round(0.49999999999999983)'

and the result '-0', this cell can be copied and pasted -> '-0', keying the

formula in a fresh cell or copy'npaste of the formula will yield '0', but

not if the target cell resulted in '-0' before.

also some simple calculations with above operands yield '−0' as result, try:

```
'=A1-0'
'=A1*1'
'=A1*1000'
'=A1/1'
'=A1/1e+308'
```

while `'=A1+0' -> '0'`

.

The flaws in col. A survive, while col. C with changed C1 is corrected in a save-load cycle.

I have! tried to test all cases that came to my mind, but neither can claim completeness nor I'm safe against flaws in my system, pls. re-test. I tested with gnumeric 1.12.50 ( kali distro, still had '=ceil( A1 )' -> '-0' ), a clean 1.12.53 from around 2022-05-06, and a lightly patched ver. from around 2022-06-07.