[upstream] Calc displays -0=-1*0

Bug #360836 reported by Federico Vera
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
LibreOffice
Fix Released
Low
OpenOffice
Invalid
Undecided
Unassigned
libreoffice (Ubuntu)
Fix Released
Low
Björn Michaelsen
openoffice.org (Ubuntu)
Won't Fix
Low
Unassigned

Bug Description

Binary package hint: openoffice.org

1) lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

2) apt-cache policy libreoffice-calc
libreoffice-calc:
  Installed: 1:3.3.2-1ubuntu5
  Candidate: 1:3.3.2-1ubuntu5
  Version table:
 *** 1:3.3.2-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

3) What is expected to happen in LibreOffice Writer via the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/360836/+attachment/2154833/+files/example.ods && localc -nologo example.ods

is
cell A1=-1
cell A2 =0
cell A3 0=A1*A2

4) What happens instead is cell A3 shows -0.

WORKAROUND: Use Gnumeric.

apt-cache policy gnumeric
gnumeric:
  Installed: 1.10.13-1ubuntu1
  Candidate: 1.10.13-1ubuntu1
  Version table:
 *** 1.10.13-1ubuntu1 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/universe i386 Packages
        100 /var/lib/dpkg/status

ProblemType: Bug
Architecture: i386
Dependencies:

DistroRelease: Ubuntu 9.04
Package: openoffice.org None [modified: /var/lib/dpkg/info/openoffice.org.list]
ProcEnviron:
 LANG=es_AR.UTF-8
 SHELL=/bin/bash
SourcePackage: openoffice.org
Uname: Linux 2.6.28-11-generic i686
UnreportableReason: Este no es un paquete Ubuntu genuino

Chris Cheney (ccheney)
Changed in openoffice.org (Ubuntu):
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Chris Cheney (ccheney) wrote : Re: [upstream] OOo Calc displays -0 when the cell is formated as fraction

Verified on official OOo 3.1.0 and dev300 m49 (OOo 3.2).

summary: - OpenOffice 3.01 Calc displays -0 when the cell is formated as fraction
+ [upstream] OOo Calc displays -0 when the cell is formated as fraction
Revision history for this message
Federico Vera (fedevera) wrote :

This bug is still present in OOO320m12 (Build:9483)

Revision history for this message
Federico Vera (fedevera) wrote :

This bug is still present in OOO320m12 (Build:9483) which is to say the version shipped with the latest Lucid

Chris Cheney (ccheney)
tags: added: jaunty
Revision history for this message
Federico Vera (fedevera) wrote :

Well the bug has expanded now... it also shows -0 in 'number' mode. Am I just nuts, or I'm the only one that uses OpenOffice Calc?

Revision history for this message
penalvch (penalvch) wrote :
  • example.ods Edit (7.6 KiB, application/vnd.oasis.opendocument.spreadsheet)
summary: - [upstream] OOo Calc displays -0 when the cell is formated as fraction
+ [upstream] Calc displays -0=-1*0
description: updated
tags: added: lo33
Revision history for this message
In , penalvch (penalvch) wrote :

Created attachment 47528
example.ods

Downstream bug may be found at:
https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/360836

1) lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

2) apt-cache policy libreoffice-calc
libreoffice-calc:
  Installed: 1:3.3.2-1ubuntu5
  Candidate: 1:3.3.2-1ubuntu5
  Version table:
 *** 1:3.3.2-1ubuntu5 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://us.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

3) What is expected to happen in LibreOffice Writer via the Terminal:

cd ~/Desktop && wget https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/360836/+attachment/2154833/+files/example.ods && localc -nologo example.ods

is
cell A1 =-1
cell A2 =0
cell A3 0=A1*A2

4) What happens instead is cell A3 shows -0.

Changed in libreoffice (Ubuntu):
importance: Undecided → Low
status: New → Triaged
Changed in openoffice.org (Ubuntu):
importance: Medium → Low
Revision history for this message
In , A6569208 (a6569208) wrote :

Partially confirmed. When opening your testfile with LO 3.4 RC2 / LO 3.4.0 it gives indeed the wrong version. But when doing it from scratch (see my example), it works as expected. So you might wanna check out that version.

Win2K [LibreOffice 3.4.0 OOO340m1 (Build:12)]

Revision history for this message
In , A6569208 (a6569208) wrote :

Created attachment 47536
-1*0=0 in LO 3.4 RC2

Changed in df-libreoffice:
importance: Unknown → Low
status: Unknown → Confirmed
Revision history for this message
In , timar (timar74) wrote :

(In reply to comment #2)
> Created an attachment (id=47536) [details]
> -1*0=0 in LO 3.4 RC2

I checked the content.xml in your file and it contains value -0. Actual displayed value depends on number format, locale, etc. I think that value of -0 should not happen at all. Kohei, what do you think?

Revision history for this message
In , Wope-1 (wope-1) wrote :

in calc, the numbers are floating point numbers. IEEE 754 says, there is a difference between positiv and negative numbers.

Revision history for this message
In , penalvch (penalvch) wrote :

wope, having LO display -0 does not make sense & does not uphold with Excel expectations compatibility.

Revision history for this message
In , Libreoffice-z (libreoffice-z) wrote :

Excel expectations compatibility are of really low interest for me, is there any mathematical text (public access) that seconds "-0 is wrong" and also may be some ODF explications? May be A "0" definition is "+0 = -0"?

The old Summary seems to be incomplete, for me (with preference "precision as shown unchecked"):
Standard FORMATTING can sow result "-0" for multiplication with 0, after result field showed result of multiplication "0 * negative Number" before; negative number also might have been "-0".

My results:
[Reproducible] from the scratch with "LibreOffice 3.4.1RC1 - WIN7 Home Premium (64bit) German UI [OOO340m1 (Build:103)]". It's a matter of formatting. With "Standard" formatting "-0" will be shown, with "0 decimals" or more than 0 decimals "0.0", "0.00" or similar.

The result is not 100% reproducible, sometimes after some testing a normal "0" will be shown as "-0", but when I save the document the view changes to "-0". Currently I do not understand the regularity.

Steps to reproduce:
0. Open new Calc document
2. Make sure that
   'Tools > Options > Calc > Calculate - "Precision as shown" unchecked
   And cells have number format "Standard"
3. Type
   A1: 0
   A2: 0
   A3: =A1+A2
   Result in A3: 0
4. Save:
   Nothing Happens
5. Type A2: -1
   Nothing happens
6. Save
   A3 switches to -0
7. Type A2: 0
   A3 remains -0
8. Save:
   A3 switches to 0

OOo 3.4-dev (obsolete) behaves in the same way.
I was not able to reproduce th "-0 effect" with OOo 3.1.1 and OOo 1.1.4

So I believe this bug is not a matter of mathematical correctness but a matter of unpredictable 0 sign

Revision history for this message
In , Libreoffice-z (libreoffice-z) wrote :

Dependency to result view to an older calculation result is not a good idea.

Changed in df-libreoffice:
status: Confirmed → In Progress
Revision history for this message
In , Kohei Yoshida (kohei-yoshida) wrote :

Maybe for 3.5.

FYI in the scenario presented in the description Excel produces 0, not -0. So the interoperability argument does not hold in this particular case.

Changed in openoffice.org (Ubuntu):
status: Triaged → Won't Fix
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote : migrating packaging from OpenOffice.org to Libreoffice

[This is an automated message.]
There are no new official OpenOffice.org releases in Ubuntu packaging anymore => Won't Fix

If the problem persists, please mark this bug as "also affects project Libreoffice" or "also affects distribution Libreoffice (Ubuntu)" if that has not happened already.

Please leave references to upstream OpenOffice.org bugs in place to allow cross pollination.

Revision history for this message
penalvch (penalvch) wrote :

No reference URL.

Changed in openoffice:
status: New → Invalid
Revision history for this message
In , Markus Mohrhard (moggi) wrote :

I have a fix based on the assumption that -0 is a valid IEEE 754 number that should never appear in the view.

We just need to check in the number formatter that we show the minus sign only if the value is unequal to 0.0. IEEE 754 allows -0, 0 and +0 but asks that the check -0 == 0 returns true.

Revision history for this message
In , Markus Mohrhard (moggi) wrote :

pushed my fix to master for the 3-5 release

Changed in df-libreoffice:
status: In Progress → Fix Released
Revision history for this message
Björn Michaelsen (bjoern-michaelsen) wrote :

Fixed as per upstream 3.5.0 released with precise.

Changed in libreoffice (Ubuntu):
status: Triaged → Fix Released
assignee: nobody → Björn Michaelsen (bjoern-michaelsen)
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Bug attachments

Remote bug watches

Bug watches keep track of this bug in other bug trackers.