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

Are hexadecimal / octal / binary integers allowed in floats? #560

Closed
percontation opened this issue Sep 20, 2018 · 2 comments
Closed

Are hexadecimal / octal / binary integers allowed in floats? #560

percontation opened this issue Sep 20, 2018 · 2 comments

Comments

@percontation
Copy link

From the doc:

A float consists of an integer part (which follows the same rules as integer values) followed by a fractional part and/or an exponent part.

This seems to imply that something like 0x56.78 is a valid float, equal to 86.78. This is unusual enough that it should be explicitly documented if this is intended (and if it isn't, then the documentation should be updated to not seem to say that).

(FWIW, in my opinion this should be explicitly disallowed, because inventing a new mixed-radix format that conflicts with the standard hex-float format seems bad.)

@lmna
Copy link

lmna commented Sep 20, 2018

Are hexadecimal / octal / binary integers allowed in floats?

From toml.abnf:

float = float-int-part ( exp / frac [ exp ] )
float-int-part = dec-int

Thus only decimal integers are allowed in floats.

@percontation
Copy link
Author

Cool. I believe the text should be updated accordingly then.

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

3 participants