Hi guys - I recall this came up a few months ago, but I’m curious about the 
difference of Pharo’s use of Float64 vs Python - as I assumed that if languages 
use the same IEEE spec (or whatever spec it is) that simple stuff would be 
quite similar.

I am curious why in Python adding these numbers:

y = 987.9504418944 + 815.2627636718801 + 1099.3898999037601 + 
1021.6996069333198 + 1019.8750146478401 + 1084.5603759764 + 1008.2985131833999 
+ 1194.9564575200002 + 893.9680444336799 + 1032.85460449136 + 905.9324633786798 
+ 1024.2805590819598 + 784.5488305664002 + 957.3522631840398 + 1001.7526196294
print(y)
print(y / 15)

Gives:

14832.682458496522
988.8454972331015

In pharo I have noticed an anomaly which I thought was precision but it may be 
something odd with iterators.

y := 987.9504418944 + 815.2627636718801 + 1099.3898999037601 + 
1021.6996069333198 + 1019.8750146478401 + 1084.5603759764 + 1008.2985131833999 
+ 1194.9564575200002 + 893.9680444336799 + 1032.85460449136 + 905.9324633786798 
+ 1024.2805590819598 + 784.5488305664002 + 957.3522631840398 + 1001.7526196294.
y.
y / 15.

Gives the same as Python.

BUT:

z := {987.9504418944 . 815.2627636718801 . 1099.3898999037601  . 
1021.6996069333198  . 1019.8750146478401 . 1084.5603759764 . 1008.2985131833999 
. 1194.9564575200002 . 893.9680444336799 . 1032.85460449136 . 905.9324633786798 
. 1024.2805590819598 . 784.5488305664002 . 957.3522631840398 . 1001.7526196294} 
sum.
z.
z / 15.

Gives
14832.68245849652
988.8454972331014

Is this correct?


Reply via email to