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

Adaptive number of significant digits #54

Closed
sharkdp opened this issue Mar 23, 2017 · 11 comments
Closed

Adaptive number of significant digits #54

sharkdp opened this issue Mar 23, 2017 · 11 comments

Comments

@sharkdp
Copy link
Owner

sharkdp commented Mar 23, 2017

Adaptively increase the number of significant digits if the user input seems to require it:

> 3e6 + 0.1
3000000

Also, the different handling of integers and floating point numbers seems strange right now:

> 3e7 + 1
30000001
> 3e7 + 1.1
30000000
@sharkdp sharkdp added the idea label Mar 23, 2017
@tianshuo
Copy link

Also, 0.1428571*7=1 Doesn't seem like a high precision calculator

@lampo808
Copy link

And also having the possibility to change the number of significant digits during a session could be a very useful feature (it is for me...)!

@ad-si
Copy link

ad-si commented Jul 12, 2018

@sharkdp Stupid question: Why shouldn't Insect output all digits. Then the user can decide how many digits he wants to use ^^

@ad-si
Copy link

ad-si commented Jul 12, 2018

Also: I guess many people would like to use insect as a replacement for calc, so maybe insect should output similar solutions. E.g. calc easily handles things like calc '3e1000 + 0.1'

@pierstitus
Copy link

I agree the current behaviour is very confusing. There's even a difference between big and small integers:

> 111111111111111111

  111111111111111111

   = 111111111111111111
> 1111111111111111111

  1111111111111111111

   = 1111110000000000000

I think a more usable default would be to display six (or even eight) digits after the dot. It can be still made configurable later on.

Otherwise at least use scientific notation when showing numbers bigger than 1e6 (now it does from 1e20 on, which seems a reasonable default).

@ad-si note that calc is an arbitrary precision calculator, while insect is just high precision.

@sharkdp
Copy link
Owner Author

sharkdp commented Nov 2, 2020

I agree the current behaviour is very confusing

Yes. This ticket describes my personal top-prio issue with Insect.

I think a more usable default would be to display six (or even eight) digits after the dot. It can be still made configurable later on.

We could try this. I don't really like the fact that we would display far too many digits for most computations though.

@NicoLugil
Copy link

I just want to confirm how important it is for some application to display >6 digits. Is there a way around it for now? I want to do 123456789/33 but need at least 15 significant digits.

@triallax
Copy link
Contributor

@sharkdp I think this could be nice to implement in v5.9.0, but the major initial hurdle would be how to add it cleanly to purescript-decimals's API. Do you have any ideas how we could do that?

@sharkdp
Copy link
Owner Author

sharkdp commented Feb 11, 2023

Do you have any ideas how we could do that?

I have not thought about it in detail, but I'm quite sure it's a highly nontrivial thing to do.

@sharkdp sharkdp closed this as completed Feb 11, 2023
@sharkdp sharkdp reopened this Feb 11, 2023
@triallax
Copy link
Contributor

@sharkdp alright then, let's leave it for later (or never?) then.

@sharkdp
Copy link
Owner Author

sharkdp commented Sep 26, 2023

Follow-up ticket for Numbat: sharkdp/numbat#179

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

No branches or pull requests

7 participants