Chaos Project

RPG Maker => RPG Maker Scripts => Script Troubleshooting => Topic started by: Apidcloud on May 07, 2011, 02:14:42 pm

Title: 'round' Numeric Class[Resolved]
Post by: Apidcloud on May 07, 2011, 02:14:42 pm
Hey XD

How do I use 'round' ? xD It's from Numeric class...
Title: Re: 'round' Numeric Class
Post by: ForeverZer0 on May 07, 2011, 09:04:57 pm
float = 1.4
print float.round


1

float = 3452.6
print float.round


3453

Their are also ".ceil" and ".floor". .ceil will always round up to the next nearest whole integer, whil .floor always round down.
.round and .to_i are basically the same thing, they round down for decimal value less than .5, and up for .5 and greater.


Title: Re: 'round' Numeric Class
Post by: Apidcloud on May 08, 2011, 07:05:18 am
Big thanks xD

Thanks a lot for helping me (:

Resolved :P