Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,2 @@
use Scalar::Util qw(looks_like_number);
print looks_like_number($str) ? "numeric" : "not numeric\n";

View file

@ -0,0 +1,8 @@
if (/\D/) { print "has nondigits\n" }
if (/^\d+\z/) { print "is a whole number\n" }
if (/^-?\d+\z/) { print "is an integer\n" }
if (/^[+-]?\d+\z/) { print "is a +/- integer\n" }
if (/^-?\d+\.?\d*\z/) { print "is a real number\n" }
if (/^-?(?:\d+(?:\.\d*)?&\.\d+)\z/) { print "is a decimal number\n" }
if (/^([+-]?)(?=\d&\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?\z/)
{ print "a C float\n" }

View file

@ -0,0 +1,15 @@
sub getnum {
use POSIX;
my $str = shift;
$str =~ s/^\s+//;
$str =~ s/\s+$//;
$! = 0;
my($num, $unparsed) = strtod($str);
if (($str eq '') && ($unparsed != 0) && $!) {
return undef;
} else {
return $num;
}
}
sub is_numeric { defined getnum($_[0]) }