S
Stefan Salewski
I really like to get "real/float" division results. I know that there
are cases where one may need integer results, but for most of my
applications I do not want it. For example for may cairo drawing test at
http://www.ssalewski.de/PetEd-Demo.html.en unwanted integer results was
a reason for some strange bugs.
For Python there was something like "from future import division" to fix
it. In Ruby we can use 3.to_f / 2 or 3.fdiv 2. I am not really happy
with that notation, because I should use that always to ensure that I
get always my desired result.
Is there a simple way to redefine division, like Pythons "from future
import division"?. I have found a few tricks with Google (which I, still
learning Ruby, do not really understand), but I am no expert, so I do
not want to break something with ugly redefinition tricks.
Best regards
Stefan Salewski
are cases where one may need integer results, but for most of my
applications I do not want it. For example for may cairo drawing test at
http://www.ssalewski.de/PetEd-Demo.html.en unwanted integer results was
a reason for some strange bugs.
For Python there was something like "from future import division" to fix
it. In Ruby we can use 3.to_f / 2 or 3.fdiv 2. I am not really happy
with that notation, because I should use that always to ensure that I
get always my desired result.
Is there a simple way to redefine division, like Pythons "from future
import division"?. I have found a few tricks with Google (which I, still
learning Ruby, do not really understand), but I am no expert, so I do
not want to break something with ugly redefinition tricks.
Best regards
Stefan Salewski