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"


s//----->\t/;$~="JAPH";s//\r<$~~/;{s|~$~-|-~$~|||s |-$~~|$~~-|||s,<$~~,<~$~,,s,~$~>,$~~>,, $|=1,select$,,$,,$,,1e-1;print;redo}

In reply to Re: Infinity and platforms by starbolin
in thread Infinity and platforms by andreas1234567

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.