#!./perl
-print "1..35\n";
+print "1..36\n";
print +(oct('0b10101') == 0b10101) ? "ok" : "not ok", " 1\n";
print +(oct('0b10101') == 025) ? "ok" : "not ok", " 2\n";
"ok" : "not ok", " 34\n";
print +(oct('0xffffffff') == 4294967295) ?
"ok" : "not ok", " 35\n";
+
+print +(hex('0xffffffff') == 4294967295) ?
+ "ok" : "not ok", " 36\n";
static char *maxima[5] = { "",
"0b11111111111111111111111111111111",
"",
- "0b37777777777",
+ "037777777777",
"0xffffffff" };
char *base, *Base, *max;
/* read the rest of the number */
for (;;) {
/* x is used in the overflow test,
- b is the digit we're adding on */
+ b is the digit we're adding on. */
UV x, b;
switch (*s) {
sv = NEWSV(92,0);
if (overflowed) {
dTHR;
- if (ckWARN(WARN_UNSAFE) && (NV) n > 4294967295.0)
+ if (ckWARN(WARN_UNSAFE) && n > 4294967295.0)
Perl_warner(aTHX_ WARN_UNSAFE,
"%s number > %s non-portable",
Base, max);
}
if (!overflowed)
rnv = (NV) ruv;
- if (rnv > 4294967295.0) {
+ if ( ( overflowed && rnv > 4294967295.0)
+#if UV_SIZEOF > 4
+ || (!overflowed && ruv > 0xffffffff )
+#endif
+ ) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,
}
}
if (!overflowed) {
- register xuv = ruv << 3;
+ register UV xuv = ruv << 3;
if ((xuv >> 3) != ruv) {
dTHR;
}
if (!overflowed)
rnv = (NV) ruv;
- if (rnv > 4294967295.0) {
+ if ( ( overflowed && rnv > 4294967295.0)
+#if UV_SIZEOF > 4
+ || (!overflowed && ruv > 0xffffffff )
+#endif
+ ) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,
}
if (!overflowed)
rnv = (NV) ruv;
- if (rnv > 4294967295.0) {
+ if ( ( overflowed && rnv > 4294967295.0)
+#if UV_SIZEOF > 4
+ || (!overflowed && ruv > 0xffffffff )
+#endif
+ ) {
dTHR;
if (ckWARN(WARN_UNSAFE))
Perl_warner(aTHX_ WARN_UNSAFE,