Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in percentage calculation #222

Open
EnriquePG-Noc opened this issue Feb 2, 2022 · 5 comments · May be fixed by #268
Open

Error in percentage calculation #222

EnriquePG-Noc opened this issue Feb 2, 2022 · 5 comments · May be fixed by #268

Comments

@EnriquePG-Noc
Copy link

What Happened?

When performing an addition or subtraction operation with percentages, the program ignores that it is a percentage.
For example:
100 + 2% = 100.02 (the correct would be 102).
100 - 2% = 99.98 (correct would be 98)

This happens with any number you type.

Steps to Reproduce

  1. I opened the calculator from "Applications".
  2. I typed the numbers from the keyboard, including the symbols.
  3. I get the wrong result.
  4. I enter the values and symbols from the calculator program itself.
  5. I persist with the error.

Expected Behavior

Basically because it is expected to operate with percentages, but what it seems to perform is a decimal operation.

OS Version

6.x (Odin)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

@jeremypw
Copy link
Collaborator

jeremypw commented Feb 3, 2022

There was a PR (#137) suggesting a way of dealing with this but it did not get any traction at the time.

@Dragonfir3
Copy link

Without this function it's completely useless for me, Elementary you can remove it from the OS, I have to use another one.

@jeremypw
Copy link
Collaborator

Duplicate of #44. This is an old issue for which no universally acceptable solution was found due to the ambiguity of the % operator (which the project leaders would prefer to be ignored altogether).

@jeremypw
Copy link
Collaborator

jeremypw commented Oct 26, 2023

Looked at how Google handles this - essentially it does not interpret % as the mod operator. If you enter a % b then it interpolates x to give a% x b. If you enter a + b + c% it gives a + c% x b. It should be possible to emulate this behaviour. Calculator does not seem to implement mod anyway.

Correction, Calculator recognises mod as the modulo operator (but not %%)

@jeremypw jeremypw linked a pull request Nov 30, 2023 that will close this issue
5 tasks
@jeremypw
Copy link
Collaborator

jeremypw commented Dec 3, 2023

@EnriquePG-Noc, @Dragonfir3 I have pushed a PR to address this - #268. If you are able to build and test this I would welcome your comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants