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 681775 - Use different character and higher precedence for power of ten key (E or ⏨) to avoid precedence confusion and reduce parentheses
Use different character and higher precedence for power of ten key (E or ⏨) t...
Status: RESOLVED OBSOLETE
Product: gnome-calculator
Classification: Core
Component: general
unspecified
Other Linux
: Normal major
: ---
Assigned To: gcalctool maintainers
gcalctool maintainers
: 650949 653901 688598 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2012-08-13 15:40 UTC by iwiedenhover
Modified: 2018-05-22 11:48 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Adds support for scientific notation (6.74 KB, patch)
2013-04-20 02:23 UTC, Santiago Saavedra
none Details | Review

Description iwiedenhover 2012-08-13 15:40:16 UTC
I am using ubuntu 12.04;

gcalctool:
Negative exponents cause arithmetic mistake in division;
They seem to work in multiplication / addition. 

The negative exponents were entered using "1" "x10^y" "-" "1" 

Example: 
1×10⁻¹÷1×10⁻¹=
Result
10×10⁻³
Comment 1 Charlie_S 2012-09-07 13:14:30 UTC
I see something similar with Ubuntu 11.10 and gcalctool 6.2.0; and:

Linux hostname 3.0.0-23-generic #39-Ubuntu SMP Thu Jul 19 19:18:53 UTC 2012 i686 i686 i386 GNU/Linux

cat /proc/cpuinfo 
processor	: 0
vendor_id	: GenuineIntel
cpu family	: 6
model		: 23
model name	: Intel(R) Celeron(R) CPU          900  @ 2.20GHz
stepping	: 10
:
:


Select 'Advanced' mode.

Calculate eg

1.25x10^9 / 125x10^6

INCORRECT result displayed is 1x10^13

I THINK occurrence of this bug depends on 'what has been done before', as I am 99% sure that the 1st time I used the advanced mode & divided large numbers, the answer was correct; but performing a 2nd calculation gave an incorrect result immediately.

Will update this bugzilla entry if I am able to re-produce this behaviour (ie re-boot; simply closing the calculator & re-starting is not sufficient).
Comment 2 Santiago Saavedra 2013-04-20 00:46:46 UTC
Should this be considered a bug as is?

Actually, if we have an operation like, due to the operator precedence in maths:

1×10⁻¹÷1×10⁻¹ = ((1×(10⁻¹))÷1)×(10⁻¹) = ((1×0.1)÷1)×0.1 = 0.1÷1×10⁻¹ = 0.01


However, I understand that you want to use x×10^y as a way of inputing numbers using the Scientific Notation [1] convention.


However, (IMHO) using that as is would introduce an ambiguity in the multiplication (because it would depend on whether it is followed or not by 10^n; which is not consistent with maths).

Actually, you can do the computation as follows:
>>> a = 1×10⁻¹
>>> b = 1×10⁻¹
>>> a÷b

Because that would translate (mathematically*) to
> (1×10⁻¹)÷(1×10⁻¹)


(* I am not saying that gnome-calculator does that; just that it is equivalent)


To introduce the scientific notation, I think we should use another character, such as ⏨ (U+23E8) to indicate a x10^n attached-to-the-number multiplication that should take precedence over other operators.

But then, how should we consider things like:

5⏨2³⏨2³ ?

(5×10^(2^3)×10^(2^3))
(5×10^(2^(3×10^(2^3))))
(5×10^(2^(3^1×10^(2^3))))

(others?)

Maybe it should be an error to use that character more than once per number?
Many calculators disallow the usage of more than one "E" per number, as well as non-integer exponents.


[1] http://en.wikipedia.org/wiki/Scientific_notation
Comment 3 Santiago Saavedra 2013-04-20 02:23:46 UTC
Created attachment 241962 [details] [review]
Adds support for scientific notation

This patch adds scientific notation via a new character (similar to the E character found in many calculators).
Comment 4 Rob 2013-11-06 22:12:23 UTC
I'm not real familiar with this calculator, but when I typed "1 Ctrl+E 4 / 1 Ctrl+E 2 <Enter>", I meant I wanted the program to calculate 1000 divided by 100, and I was quite surprised to have the answer come out to be 1000000 and not 100.  I'm running gnome-calculator 3.8.2 on Ubuntu 13.10.

This program looks like a general-purpose calculator, and it's the default calculator for my distribution.  As such it should act like a general-purpose calculator for simple calculations, or it should be presented as something else and not used as the default calculator for the largest Linux distribution.  

"I tried Linux once.  The calculator didn't do scientific notation right.  I tried to report the bug, but I was told that I wasn't using the program right."  I'm sorry to complain to volunteers, but don't people see how problems like this help turn people away from Linux?

Thank you for all your hard work, volunteers.

- Rob
Comment 5 Stewart C. Russell 2013-11-21 13:19:29 UTC
Still present in version shipped with Ubuntu 13.10 (3.8.2)

Ubuntu bug report: https://bugs.launchpad.net/ubuntu/+source/gnome-calculator/+bug/1210607
Comment 6 Michael Catanzaro 2014-12-23 03:48:34 UTC
*** Bug 650949 has been marked as a duplicate of this bug. ***
Comment 7 Michael Catanzaro 2014-12-23 04:02:00 UTC
Comment on attachment 241962 [details] [review]
Adds support for scientific notation

Hi, do you have time to rebase this patch? It doesn't apply on master.

I think this would be a good change to make because it would significantly reduce the number of parentheses needed when working with powers of 10, and it's indeed how a power-of-ten (normally E) button on a calculator is expected to behave. Arth, what do you think?
Comment 8 Michael Catanzaro 2014-12-23 04:19:44 UTC
*** Bug 688598 has been marked as a duplicate of this bug. ***
Comment 9 Michael Catanzaro 2014-12-23 04:25:26 UTC
*** Bug 653901 has been marked as a duplicate of this bug. ***
Comment 10 trondsg 2015-07-23 13:12:45 UTC
As a bystander I accidentaly stumbled across this bug report and got curious.
Note: I'd urge everyone to type a star * in this post, not an x, if that's what you type on the keyboard to get multiplication symbol on the screen.

After reading all posts I see that there is some legitimate confusion over the x10^y button. Which I didn't realize at first, because the reporters didn't include the expected outcome.

It turns out this button does exactly what it says on it, and nothing else. Normally, when working with scientific notation, one uses fractions, which adds implicit parenthesis around the nominator and the denominator.

----------------------------------
Answer to the original post: 

> The negative exponents were entered using "1" "x10^y" "-" "1" 
> 
> Example: 
> 1×10⁻¹÷1×10⁻¹=
> Result
> 10×10⁻³

I get the gnome-calculator result 0.01 which is == 10×10⁻³. So can I confirm the mathematical behaviour.

When calculating 1×10⁻¹÷1×10⁻¹ by hand I get 10^(-2), which happens to be == 0.01.
1 * 10^(-1) / 1 * 10^(-1) = 
10^(-1) / 1 * 10^(-1) = 
10^(-1) * 10^(-1) = 
10^(-1+(-1)) =
10^(-2).

When typing 1×10⁻¹÷1×10⁻¹ into my casio CFX-9850GC PLUS calculator as 1×10^-1÷1×10^-1 I get 0.01. 

I used the standard "subtraction operator". There is also a key with a parenthesised tiny - that is the negation operator. Using this operator I still get 0.01.

There is also a "fraction" operator. Using this instead of division still gives 0.01.

So I think 10^-2 is the correct result.

Also, you didn't include the expected behaviour (what result you wanted). Always do that when making bug reports.

--------------------------------
(In reply to Charlie_S from comment #1)
> I see something similar with Ubuntu 11.10 and gcalctool 6.2.0; and:

> 
> Select 'Advanced' mode.
> 
> Calculate eg
> 
> 1.25x10^9 / 125x10^6
> 
> INCORRECT result displayed is 1x10^13

You too: You didn't include the expected behaviour (what result you wanted). Always do that when making bug reports.

Again: My Casio gives the same result. Calculating by hand as well:
1.25 * 10^9 / 125 * 10^6 = 
1.25 * 10^9 * (1/125) * 10^6 =
1.25 * (1/125) * 10^9 * 10^6 =
0.01 * 10^15 =
10^(-2) * 10^15 =
10^13

The mistake you're making is that you believe that my not including spaces around the x, but including spaces around the /, it would "magically" change the mathematical order of operations into (1.25x10^9) / (125x10^6) This isn't the case.

----------------------------------------------------
(In reply to Santiago Saavedra from comment #2)

> To introduce the scientific notation, I think we should use another
> character, such as ⏨ (U+23E8) to indicate a x10^n attached-to-the-number
> multiplication that should take precedence over other operators.

I agree.

> But then, how should we consider things like:
> 
> 5⏨2³⏨2³ ?

It should be disallowed.

The format of a number in this format would be 
ScfNumber ::= ScfDecimal ⏨ [-] Integer
Integer   ::= Digit [Integer]
Digit     ::= 0-9
Decimal   ::= [-] Digit . Integer

Not sure if there will be a conflict between subtraction and negative ScfNumbers, though.

------------------------------------------------------------
(In reply to Rob from comment #4)
> I'm not real familiar with this calculator, but when I typed "1 Ctrl+E 4 / 1
> Ctrl+E 2 <Enter>", I meant I wanted the program to calculate 1000 divided by
> 100, and I was quite surprised to have the answer come out to be 1000000 and
> not 100.  I'm running gnome-calculator 3.8.2 on Ubuntu 13.10.

I agree, there is a problem with this shortcut. The problem isn't in the calculation itself, because the shortcuts inputs 1×10⁴÷1×10², which is what's calculated.

Ctrl+E (and maybe the corresponding button) should generate an e (or small 10) notation.
Comment 11 trondsg 2015-07-23 13:18:20 UTC
Sorry, the last line of the format should start with ScfDecimal, not Decimal. To avoid confusion with a normal decimal number, that would have the format
Decimal ::= [-] Integer . Integer.

The format of a number in this format would be 
ScfNumber ::= ScfDecimal ⏨ [-] Integer
Integer   ::= Digit [Integer]
Digit     ::= 0-9
ScfDecimal   ::= [-] Digit . Integer
Comment 12 Xaky 2016-04-01 16:23:57 UTC
Hi,

I tried this on gnome-calculator version 3.14.1 on debian stable and I also get 0.01 (I used the x*10^y key).

I understand the operation and I know this is the correct result.

I think what we want is that by doing that key, it became like the E in others calculator, meaning the "x*10^y" operation become of higher importance than the multiply or divide operations (and others as well). If that'd be the case, when doing the initial operation "1*10^-1 / 1*10^-1" using that key (x*10^y), we would get the result 1 cause it would calculate "1*10^-1" first then do the division.

So now it's just a question of implementing that.

Hoping it'll be done (I don't think it's a difficult task).

Xaky
Comment 13 GNOME Infrastructure Team 2018-05-22 11:48:25 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/gnome-calculator/issues/26.