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
"use integer" behaving oddly for large unsigned values #14515
Comments
From @sisyphusHi, On all recent perls that I've tried ,including blead, 5.18.0 and 5.20.0, on $ perl -Minteger -le '$x = 10_000_000_000_000_000_011; print $x; print $x / The actual perl configuration doesn't seem to matter except that ivsize has Similarly, if ivsize is 4, and the numerator is greater than 2 ** 31 I get C:\>perl -Minteger -le "$x = 3147483661; print $x; print $x / 10;" I can't see anything in the integer documentation that explains this. Cheers, |
From @hvdsOn Mon Feb 16 19:11:30 2015, sisyphus wrote:
I think the relevant bit is this part in the second para of the description: [...] In addition, the range of operands and results is I believe an initially assigned constant is treated as a float (by parts of perl that the integer module can't reach) until you use it numerically. So here's where it first wraps to negative for 64-bit ints: % perl -wle 'for (9223372036854775807, 9223372036854775808) { my $x = $_; printf "%s = %#x\n", $x, $x; use integer; print $x; $x += 0; print $x }' Hugo |
The RT System itself - Status changed from 'new' to 'open' |
From @ikegamibigint says " Integer constants are created as proper BigInts." To me, that $ perl -Minteger -le '$x = 10_000_000_000_000_000_011; print $x; print $x / $ perl -MMath::BigInt -le '$x = So I agree with Sisyphus. Something isn't right. |
From @hvdsOn Mon Feb 16 20:48:24 2015, ikegami@adaelis.com wrote:
I'm confused: 'bigint' ne 'integer', so I'm not sure of the relevance of this comment. The 'integer' module has nothing to do with bigints. Hugo |
From @tonycozOn Mon Feb 16 20:48:24 2015, ikegami@adaelis.com wrote:
bigint has a bigger range than the documented range of "-(2**63) .. (2**63-1) on 64-bit architectures". There are examples in perldoc integer documenting the wrapping behaviour. What behaviour do you expect given the documentation? Tony |
From @sisyphus-----Original Message-----
I think I expected such a significant and crippling limitation to be spelled So ... if you're wanting to do integer arithmetic on perl UV's that might be Anyway - feel free to close this report. (I won't be using the integer Cheers, |
From @tonycozOn Tue Feb 17 01:35:44 2015, sisyphus wrote:
Ok, closing. Tony |
@tonycoz - Status changed from 'open' to 'rejected' |
From @ikegamiOn Tue, Feb 17, 2015 at 12:18 AM, Hugo van der Sanden via RT <
No, I'm the confused one. Ignore my message. |
Migrated from rt.perl.org#123851 (status was 'rejected')
Searchable as RT123851$
The text was updated successfully, but these errors were encountered: