Checking the return values against every possible permutation is not the way to write portable code. The proper procedure is to compare the return value against the system's own definition of Infinity. In C we'd compare the return value against the appropriate constant in float.h. Under ISO C99 we call isint() to do the check transparently. Perl being an interpreter we can ask Perl what it thinks the value is:
#!/usr/bin/perl -w use Math::BigFloat; my $inf = Math::BigFloat->binf(); # $inf contains: "inf" print $inf,"\n";
Though if you use any of the Math modules in the core distribution you can import transparent checks for infinity and if you divide by zero in vanilla perl you get an exception. I guess I'm not sure what problem you are trying to solve.
UPDATE: I said "they contain transparent". Changed it to "you can import"
In reply to Re: Infinity and platforms
by starbolin
in thread Infinity and platforms
by andreas1234567
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |