After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 131059 - Incorrect orders of constants on some locales
Incorrect orders of constants on some locales
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Rich Burridge
Rich Burridge
Depends on:
Blocks:
 
 
Reported: 2004-01-10 00:44 UTC by Andrey Panov
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: 2.3/2.4


Attachments
Proposed patch (945 bytes, patch)
2004-01-14 02:47 UTC, Alexander Nedotsukov
none Details | Review
Correct patch. (964 bytes, patch)
2004-01-14 03:03 UTC, Alexander Nedotsukov
none Details | Review

Description Andrey Panov 2004-01-10 00:44:12 UTC
The orders of constants on locales with comma as decimal point (Russian,
LC_ALL=ru) are incorrect, for example pi=3.1415...e+10. 

gcalctool also does not understand separate locale categories, for example
LC_NUMERIC.
Comment 1 Rich Burridge 2004-01-10 15:17:52 UTC
When you do Help->About for gcalctool, what
version number is returned?
Comment 2 Andrey Panov 2004-01-11 23:52:25 UTC
4.3.35
Comment 3 Rich Burridge 2004-01-12 00:28:56 UTC
This is a duplicate of bug #130282. Look there (in
the last few comments) for a one line change that
fixes this problem. On checkout the latest version
from CVS HEAD (where it was fixed in v4.3.36).


*** This bug has been marked as a duplicate of 130282 ***
Comment 4 Andrey Panov 2004-01-13 01:48:05 UTC
The bug is not resolved and it does not duplicate bug #130282. On
Russian locale e is still "2,718281828e+10".
Comment 5 Andrey Panov 2004-01-13 01:49:03 UTC
Gcalctool 4.3.37 was checked.
Comment 6 Rich Burridge 2004-01-13 02:31:07 UTC
Adding bland@mail.ru to the cc: list as he reported
a somewhat similar problem (bug #129956) with gcalctool
a little while ago, and might have some ideas what
the problem is here.
Comment 7 Andrey Panov 2004-01-13 02:58:38 UTC
I suspect the bug #129956 differs from this. I think you should check
lines like this:
init_constant(3, "3.1415926535");          /* pi */
in get.c. 
And why gcalctool does not use constants from libc?
Comment 8 Alexander Nedotsukov 2004-01-13 04:46:36 UTC
Guys, Can this be something Linux specific?
On my FreeBSD system this give me excactly what I expected to see for
both Eng/Sci modes:
$LC_ALL=ru_RU.KOI8-R gcalctool

e=2,718281828e+0
...
Moreother gcalctool handles LC_NUMERIC properly here.

Btw. What is displayed in fixed (Fix) mode?
Comment 9 Rich Burridge 2004-01-13 15:44:35 UTC
Adding Toshi my I18N expert. Toshi, can you think of 
any reason why this would be a Linux-only failure or
what might be going wrong here?
Comment 10 Rich Burridge 2004-01-13 18:46:00 UTC
Andrey, as a data point, do the constants look
wrong when you are in fixed mode (rather than
scientific mode). Just trying to narrow where
the problem is. Thanks.
Comment 11 Rich Burridge 2004-01-13 22:24:30 UTC
Andrey, one other thing. Can you please
specify a set of steps we can do, to try to
reproduce this. I'm assuming it's as simple as:

% LC_ALL=ru_RU locale -k LC_NUMERIC
% gcalctool

Set the mode to Scientific.
Look at the constants in the constants menu.

And you are seeing "e" as 2,718281828e+10 rather
than 2,718281828e+0

Correct?

Which flavour of Linux are you running b.t.w. ?

Thanks.
Comment 12 Andrey Panov 2004-01-14 00:30:18 UTC
The constants are wrong in all the modes (scientific, fixed,
engineering). For example in fixed mode e=27182818284 .
My system is slackware-current (glibc-2.3.2, compiled by gcc-3.3.2,
linux-2.4.24).
I define varibles LANG=ru_RU.KOI8-R and LC_ALL=ru_RU.KOI8-R for my
locale and do not define separate categories. After applying

$ LC_ALL=ru_RU locale -k LC_NUMERIC
decimal_point=","
thousands_sep="."
grouping=3;3
numeric-decimal-point-wc=44
numeric-thousands-sep-wc=46
numeric-codeset="ISO-8859-5"

gcalctool behaves in the same way. To reproduce it you must have this
locale installed. Check with "locale -a". It is better to use
LC_ALL=ru_RU.KOI8-R (usually this codeset is used). And it seems on my
system LC_NUMERIC cannot be defined separately from LC_ALL when the
LC_ALL is defined. So the way to start gcalctool for testing is:

$ LANG= LC_ALL= LC_NUMERIC=ru_RU.KOI8-R gcalctool

On FreeBSD case - it may have different locales, for example for
thousands separator.

I think the definitions to constants should be changed to 
init_constant(3, "3%c1415926535"); 
with calling MPstr_to_num() with a radix as an argument.
Comment 13 Alexander Nedotsukov 2004-01-14 01:57:00 UTC
Okay I know where the problem is. It's thousands_sep="."
I have thousands_sep=" " and this is why my system is not affected.
The code in cgarge is remove_tsep() call inside MPstr_to_num().
It simply strips out radix in this case.
I don't think the way to use %c proposed by Andrew is good. Basicly
such things should be done in "C" locale. I think the best place to
fix the problem finally is to swap a couple of lines in do_calctool().
Comment 14 Alexander Nedotsukov 2004-01-14 02:47:44 UTC
Created attachment 23333 [details] [review]
Proposed patch
Comment 15 Andrey Panov 2004-01-14 02:58:23 UTC
This patch does not resolve the bug.
Comment 16 Alexander Nedotsukov 2004-01-14 03:01:44 UTC
Damn it. You are right. I submitted wrong file. It misses significant
v->tsep = "";
Comment 17 Alexander Nedotsukov 2004-01-14 03:03:42 UTC
Created attachment 23335 [details] [review]
Correct patch.
Comment 18 Andrey Panov 2004-01-14 03:15:08 UTC
OK
Comment 19 Rich Burridge 2004-01-14 11:20:29 UTC
Thankyou Alexander. Patches checked into
CVS HEAD. Fixed in v4.3.38. By that I mean,
I've bumped the version number (defined in
configure.in) to v4.3.38, so if you check out
from CVS HEAD, that's what to look for (or
via Help->About).

I'll now work towards generating a new gcalctool
tarball on ftp.gnome.org with this fix in, and
hopefully will still be in time for GNOME 2.5.3.