-
Notifications
You must be signed in to change notification settings - Fork 577
[doc] perlnumber: "minus plus number" looks like number #18584
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
Comments
Everything behaves like a number in numeric context. As you can see from the warnings, they don't "look" like numbers. If you're suggesting it's a bug that only the last one gets truncated to 0 in numeric context, perhaps. |
Behaviour changed between 5.29.1 and 5.29.2, but I don't see anything relevant in the perldeltas. (Bisection within this range will likely give an answer though.)
|
Perhaps this is it (found in perl5300delta):
|
This seems to be because perl's string-to-number conversion function ( I found an another symptom where a hexadecimal notation is sometimes (unexpectedly) recognized:
|
Just to point out that it was stated in #17062 that hexadecimal strings should numify to zero ... so I guess this erroneous handling of |
…mber Perl_my_atof3 used to pass a substring after the first (optional) sign to (S_)strtod, which causes wrong numifications for strings like "-+3" or "+ 0x123" (for the latter case, while Perl_my_atof3 already had the code to block "0x" prefixes, this string will slip through due to the space character in it). For GH Perl#18584.
…mber Perl_my_atof3 used to pass a substring after the first (optional) sign to (S_)strtod, which causes wrong numifications for strings like "-+3" or "+ 0x123" (for the latter case, while Perl_my_atof3 already had the code to block "0x" prefixes, this string will slip through due to the space character in it). For GH #18584.
Where
https://perldoc.perl.org/perlnumber
Description
Quoted "minus plus number" behaves like negative number in numeric context.
Seems undocumented. Usually numbers start with either
+
or-
or none.(perl v5.32.0)
OUTPUT:
The text was updated successfully, but these errors were encountered: