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 516159 - [ARITH] binary to decimal conversion doesn't convert numbers in exponential notation correctly
[ARITH] binary to decimal conversion doesn't convert numbers in exponential n...
Status: RESOLVED FIXED
Product: gnome-calculator
Classification: Core
Component: general
5.8.x
Other All
: Normal normal
: ---
Assigned To: Sami Pietilä
gcalctool maintainers
Depends on:
Blocks: 500994
 
 
Reported: 2008-02-13 01:56 UTC by Gero
Modified: 2008-12-08 14:24 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
The fix. (807 bytes, patch)
2008-04-21 12:02 UTC, Sami Pietilä
none Details | Review

Description Gero 2008-02-13 01:56:24 UTC
Please describe the problem:
When switching from binary to decimal mode with scientific notation, the mantissa and exponent of the number in the display are converted directly and separately to decimal numbers instead of converting the entire number to base 10. For instance, 1e+10(bin) becomes 10e+1(dec) instead of 4e+0(dec).

Steps to reproduce:
1. Switch mode to Scientific, Bin(ary), Sci.
2. Enter "1e+10". (In decimal this means 1*2^2 = 4. Note that in binary mode, both mantissa and exponent are in binary notation.)
3. Switch to Dec(imal) mode.

Actual results:
The display shows "10e+1" (100 = 10^2).

Expected results:
The display should show "4e+0" (2^2).

Does this happen every time?
Yes.

Other information:
When switching from binary to decimal in scientific notation, the tool needs to convert the entire binary number to the decimal base. The tool has the same problem with engineering notation.
Comment 1 Rich Burridge 2008-02-13 02:35:15 UTC
Confirmed that it's still a problem in gcalctool v5.21.91.

But only for arithmetic precedence mode. Left-to-right
precedence mode does the correct thing.

Sami could you take a look at this please?

Thanks.
Comment 2 Sami Pietilä 2008-04-13 08:20:02 UTC
I had a quick look at this. It seems to me that exp (xey) numbers generally work only in the base of 10. The reason for this seems to be the make_exp().

It should be simple to fix this. I'll write a patch as soon as I get to use a linux machine.
Comment 3 Sami Pietilä 2008-04-21 12:02:22 UTC
Created attachment 109616 [details] [review]
The fix.

Uses v-base as the base of exponential notation.

Please try that the exponential notation now works correctly.
Comment 4 Robert Ancell 2008-12-08 14:24:55 UTC
Fixed in 2.25.3