Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#135 Numbers with commas entered wrong in US locale

open
nobody
5
2012-10-24
2012-10-24
Jonathan Ryshpan
No

When a number containing a comma is entered, it appears to Qalculate as a vector. For example, when I enter 1,000,000.00 Qalculate sees the vector [1,0,0]. It appears from the documentation that in the US locale, this entry should be recognized as the number 1000000.00 . My locale is:

$ locale
LANG=en_US.UTF-8
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE=POSIX
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

There isn't any configuration option affecting this.

System is Fedora-17, fully up to date running on an x86_64 system.
Release 3.5.10-38.fc17
Compiler g++

Discussion

  • Cousteau
    Cousteau
    2013-01-11

    This may be a documentation bug rather than a program bug. Where in the documentation does it say that?

    I've checked and on locales using comma as decimal separator, you can use both "." or "," for decimal separator, but there's an option to "ignore dots in numbers". This option is not in LANG=C, though.

    If you want to use a thousand separator (which is useful for checking that you aren't making any typos), you could use space instead, which is also the recommended way to avoid ambiguity (see http://en.wikipedia.org/wiki/Decimal_mark#Digit_grouping ) and is ignored by Qalculate!.

     
  • Cousteau
    Cousteau
    2013-02-08

    Maybe there should be 2 options always showing up:
    (1) Decimal separator: [system default (period|comma) ; period ; comma]
    (2) [X] Ignore {comma|period} in numbers; use as thousands separator.
    This would be nice since, despite my locale, I'm used to period being the decimal separator and comma the list separator.

     
  • Thanks for your comments about my posting on Qalculate. I don't know where in the documentation I found that for certain locales commas in numbers would be ignored. An earlier version of the manual (http://qalculate.sourceforge.net/gtk-manual/index.html for v0.9.2) expressly forbids separators in numerical input. ("Separators (ex. “1,000.00”), usually comma or dot whichever is not the decimal point, are not allowed.")

    I use qalculate (qalculate-kde) mainly for simple calculations on info from my bank's web site, which appear in the usual U.S. format as something like $123,445.78 (if only it were so large). Qalculate interprets this as the vector [$123, 456.78] but what I want is $123,456.78 . So I'm involved in a lot of tedious editing out of commas.

    How difficult would it be to fix this? The main problem appears to be that it's tied up with the way to enter vectors; it wouldn't be a good idea to fix entry of formatted numbers, while breaking entry of vectors. Would it be a good idea to have a mode in which commas in numbers would be ignored and something else (say semicolons “;”) would separate vector elements?

    I've taken a brief glance at the source for libqalculate (as distributed in Fedora-17), and this part looks pretty straightforward, except that I can't figure out what COMMA_S is; it appears to be unused. A historical artifact?