Libreoffice basic function "cdbl" ignores decimal numbers

Bug #806403 reported by Fabio Muzzi
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
libreoffice (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I have some macros that worked in OpenOffice (ubuntu 10.10) and do not work properly in LibreOffice (Ubuntu 11.04). I have found that the "cdbl" function, that converts a string to a double, fails at converting a number with a decimal part, like "5.5".
I have run some tests, also changed the locale setting, and found that:
With an italian locale setting (decimal separator is comma) cdbl("5,5") equals 5 (and not 5,5 as it should) and cdbl("5.5") equals 55.
With an english locale setting (decimal separator is dot) cdbl ("5,5" equals 55 and cdbl("5.5") equals 5.

I suppose that cdbl simply ignores the numbers after the decimal separator. It still can "see" the proper decimal separator, since using different locales it behaves in different but consistent ways.

I suppose, but I am not sure, that also the clng function is affected by the same bug.

ProblemType: Bug
DistroRelease: Ubuntu 11.04
Package: libreoffice-calc 1:3.3.2-1ubuntu5
ProcVersionSignature: Ubuntu 2.6.38-8.42-generic 2.6.38.2
Uname: Linux 2.6.38-8-generic x86_64
NonfreeKernelModules: nvidia
Architecture: amd64
Date: Wed Jul 6 12:15:13 2011
InstallationMedia: Ubuntu 9.10 "Karmic Koala" - Release amd64 (20091027)
ProcEnviron:
 LANGUAGE=en_GB:en
 LANG=it_IT.utf8
 LC_MESSAGES=en_GB.UTF-8
 SHELL=/bin/bash
SourcePackage: libreoffice
UpgradeStatus: Upgraded to natty on 2011-06-22 (13 days ago)

Revision history for this message
Fabio Muzzi (kurgan-kurgan) wrote :
Revision history for this message
penalvch (penalvch) wrote :

Fabio Muzzi, thank you for reporting this bug and helping make Ubuntu better. Could you please attach a Calc document that demonstrates this problem?

Changed in libreoffice (Ubuntu):
status: New → Incomplete
Revision history for this message
Fabio Muzzi (kurgan-kurgan) wrote :

Here is an example macro that shows the issue:

Sub Main
 tot5= cdbl("5.5")
 msgbox (tot5)
 tot6= cdbl("5,5")
 msgbox (tot6)
End Sub

You can find the same macro in the attached document.

If you run it, the dialog boxes will show "55" and "5" (or "5" and "55" depending on the locale). They should display "55" and "5.5".

penalvch (penalvch)
Changed in libreoffice (Ubuntu):
status: Incomplete → New
Revision history for this message
penalvch (penalvch) wrote :

Fabio Muzzi, this issue is unreproducible in Ubuntu 11.04, 32-bit LibreOffice Calc with Default - English (USA) locale via the Terminal:

cd ~/Desktop && wget -c https://bugs.launchpad.net/ubuntu/+source/libreoffice/+bug/806403/+attachment/2228013/+files/macro-cdbl-error.ods -O info.ods && localc -nologo info.ods

click Enable Macros button -> Tools -> Macros -> Run Macro -> under Library click info.ods -> Standard -> Module1 -> under Macro name Main highlighted -> Run button and notice a box pops up noting:

5.5

Next box shows:

55

lsb_release -rd
Description: Ubuntu 11.04
Release: 11.04

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

Revision history for this message
Fabio Muzzi (kurgan-kurgan) wrote :

Have you tried on 64 bit version? I run 64 bit version.

Changed in libreoffice (Ubuntu):
status: New → Confirmed
Revision history for this message
Pepe Wasquez (ppwasquez) wrote :

Hello, I have the same problem in ubuntu 11.04 32 bits, spanish language

I have been reading about this here: http://openoffice.org/bugzilla/show_bug.cgi?id=70236, and here http://openoffice.org/bugzilla/show_bug.cgi?id=78144, but I have no idea how fix it ......
I have done a clean installation from scratch but the problem persists
The only thing I achieved is with :

cdbl(val("5.5")) ... then I get 5,5 but it's wrong because (,) is the decimal separator
cdbl(val("5,5")) .... is 55

==============================================================================
Description: Ubuntu 11.04
Release: 11.04
libreoffice-calc:
  Instalados: 1:3.3.2-1ubuntu5
  Candidato: 1:3.3.2-1ubuntu5
  Tabla de versión:
 *** 1:3.3.2-1ubuntu5 0
        500 http://es.archive.ubuntu.com/ubuntu/ natty-updates/main i386 Packages
        100 /var/lib/dpkg/status
     1:3.3.2-1ubuntu4 0
        500 http://es.archive.ubuntu.com/ubuntu/ natty/main i386 Packages

Revision history for this message
Pepe Wasquez (ppwasquez) wrote :

in case this help to solve this issue:

After reading this post ...http://openoffice.org/bugzilla/show_bug.cgi?id=21413 ... if I start libreoffice from terminal with this comand:

 LANG=es_ES libreoffice .... I get this :

(process:3662): Gdk-WARNING **: locale not supported by C library

(soffice:3662): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.

but libreoffice starts , and if I open calc the macros seems to work as I expected

Revision history for this message
Fabio Muzzi (kurgan-kurgan) wrote :

You are right. I have tried like this:

kurgan@budell:~$ LANG=it_IT libreoffice

(process:4101): Gdk-WARNING **: locale not supported by C library

(soffice:4101): Gtk-WARNING **: Locale not supported by C library.
 Using the fallback 'C' locale.

and it works despite the errors.

What I really DON'T like is the fact that on the Openoffice bugzilla the bug got closed because basically they cannot understand it. I don't like openoffice at all, but there are no alternatives. And so we have to stick with buggy software, incomplete and buggy macro language, and so on.

Revision history for this message
CristianCantoro (cristiancantoro) wrote :

It is obviously a "localization" problem, I experience the same issue having this environment configuration:
cristian@cristian-F5N:~$ echo $LANG
it_IT.utf8
cristian@cristian-F5N:~$ echo $LANGUAGE
it_IT:it_CH:it:en
cristian@cristian-F5N:~$ echo $LC_MESSAGES
it_IT.UTF-8

And having Italian set as default language in LibreOffice.

My LibreOffice version is 1:3.4.5-0ubuntu1 on Ubuntu 11.10
It seems to be a long standing bug.

Cristian

Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This release of Ubuntu is no longer receiving maintenance updates. If this is still an issue on a maintained version of Ubuntu please let us know.

Changed in libreoffice (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Marcus Tomlinson (marcustomlinson) wrote :

This bug has sat incomplete for 6 months. Marking invalid.

Changed in libreoffice (Ubuntu):
status: Incomplete → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

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