GNOME Bugzilla – Bug 516159
[ARITH] binary to decimal conversion doesn't convert numbers in exponential notation correctly
Last modified: 2008-12-08 14:24:55 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.
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.
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.
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.
Fixed in 2.25.3