String to Float, without introducing errors

Michael F. Stemper michael.stemper at gmail.com
Mon Dec 19 12:29:24 EST 2022


On 19/12/2022 09.14, MRAB wrote:
> On 2022-12-19 14:10, Peter J. Holzer wrote:
>> On 2022-12-19 09:25:17 +1100, Chris Angelico wrote:
>>> On Mon, 19 Dec 2022 at 07:57, Stefan Ram <ram at zedat.fu-berlin.de> wrote:
>>> > G = Decimal( 6.6743015E-11 )
>>> > r = Decimal( 6.371E6 )
>>> > M = Decimal( 5.9722E24 )
>>>
>>> What's the point of using Decimal if you start with nothing more than
>>> float accuracy?
>>
>> Right. He also interpreted the notation "6.67430(15)E-11" wrong. The
>> digits in parentheses represent the uncertainty in the same number of
>> last digits. So "6.67430(15)E-11" means "something between 6.67430E-11 -
>> 0.00015E-11 and 6.67430E-11 + 0.00015E-11". The r value has only a
>> precision of 1 km and I'm not sure how accurate the mass is. Let's just
>> assume (for the sake of the argument) that these are actually accurate in
>> all given digits.

ntal misunderstanding of the numbers they are working with.
>>
> To be fair, I don't think I've never seen that notation either! I've only ever seen the form 6.67430E-11 ± 0.00015E-11, which is much clearer.

See, for instance:
<https://www.physics.nist.gov/cgi-bin/cuu/Value?bg>
In particular, the "concise form".

For more detail, see:
<https://en.wikipedia.org/wiki/Uncertainty#Measurements>

-- 
Michael F. Stemper
Isaiah 58:6-7


More information about the Python-list mailing list