Hi !
Short question:
Is there a method/function for “casting” floats to integers ?
Something like ( int)(Math.sqrt(2)+1) ???
Thanks for any hint in advance !
Kind reghards,
Meino
Hi !
Short question:
Is there a method/function for “casting” floats to integers ?
Something like ( int)(Math.sqrt(2)+1) ???
Thanks for any hint in advance !
Kind reghards,
Meino
Is there a method/function for "casting" floats to integers ?
Float#to_i, #ceil, #floor and #round
Guy Decoux
Meino Christian Cramer Meino.Cramer@gmx.de writes:
Is there a method/function for “casting” floats to integers ?
% ri Float.to_i
------------------------------------------------------------- Float#to_i
flt.to_i → anInteger
Returns flt truncated to an Integer.
–
But it’s all right; I’m catching the next train home.
Hi !
Short question:
Is there a method/function for “casting” floats to integers ?
Integer(3.14)
Something like ( int)(Math.sqrt(2)+1) ???
Thanks for any hint in advance !
Kind reghards,
Meino
-a
Ara Howard
NOAA Forecast Systems Laboratory
Information and Technology Services
Data Systems Group
R/FST 325 Broadway
Boulder, CO 80305-3328
Email: ara.t.howard@noaa.gov
Phone: 303-497-7238
Fax: 303-497-7259
The difference between art and science is that science is what we understand
well enough to explain to a computer. Art is everything else.
– Donald Knuth, “Discover”
~ > /bin/sh -c ‘for lang in ruby perl; do $lang -e “print "\x3a\x2d\x29\x0a"”; done’
====================================