ee.Number.floor

Computes the largest integer less than or equal to the input.

UsageReturns
Number.floor()Number
ArgumentTypeDetails
this: inputNumberThe input value.

Examples

Code Editor (JavaScript)

// Positive numbers.
print('Floor for 2.1', ee.Number(2.1).floor());  // 2
print('Floor for 2.5', ee.Number(2.5).floor());  // 2
print('Floor for 2.9', ee.Number(2.9).floor());  // 2

// Negative numbers.
print('Floor for -2.1', ee.Number(-2.1).floor());  // -3
print('Floor for -2.5', ee.Number(-2.5).floor());  // -3
print('Floor for -2.9', ee.Number(-2.9).floor());  // -3

Python setup

See the Python Environment page for information on the Python API and using geemap for interactive development.

import ee
import geemap.core as geemap

Colab (Python)

# Positive numbers.
print('Floor for 2.1:', ee.Number(2.1).floor().getInfo())  # 2
print('Floor for 2.5:', ee.Number(2.5).floor().getInfo())  # 2
print('Floor for 2.9:', ee.Number(2.9).floor().getInfo())  # 2

# Negative numbers.
print('Floor for -2.1:', ee.Number(-2.1).floor().getInfo())  # -3
print('Floor for -2.5:', ee.Number(-2.5).floor().getInfo())  # -3
print('Floor for -2.9:', ee.Number(-2.9).floor().getInfo())  # -3