Randal L. Schwartz wrote
: For integers, you can narrow it down:
:
: sub is_integer {
: my $bad = 0;
: local $SIG{__WARN__} = sub { $bad++ };
: local $^W = 1;
: my $guess = shift;
: return $guess == int($guess) and not $bad;
: }
oops, precedence:
return $guess == int($guess) && not $bad;
Otherwise everything's an integer.
-- tdk
- Re: test for real number Randal L. Schwartz
- Re: test for real number Paul
- Re: test for real number Piers Cawley
- advanced: closures (was Re: test for r... Jeff Pinyan
- Re: advanced: closures (was Re: t... Randal L. Schwartz
- Re: advanced: closures (was R... Randal L. Schwartz
- Re: advanced: closures (was R... Jeff Pinyan
- Re: advanced: closures (was R... Randal L. Schwartz
- Re: advanced: closures (was R... Peter Scott
- Re: test for real number Timothy Kimball
- Re: test for real number Randal L. Schwartz
- Re: test for real number Paul
