TauZero OP ,

Your skepticism is excessively cautious 😁. You can work around precision limits perfectly fine as long as you are aware they exist there. Multiplying your epsilon and then dividing later is a legitimate strategy, since every function is linear on a small enough scale! You can even declare that ln(1+x) ~= x and skip the logarithm calculation entirely. Using some random full precision calculator I get:


<span style="color:#323232;">ln((74e15+6.7)/74e15) = 0.000000000000000090540540...
</span>

Compare to the double-precision calculator with workaround:


<span style="color:#323232;">ln((74e15 + 6.7*10e9)/74e15) / 10e9 = 9.0540499...e-17
</span>

Or even:


<span style="color:#323232;">ln(1+x) ~= x
</span><span style="color:#323232;">6.7/74e15 = 9.0540540...e-17
</span>

You are worried about differences in the final answer of less than 1 part in a million! I try to do my example calculations in 3 significant figures, so that’s not even a blip in the intermediate roundoffs.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • random
  • [email protected]
  • All magazines