String to Float, without introducing errors

Cameron Simpson cs at cskk.id.au
Sun Dec 18 19:41:13 EST 2022


On 19Dec2022 08:53, Cameron Simpson <cs at cskk.id.au> wrote:
>I'm no expert on floating point coding for precision, but I believe 
>that trying to work with values "close together" in magnitude is 
>important because values of different scales inherently convert one of 
>them to the other scale (i.e. similar sized exponent part) with 
>corresponding loss of precision in the mantissa part. That may require 
>you to form your calcutations carefully.

This depends on the operation. With addition/subtraction you'd see this 
directly. With multiplication etc it isn't really the case. But there 
are both more and less effective ways to arrange your floating point 
math in terms of preserving what precision you have.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list