updating oE trunc


include math.e 
namespace math 
public function trunc(object x) 

returns the integer portion of a number.

  1. value : any Euphoria object.

An object, the shape of which depends on values's. Each item in the returned object will be an integer. These are the same corresponding items in value except with any fractional portion removed.

  • This is essentially done by always rounding towards zero. The floor function rounds towards negative infinity, which means it rounds towards zero for positive values and away from zero for negative values.
  • Note that trunc(x) + frac(x) = x
Example 1:
a = trunc(9.4) 
-- a is 9 
Example 2:
s = trunc({81, -3.5, -9.999, 5.5}) 
-- s is {81,-3, -9, 5} 
See Also:

floor frac

Not Categorized, Please Help


Quick Links

User menu

Not signed in.

Misc Menu