Skip to main content
4 events
when toggle format what by license comment
Sep 30 at 10:26 comment added DrJay Python uses double-precision floating-point numbers (based on the IEEE 754 standard) so, rather than use the above simplistic example, try (part) def computation(f): large_value = 1e+16 small_value = 1e-10 f += small_value f -= large_value # Subtract a large value f += large_value # Add back the large value return f f = 1. There are plenty of examples of floating-point errors, which is why it is still taught. Being aware of the pitfalls helps look for ways to prevent errors.
Sep 29 at 20:59 comment added gnasher729 You say “drifting occurs”. Does it really?
Sep 28 at 12:26 comment added emonigma Thank you! I ran the code with 40 digits of precision and do not find a divergence nor a discrepancy.
Sep 27 at 10:45 history answered DrJay CC BY-SA 4.0