truncate a number to the next nearest integer towards 0
round a number to the nearest integer
fractional part of a number
greatest integer less than or equal to a number
smallest integer greater than or equal to a number
(optional) any expression, assumed to be a non-negative integer
These functions compute integer or fractional parts of numbers. For real arguments x:
For 0≤x, trunc(x) is the greatest integer less than or equal to x. For x<0, trunc(x) = -trunc(-x).
round(x) rounds x to the nearest integer. In case of a tie (at half-integers), it rounds away from 0.
frac(x) is the fractional part of x, that is, frac(x) = x - trunc(x).
floor(x) (floor) is the greatest integer less than or equal to x.
ceil(x) (ceiling) is the smallest integer greater than or equal to x.
For complex arguments x:
trunc(x) = trunc(ℜ⁡x) + I*trunc(ℑ⁡x)
round(x) = round(ℜ⁡x) + I*round(ℑ⁡x)
frac(x) = frac(ℜ⁡x) + I*frac(ℑ⁡x)
For floor(x), let a=ℜ⁡x−ℜ⁡x and let b=ℑ⁡x−ℑ⁡x. Then floor(x) = floor(ℜ⁡x) + I*floor(ℑ⁡x) + X, where
ceil(x) = -floor(-x)
For all functions, the two-argument case indicates the nth derivative of the function at x. Except for frac, these derivatives are 0 wherever they are defined. For frac, the first derivative is 1 wherever it is defined.
If x is a constant, these functions will use evalr() to try to cautiously evaluate x to a floating point number and then apply themselves to the result. This computation is performed initially at the current setting of Digits, and then if necessary a limited number of times more at higher settings. If evalr() continues to return a result which is ambiguous with respect to the function being applied, the original function will return unevaluated. In this case, increasing Digits before calling the function may still help in rare cases.
In all other cases, these functions return unevaluated.
The trunc command is thread-safe as of Maple 15.
For more information on thread safety, see index/threadsafe.
Truncate a number to the nearest integer towards 0.
Round a number to the nearest integer.
Fractional part of a number.
Greatest integer less than or equal to a number.
Smallest integer greater than or equal to a number.
More advanced operations.
The functions can be differentiated.
Errors are returned when the functions are not defined:
Error, (in floor) floor is not differentiable at integers
McDonnell, E.E. "Integer functions of complex numbers, with applications." IBM Philadelphia Scientific Center Tech. Rep. pp. 320-3015. Feb., 1973.
Download Help Document
What kind of issue would you like to report? (Optional)