ee.Number.round

Computes the integer nearest to the input.

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

Examples

Code Editor (JavaScript)

print('10.4 rounds down', ee.Number(10.4).round());  // 10
print('10.5 rounds up', ee.Number(10.5).round());  // 11
print('10.9 rounds up', ee.Number(10.9).round());  // 11

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)

print('10.4 rounds down:', ee.Number(10.4).round().getInfo())  # 10
print('10.5 rounds up:', ee.Number(10.5).round().getInfo())  # 11
print('10.9 rounds up:', ee.Number(10.9).round().getInfo())  # 11