Perldoc: integers *stored* as... ???

S

Sal

In the online Perl 5 version 12.1 documentation at:
http://perldoc.perl.org/perlnumber.html#Storing-numbers

Under the heading of Storing Numbers it reads "In fact numbers stored
in the native integer format may be stored either in the signed native
form, or in the unsigned native form."

Integers are *stored* as bits in a word, dword, or qword, it's how
they're interpreted that matters.

#!/usr/bin/perl
use strict;
use warnings;
my $x = 0xffff_ffff;
print $x, "\n";
printf("%d\n", $x);

On a 32-bit machine outputs:
4294967295
-1
 
I

Ilya Zakharevich

In the online Perl 5 version 12.1 documentation at:
http://perldoc.perl.org/perlnumber.html#Storing-numbers

Under the heading of Storing Numbers it reads "In fact numbers stored
in the native integer format may be stored either in the signed native
form, or in the unsigned native form."

Integers are *stored* as bits in a word, dword, or qword,

Wrong. Integers are not stored as bits. They are stored as parts of
SVIV, SVUV, SVNVIV, SVPVIV, SVwhatever else structures.

So your remark makes yet less sense than the sentence in the docs
(which indeed, would benefit from some edits).

Yours,
Ilya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,682
Members
48,796
Latest member
Greg L.

Latest Threads

Top