T
THAKUR PRASHANT SINGH
Hi,
=20
I am facing some issues in dealing with floating point numbers
I am picking floating point numbers form MySQL DB for example 22.09
And similar numbers and store them in an array in ruby.
When I collect all the numbers I want to filter them in groups.
Suppose 22.09 was the original number and its stored in ruby array
myArray at some index.
While retrieving from array I get some number like 22.09000015.=20
So when I do groupings I miss out my original number as 22.09 <
22.09000015
Where as it should come in a group where numbers are 22.09 >=3D 22.09
I wish to have last condition returning true.Is there any simple way to
do that as my dataset contains around a million numbers.
If I use conversion to string and back to to_f I lose time of
approximately 10 secs for each 7000 rows.
=20
Regards,
Prashant
=20
I am facing some issues in dealing with floating point numbers
I am picking floating point numbers form MySQL DB for example 22.09
And similar numbers and store them in an array in ruby.
When I collect all the numbers I want to filter them in groups.
Suppose 22.09 was the original number and its stored in ruby array
myArray at some index.
While retrieving from array I get some number like 22.09000015.=20
So when I do groupings I miss out my original number as 22.09 <
22.09000015
Where as it should come in a group where numbers are 22.09 >=3D 22.09
I wish to have last condition returning true.Is there any simple way to
do that as my dataset contains around a million numbers.
If I use conversion to string and back to to_f I lose time of
approximately 10 secs for each 7000 rows.
=20
Regards,
Prashant