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

BUG: Calculator can't multiply numbers with more than 19 digits #2673

Open
2 tasks done
SIVAH-AKASH opened this issue Apr 25, 2024 · 5 comments
Open
2 tasks done

BUG: Calculator can't multiply numbers with more than 19 digits #2673

SIVAH-AKASH opened this issue Apr 25, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@SIVAH-AKASH
Copy link

Checks

  • I have checked that this issue has not already been reported.

  • I am using the latest version of Flow Launcher.

Problem Description

Calculator is providing wrong result if one of the two numbers being multiplied is more than 19 digits. Examples:

  1. 1.2*0.83333333333333333333
  2. 2453*23534245034253633353
  3. 1*0.22222222222222222222
  4. 1*24353532424240053022
  5. 1*1111111111111111111111
  6. 1324*30000000000000000000

It's easiest to see this issue in action if you copy and paste the above examples and then remove just the last digit. We will notice a large change in the result.

But there are some instances where this doesn't happen. I am unable to determine the logic behind when this issue occurs and when it does not. Examples:

  1. 1*0.11111111111111111111
  2. 1324*10000000000000000000
  3. 1324*40000000000000000000

To Reproduce

No response

Screenshots

No response

Flow Launcher Version

1.18.0

Windows Build Number

10.0.22631.3447

Error Log

No response

@SIVAH-AKASH SIVAH-AKASH added the bug Something isn't working label Apr 25, 2024
@SIVAH-AKASH
Copy link
Author

Update: This issue occurs even when directly typing the >19 digit number. Try typing "30000000000000000000" vs "40000000000000000000".

@Dev123456689
Copy link

Just a user of Flow Launcher: Sure it is a bug but why would you do such calculations.
30000000000000000000*40000000000000000000

@SIVAH-AKASH
Copy link
Author

Just a user of Flow Launcher: Sure it is a bug but why would you do such calculations. 30000000000000000000*40000000000000000000

That was just one example. And this unlikely calculation might be an indication of a larger issue (possibly affecting even calculations that are more common, including one I shared above).

Hopefully that clarifies it, but also to answer to your question, I do tend to perform these calculations for various reasons, so I would also welcome support for scientific calculations to Flow Launcher. But that's to be raised in a different place.

@deefrawley
Copy link
Member

I'm not a core dev but my guess this is because the calc app is using 32 bit integer types which simply can't store large numbers. So either a larger bit integer data type is used or some sort of warning or error trap to let the user know.

In fact fumbling through the code here on Github, it could be the Math.Round function which seems to cast integers to 32 bit.

@Dev123456689
Copy link

Dev123456689 commented May 16, 2024

@deefrawley Just a user of Flow Launcher: I think Flow Launcher calculator is using 64 bit int and as per google 64 bit int can store numbers from -9,223,372,036,854,775,807 to 9,223,372,036,854,775,807. So any number greater than 9,223,372,036,854,775,807 and smaller than -9,223,372,036,854,775,807 can cause the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants