And then we learned in class what happens when you're calculating "0.1" with
different precision in the industry.
http://www.ima.umn.edu/~arnold/disasters/patriot.html
Beware.
On Tue, Sep 6, 2011 at 3:14 AM, Thomas Rachel <
nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de> wrot
On 9/7/2011 12:51 AM, Steven D'Aprano wrote:
So given a float x, when you square it you get this:
Exact values: a*a = a**2
Float values: x*x = (a+e)(a+e)
= a**2 + 2*a*e + e**2
So the error term has increased from e to (2*a*e+e**2). It is usual to
assume that e**2 is small e
On 09/07/2011 06:51 AM, Steven D'Aprano wrote:
11258999068426240
>
> Error in float 1.1*1.1:
>
b = F(11, 10)**2
y = F.from_float(1.1**2)
f = y - b
print f
> 21/112589990684262400
>
> which is slightly more than double e above, and slightly less than our
> estimate of 2*a*e =
On Wed, 7 Sep 2011 02:07 am Thomas 'PointedEars' Lahn wrote:
> Thomas Rachel wrote:
>
>> Now if you multiply two values with an error, the error also propagates
>> into the result - PLUs the result can have its own error source - in the
>> same order of magnitude.
>>
>> (a+e) * (a+e) = a*a + 2*a
Thomas Rachel wrote:
> Now if you multiply two values with an error, the error also propagates
> into the result - PLUs the result can have its own error source - in the
> same order of magnitude.
>
> (a+e) * (a+e) = a*a + 2*a*e + e*e. So your new error term is 2*a*e + e*e
> or (2*a + e) * e.
Yo
Am 06.09.2011 07:57 schrieb xyz:
hi all:
As we know , 1.1 * 1.1 is 1.21 .
But in python ,I got following :
1.1 * 1.1
1.2102
why python get wrong result? Who can tell me where's the 0.0002
from?
1.1 does not fit in a binary floating point number. It is approximate
Gary Herron wrote:
> (But try:
>print 1.1*1.1
> and see that the print statement does hide the roundoff error from you.)
That varies according to the version of Python you are using. On my system:
Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)]
on win32
Type "help
On Tue, 6 Sep 2011 03:57 pm xyz wrote:
> hi all:
>
> As we know , 1.1 * 1.1 is 1.21 .
> But in python ,I got following :
>
1.1 * 1.1
> 1.2102
The problem is that 1.1 is a *decimal* number, but computers use *binary*,
and it is impossible to express 1.1 exactly as a binary num
On 09/05/2011 10:57 PM, xyz wrote:
hi all:
As we know , 1.1 * 1.1 is 1.21 .
But in python ,I got following :
1.1 * 1.1
1.2102
why python get wrong result? Who can tell me where's the 0.0002
from?
It's not a python errorIt's the nature of floating point arithm
On Mon, Sep 5, 2011 at 10:57 PM, xyz wrote:
> hi all:
>
> As we know , 1.1 * 1.1 is 1.21 .
> But in python ,I got following :
>
1.1 * 1.1
> 1.2102
>
> why python get wrong result?
It's not Python's fault per se, rather it's the inherent nature of
binary floating-point arithmetic
hi all:
As we know , 1.1 * 1.1 is 1.21 .
But in python ,I got following :
>>> 1.1 * 1.1
1.2102
why python get wrong result? Who can tell me where's the 0.0002
from?
--
http://mail.python.org/mailman/listinfo/python-list
11 matches
Mail list logo