You can specify literal hexadecimal floating-point numbers in v5.22, just as you can in C99, Java, Ruby, and other languages do. Perl, which uses doubles to store floating-point numbers, can represent a limited set of values. Up to now, you’ve had to specify those floating point numbers in decimal, hoping that a double could exactly represent that number. That hope, sometimes unfounded, is the basis for the common newbie question about floating point errors. Continue reading “Perl v5.22 adds hexadecimal floating point literals”
Category: numbers
Perl 5.20 uses its own random number generator
Prior to v5.20, perl
used whatever random number generator the system provided. This meant that the same program could have statistically different results based on the quality of that function. The rand()
for Windows had a max of 32,768 (15 bits), while POSIX has drand48
(48 bits). This sort of numerical un-portability has always been a problem with perl
since it’s relied on the underlying libc for so much. Continue reading “Perl 5.20 uses its own random number generator”
Use rational numbers for arbitrary precision
This Item was suggested by Shawn Corey as part of our Free eBook give-away. He’s our September winner! Continue reading “Use rational numbers for arbitrary precision”