Thought 1: 1e+101 is pretty big! Do you *need* all your calcs to carry such a big exponent? For example, can you run all the calcs on values that have been scaled by 1e-100, then at the end of all the calcs scale back by 1e+100?
Thought 2: If you just need to compare for approximate equality, you could divide the difference by the larger of the two values being subtracted. If you subtract two virtually equal 1e+101 values, you may get a difference in the order of 1e+85. The division will give you a ratio of ~1e-16. Ratios in that realm will mean that the two original values are about as nearly equal as the floating point representation can express. This type of method scales pretty well to work with both very small and very large floating point numbers.
Thought 3: If the inputs to your calcs are in the order of 1e+85 or less, you may really have your work cut out for you. You'll need to think carefully about floating point representation error at each step of the calculations to know where you can round, truncate, approximate, etc. There may be places where rounding will be *necessary* and other places where it is *disastrous*.
To summarize: you need to apply some of your error knowledge to your code. The 1e+101 calculated values probably don't have more than 6-8 *significant* digits of accuracy, right? (Most numbers come from some kind of measurement, or a rounded-off value for a scientific constant, etc.) You'll need to analyze your values and calcs to understand about how many digits of the 1e+101 numbers are truly *significant*. Then your code will need to treat values which differ by less than that amount as if they are truly equal.
-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.