-
Notifications
You must be signed in to change notification settings - Fork 603
perldata: Add details to hex, etc floats #23988
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
base: blead
Are you sure you want to change the base?
Conversation
| but it must be followed by C<p>, an optional sign, and an exponent. The | ||
| digits in the exponent are interpreted as being base 10 (digits 0-9 are | ||
| accepted), but the actual value is two raised to that power. Thus | ||
|
|
||
| 5e2 == 5 * 10-squared == 500 | ||
| 0x5p2 == 5 * 2-squared == 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
An example with a 2 digit exponent for one of the bitwise bases (hex etc) would better illustrate the base-10-ness of the exponent number vs the base-2-ness of the power.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point; I've added two. The problem is to choose something that can be calculated in one's head. And I think that means only binary, and that is not introduced immediately
I would think that, since no change in behaviour has occurred, perldelta may remain unaltered. I see this PR introduces the example (Ignore, for the moment at least, that there are lots of hex numbers "> 0xffffffff" that are quite portable when IVSIZE is 8.) The latter one-liner produces the correct result, BTW. I think this would need to be documented or fixed. Are negative exponents in (what are otherwise) hex/oct/bin integer expressions to be allowed ? @t-a-k might also have some helpful thoughts on this. |
Somehow my response to this got lost. Perl takes the position that anything above 32 bits is non-portable. That may be an obsolete position, but it is what it is. In indtend to fix the anomalies you pointed out |
Oh - okay. I was thinking it was a warning that shouldn't appear when IVSIZE is 8 but, if that's not the case, then there's no need to take any action. It does seem a bit anomalous that there's no similar warning for decimal integer literals that overflow 32 bits: But I don't mind if that inconsistency remains. |
16b53a2 to
b745378
Compare
This addresses some of the issues in #18664, beyond the additions of 3e18f72.