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

added shortest format mode to RealFloat that prints the shortest possible string #635

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

BebeSparkelSparkel
Copy link
Contributor

@BebeSparkelSparkel BebeSparkelSparkel commented Dec 28, 2023

dependent on pull #637

Using the logic from the pattern

-- E >= 0 && (P + 2 >= E || (P == 1 && E <= 2))
-- E <  0 && (E >= (-3) || (P == 1 && E >= (-2)))
-- 
-- : P 1, E 2
-- 1
-- 1e0
-- 10
-- 1e1
-- 100
-- 1e2
-- 1000
-- 1e3
-- 
-- : P 2, E 4
-- 12
-- 1.2e2
-- 120
-- 1.2e2
-- 1200
-- 1.2e3
-- 12000
-- 1.2e4
-- 120000
-- 1.2e5
-- 
-- : P 3, E 5
-- 123
-- 1.23e2
-- 1230
-- 1.23e3
-- 12300
-- 1.23e4
-- 123000
-- 1.23e5
-- 1230000
-- 1.23e6
-- 
-- : P 4, E 6
-- 1234
-- 1.234e3
-- 12340
-- 1.234e4
-- 123400
-- 1.234e5
-- 1234000
-- 1.234e6
-- 12340000
-- 1.234e7
-- 
-- : P 5, E 7
-- 12345
-- 1.2345e4
-- 123450
-- 1.2345e5
-- 1234500
-- 1.2345e6
-- 12345000
-- 1.2345e7
-- 123450000
-- 1.2345e8
-- 
-- : P 1, E -2
-- 0.1
-- 1e-1
-- 0.01
-- 1e-2
-- 0.001
-- 1e-3
-- 
-- : P 2, E -3
-- 0.12
-- 1.2e-1
-- 0.012
-- 1.2e-2
-- 0.0012
-- 1.2e-3
-- 0.00012
-- 1.2e-4
-- 
-- : P 3, E -3
-- 0.123
-- 1.23e-1
-- 0.0123
-- 1.23e-2
-- 0.00123
-- 1.23e-3
-- 0.000123
-- 1.23e-4
-- 
-- : P 4, E -3
-- 0.1234
-- 1.234e-1
-- 0.01234
-- 1.234e-2
-- 0.001234
-- 1.234e-3
-- 0.0001234
-- 1.234e-4
-- 
-- : P 5, E -3
-- 0.12345
-- 1.2345e-1
-- 0.012345
-- 1.2345e-2
-- 0.0012345
-- 1.2345e-3
-- 0.00012345
-- 1.2345e-4
-- 
-- : P 2, E
-- 1.2
-- 1.2e0
-- ...
-- 
-- : P 3, E
-- 1.23
-- 1.23e0
-- 12.3
-- 1.23e1

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 this pull request may close these issues.

1 participant