Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

rounding bug?

Hi all:

In a notebook window i tell Sage

w = 0.4 while w > 0.1: w = w - 0.1 print w print w==0

and it outputs

0.300000000000000 0.200000000000000 0.100000000000000 2.77555756156289e-17 False

Is this supposed to happen?

Thanks for your attention. Alex

rounding bug?

Hi all:

In a notebook window i tell Sage

w = 0.4
0.4 
while w > 0.1:
0.1:    
    w = w - 0.1
0.1 
    print w
w 
print w==0

w==0

and it outputs

0.300000000000000

0.3000000000000000
0.200000000000000
0.100000000000000
2.77555756156289e-17
False

False

Is this supposed to happen?

Thanks for your attention. Alex