Mark Dickinson added the comment:
can you add an approximation of the result in the command?
I don't really understand what you're asking here.
If you're asking for the behaviour of multiplication to change so that it
becomes more do-what-I-mean-ish, that's not going to happen. You could
Tim Peters added the comment:
@Liam, try using the decimal module instead. That follows rules much like
the ones people learn as kids.
from decimal import Decimal as D
D(0.1) * 3 # decimal results are computed exactly
Decimal('0.3')
D(1.01) - D(.01) # number of significant digits is
New submission from Liam Marsh:
when does 3*0.1 make 0.30004 ?
YES it is the same program!
--
components: Regular Expressions
messages: 207092
nosy: Liam.Marsh, ezio.melotti, mrabarnett
priority: normal
severity: normal
status: open
title: what is that result!?
versions:
Mark Dickinson added the comment:
This is how binary floating-point arithmetic works. See
http://docs.python.org/3/tutorial/floatingpoint.html
for some explanations.
--
nosy: +mark.dickinson
resolution: - invalid
status: open - closed
___
Python
Changes by Mark Dickinson dicki...@gmail.com:
--
components: +Interpreter Core -Regular Expressions
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue20095
___
Liam Marsh added the comment:
can you add an approximation of the result in the command?
(ex: the biggest precision in the values is 0.1, so it won't show after 4.0)
meen while, thank you.
--
___
Python tracker rep...@bugs.python.org