Background

I'm working with some data files that include huge quantities of floating point numbers (GIS shapefiles, containing latitude/longitude/altitude/measurement info). The majority of the time, the numbers I'm working with are small enough for perl to handle with no problem, but occasionally (especially with measurements) I get data that gets me into trouble unless I use Math::BigFloat.


Problem

Unfortunately, due to the sheer volume of numbers being manipulated, using BigFloat for all of them has too large a performance impact (turning the run time from around 6 hours to as much as 10 days), so I'd prefer not to use BigFloat when it isn't necessary. The bright part of this is that the file headers indicate the range of numbers included in each measure, so I don't have to check the whole file, I just have to look at the header and determine if any measure has a minimum/maximum value that indicates that I should use BigFloat for that value.


Question

The problem I'm running into is that I can't figure out how I can examine a number and determine if it's going to be big enough to require BigFloat. So can anybody suggest a method for determining "how big is big?"?


In reply to Determining when Math::BigFloat is necessary? by jasonk

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.