ee.Number.round

  • Number.round() computes the integer nearest to the input number.

  • The method takes a number as input and returns a number.

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)

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