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

Remove leading zeros from base-10 numbers #614

Closed
wants to merge 3 commits into from
Closed

Remove leading zeros from base-10 numbers #614

wants to merge 3 commits into from

Conversation

mborland
Copy link
Member

Currently we assume that anything with a leading 0 is in octal format. Change to where octal has to be 0 followed by a non-zero number. If the format does not meet that requirement for octal than remove any and all leading zeros.

Closes: #612

@ckormanyos
Copy link
Member

Change to where octal has to be 0 followed by a non-zero number.

Ah now I get it.

@mborland
Copy link
Member Author

@jzmaddock Any issue with this change? It would technically be a breaking change, but I think the new behavior is less surprising.

@jzmaddock
Copy link
Collaborator

Any issue with this change? It would technically be a breaking change, but I think the new behavior is less surprising.

I do worry about this, consider a block of formatted numbers:

0001
0002
0003
...
0099
0100

We start off as decimal, and then there is a step change to octal when we get to "0100" which seems even worse to me?

@mborland
Copy link
Member Author

Godbolt says leading zeros is still octal: https://godbolt.org/z/7Kcahjh67. Since the original ticket is closed I'll just close this too.

@mborland mborland closed this Apr 16, 2024
@ckormanyos
Copy link
Member

ckormanyos commented Apr 16, 2024

start off as decimal, and then there is a step change to octal

Oh geez I actually had that one last century. It took 3 days to resolve. But now that I reflecrt (which I had entirely forgotten) so is the spec.

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.

boost::multiprecision::cpp_int leading zeros parsing bug
4 participants