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 778308 - Script-Fu Prints floating numbers with a comma instead of a point and adds '.0'
Script-Fu Prints floating numbers with a comma instead of a point and adds '.0'
Status: RESOLVED OBSOLETE
Product: GIMP
Classification: Other
Component: Script-Fu
gimp-2-8
Other All
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
Depends on:
Blocks:
 
 
Reported: 2017-02-07 20:15 UTC by niels.giesen
Modified: 2018-05-24 17:23 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description niels.giesen 2017-02-07 20:15:14 UTC
The output of script-fu (whether through the console or with gimp -c --batch-interpreter=plug-in-script-fu-eval -b - ) of floating values is strange and is not accepted as such again by script-fu itself:

The decimal point gets replaced with a comma, and then a period and 0 get appended.

Example output

ts> (- 0.5 0.1)
0,4.0

(expected: 0.4)

ts> 34.5
34,5.0

(expected: 34.5)

ts> '(0.4 0.4)
(0,4.0 0,4.0)

(expected: (0.4 0.4)

I tried this with an 'unwrapped' tinyscheme (1.41), and got normal output.
Comment 1 Michael Natterer 2017-02-08 18:45:18 UTC
That happens with a german locale. Something is horribly broken
in there.
Comment 2 Michael Natterer 2017-02-08 18:46:18 UTC
Also happens on master btw.

Niels, does it also happen with 'unwrapped' tinyscheme when you use
ther german locale?
Comment 3 Michael Schumacher 2017-06-19 14:32:13 UTC
Niels, can you answer the question, please?
Comment 4 Michael Schumacher 2017-08-31 20:23:15 UTC
Niels?
Comment 5 Kevin Cozens 2017-09-01 23:35:11 UTC
The problem is in the atom2str() routine. Inexact (non-integer) numbers are converted to a string using snprintf() with the %g format. The %g format suppresses trailing zeros. The R5RS states that inexact numbers should show at least one decimal place. This means an inexact 4 is to be printed as 4.0. An if statement looks for a . or an e in the string version of the number. If neither is found ".0" is appended. This doesn't work in a locale that does not use the a period as a decimal point separator.

The code needs to be updated to use the record separator pointed to by the lconv struct.
Comment 6 Michael Natterer 2018-01-01 21:03:47 UTC
No, the code needs to be updated to never print commas and always use '.'
as a decimal separator. This is a programming language and no word
processor :)
Comment 7 Kevin Cozens 2018-04-28 01:37:17 UTC
True, Michael, but you would expect the program to follow the conventions of the locale in which it is operating. I don't think you would want Script-Fu to ignore locale and have strings always shown in English so that numbers can always use the dot separator.

The line in scheme.c that looks for either '.' or 'e' in the number could include ',' but the locale needs to be consulted as to which character should be appended before the '0' for inexact numbers that have integer equivalents.
Comment 8 GNOME Infrastructure Team 2018-05-24 17:23:31 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gimp/issues/1049.