### The Maxima on-line user's manual

Algebra Calculator

#### Floor

Function: floor (<x>) When <x> is a real number, return the largest integer that is less than or equal to <x>.

If <x> is a constant expression (10 * %pi, for example), floor evaluates <x> using big floating point numbers, and applies floor to the resulting big float. Because floor uses floating point evaluation, its possible, although unlikely, that floor could return an erroneous value for constant inputs. To guard against errors, the floating point evaluation is done using three values for fpprec.

For non-constant inputs, floor tries to return a simplified value. Here are examples of the simplifications that floor knows about:

          (%i1) floor (ceiling (x));
(%o1)                      ceiling(x)
(%i2) floor (floor (x));
(%o2)                       floor(x)
(%i3) declare (n, integer)$(%i4) [floor (n), floor (abs (n)), floor (min (n, 6))]; (%o4) [n, abs(n), min(n, 6)] (%i5) assume (x > 0, x < 1)$
(%i6) floor (x);
(%o6)                           0
(%i7) tex (floor (a));
$$\left \lfloor a \right \rfloor$$
(%o7)                         false

The function floor does not automatically map over lists or matrices. Finally, for all inputs that are manifestly complex, floor returns a noun form.

If the range of a function is a subset of the integers, it can be declared to be integervalued. Both the ceiling and floor functions can use this information; for example:

          (%i1) declare (f, integervalued)\$
(%i2) floor (f(x));
(%o2)                         f(x)
(%i3) ceiling (f(x) - 1);
(%o3)                       f(x) - 1

(%o1)                                true
(%i2) 

### Related Examples

kill(all);

KE:150000;

n:5;

Calculate

##### floor-sum

M:23;

P:53;

N1:floor(P/4);

Calculate

floor(3.5);

log(2),numer,fpprec=3;

Calculate

floor (-2.718);

Calculate

##### floor-map-numer-tan

dreiecke:[[59.97,5.19...

f(x):=x[2]/tan(x[1]*%...

a:map(f,dreiecke),numer;

Calculate

pow2:[1,2,4,8,16,32];

pow3:[1,3,9,27,81,243];

Calculate

##### floor

f(x):=((-1)^x)*floor(...

f(1);

f(2);

Calculate

##### floor-matrix-mod

transformed: matrix([...

m: matrix([13107, 524...

QP: 6;

Calculate

##### floor-log-makelist-sum-taylor

taylor(sum(x^(2^k),k,...

makelist(floor(log(2*...

Calculate

floor( log47);

Calculate