String to Float, without introducing errors

dn PythonList at DancesWithMice.info
Sun Dec 18 16:45:34 EST 2022


On 18/12/2022 10.55, Stefan Ram wrote:
> Grant Edwards <grant.b.edwards at gmail.com> writes:
>> Yes, fixed point (or decimal) is a better fit for what he's doing. but
>> I suspect that floating point would be a better fit for the problem
>> he's trying to solve.
> 
>    I'd like to predict that within the next ten posts in this
>    thread someone will mention "What Every Computer Scientist
>    Should Know About Floating-Point Arithmetic".


Thank you for doing-so.

More specific: https://docs.python.org/3/tutorial/floatingpoint.html


Perhaps in the rush to 'answer', the joke is on 'us' - that we might 
first need to more carefully-understand the OP's use-case, requirements, 
and constraints?


The joke sours when remembering that this 'mystery' generates frequent 
questions 'here' (and on other Python fora) - not as many as 'why don't 
I see a pretty-GUI when I fire-up Python on MS-Windows?' but it is a 
more sophisticated realisation and deserves a detailed response (such as 
the thought-provoking illustration-code appearing today).


Is it a consequence of Python lowering 'the barrier to entry'? Good 
thing? Bad thing?

(we first started noticing this sort of issue in our (non-Python) MOOCs, 
several pre-COVID years ago: when we first started, the trainee was 
typically recent post-grad; whereas today we enrol folk with a much 
wider range of ages and backgrounds. It is likely that more dev.work has 
gone into 'the bottom end', than into new/higher sophistications - even 
given IT's rate-of-change!)

-- 
-- 
Regards,
=dn


More information about the Python-list mailing list