orange2 icon indicating copy to clipboard operation
orange2 copied to clipboard

value conversion bug for relatively large numbers

Open wenchenvincent opened this issue 8 years ago • 3 comments

I was trying to create data tables from Python list of list. I found that there was a problem with importing the values correctly for some relatively large numbers. It seemed that there was bug when creating a Continunous Value with relatively large numbers. For example

Orange.data.Value(Orange.feature.Continuous(),308632021)

This construction will give me the following Value: <orange.Value ''='308632032.000'>

It seems that for relatively large numbers, the conversion would usually be wrong but in a way that is not like an overflow.

wenchenvincent avatar Jan 10 '18 21:01 wenchenvincent

The values are stored as 32-bit floats internally. They have precision of 24 significant bits meaning they cannot (generally) represent integer values larger then 16777216.

For instance this will fail at the last line

 assert np.float32(2 ** 24 - 1) == 2 ** 24 - 1
 assert np.float32(2 ** 24 ) == 2 ** 24
 assert np.float32(2 ** 24 + 1 ) == 2 ** 24 + 1

ales-erjavec avatar Jan 11 '18 08:01 ales-erjavec

Thank you for the answer! Is there any option that we can choose to represent the numbers as double precision?

wenchenvincent avatar Jan 11 '18 13:01 wenchenvincent

I am afraid not.

ales-erjavec avatar Jan 16 '18 08:01 ales-erjavec