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

More control over display mode / number format #219

Open
joshop opened this issue Nov 1, 2023 · 5 comments
Open

More control over display mode / number format #219

joshop opened this issue Nov 1, 2023 · 5 comments
Labels

Comments

@joshop
Copy link

joshop commented Nov 1, 2023

Hi! I was a huge fan of insect and glad that it's getting even more features, but one thing that I always found missing was a good way to control more specifically how numbers are printed. It's possible I'm missing a builtin function or operator for this in numbat, but both of these feel unhelpful:

>>> 1e14 m

  100000000000000 meter

    = 100000000000000 m    [Length]

>>> 1e-6 m

  0.000001 meter

    = 0.000001 m    [Length]

It would be nice to be able to specify that I want to see 1e14 m or 1e-6 m in this case, or maybe even specify a precision level or a fixed exponent. If you have many quantities in the range 1e-8 m, for instance, you might want to print 1e-9 m as 0.1e-8 m, so it's visually easier to compare. I think the default behavior would stay the same.

@sharkdp
Copy link
Owner

sharkdp commented Nov 2, 2023

Thank you for the feedback.

Have you seen #152 (and #179)? I think this feature request is at least related. And it seems like you are asking for this to be (interactively) configurable?

Maybe we could close this and add a comment to #152? What do you think?

@joshop
Copy link
Author

joshop commented Nov 2, 2023

That would make sense. I was envisioning an interactive-mode command that can switch from the current default, always using scientific notation (optionally with a certain fixed exponent), or never using scientific notation.

@sharkdp
Copy link
Owner

sharkdp commented Feb 13, 2024

Another display mode that was suggested here (#346) would be engineering notation

@P1n3appl3
Copy link
Contributor

qalculate does something similar to engineering notation, but it uses the SI prefix for the unit instead of writing out the scientific notation which I find generally more useful, for example:

> 0.0000000003F

  0.0000000003 farad = 300 pF

I'd love it if I could set a config option to always "normalize" output like that in numbat, maybe falling back to engineering notation for unit-less calculations. This might be a stretch but doing the same thing for often-mixed units would also be really helpful:

> 4k seconds

  (4 × 1000) seconds = 1 h + 6 min + 40 s

> 1234oz

  1234 ounces = 77 lb + 2 oz

It's possible what I'm looking for is a -> human for all units that I can choose to implicitly apply by default, or setting a default "unit list" (#364) for certain input units.

@sharkdp sharkdp changed the title More control over display mode More control over display mode / number format Oct 8, 2024
@signalno11
Copy link

-> human would be a great friendly implementation, but I think it should be more of a macro. For example, -> sci could convert to scientific, -> eng could convert to engineering, and -> si could convert to engineering notation converted to SI prefixes when possible. The user could define in a configuration file when they want which to be used when they ask for -> human

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

No branches or pull requests

4 participants