Groovy JDK

java.lang
Class Float

Method Summary
float abs()
Get the absolute value
void downto(Number to, Closure closure)
Iterates from this number down to the given number, inclusive, decrementing by one each time.
int round()
Round the value
float round(int precision)
Round the value
float trunc(int precision)
Truncate the value
float trunc()
Truncate the value
void upto(Number to, Closure closure)
Iterates from this number up to the given number, inclusive, incrementing by one each time.
 
Method Detail

abs

public float abs()
 
Get the absolute value
Returns:
the absolute value of that Float
Since:
1.0

downto

public void downto(Number to, Closure closure)
 
Iterates from this number down to the given number, inclusive, decrementing by one each time.
Parameters:
to - the end number.
closure - the code to execute for each number.
Since:
1.0

round

public int round()
 
Round the value
Returns:
the rounded value of that Float
Since:
1.0

round

public float round(int precision)
 
Round the value
Parameters:
precision - the number of decimal places to keep.
Returns:
the Float rounded to the number of decimal places specified by precision
Since:
1.6.0

trunc

public float trunc(int precision)
 
Truncate the value
Parameters:
precision - the number of decimal places to keep.
Returns:
the Float truncated to the number of decimal places specified by precision
Since:
1.6.0

trunc

public float trunc()
 
Truncate the value
Returns:
the Double truncated to 0 decimal places (i.e. a synonym for floor)
Since:
1.6.0

upto

public void upto(Number to, Closure closure)
 
Iterates from this number up to the given number, inclusive, incrementing by one each time.
Parameters:
to - the end number.
closure - the code to execute for each number.
Since:
1.0

Groovy JDK