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

Implement some best-unit formatter for output numbers #302

Open
grzanka opened this issue Apr 13, 2019 · 1 comment
Open

Implement some best-unit formatter for output numbers #302

grzanka opened this issue Apr 13, 2019 · 1 comment

Comments

@grzanka
Copy link
Contributor

grzanka commented Apr 13, 2019

For some calculators output number can be very small or very large. Therefore fixing manually constant precision is not the best solution.

There are some libraries which provide best-unit calculations, i.e.:
https://www.npmjs.com/package/convert-units

The idea is to have a function which for 2e-9 (meters) returns "2 nm" and for 3200 (meters) returns "3.2 km".

More advanced implementation (but C++) can be found here: http://www.apc.univ-paris7.fr/~franco/g4doxy/html/G4UnitsTable_8cc-source.html

@grzanka
Copy link
Contributor Author

grzanka commented Apr 13, 2019

See i.e. #283

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

No branches or pull requests

1 participant