ee.Number.toFloat

Casts the input value to a 32-bit float.

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

Examples

Code Editor (JavaScript)

// Declare an ee.Number.
var number = ee.Number(100);
print('ee.Number:', number);

// Cast a number to signed 32-bit floating point number.
var floatNumber = number.toFloat();
print('ee.Number cast to float:', floatNumber);

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)

# Declare an ee.Number.
number = ee.Number(100)
print('ee.Number:', number.getInfo())

# Cast a number to signed 32-bit floating point number.
float_number = number.toFloat()
print('ee.Number cast to float:', float_number.getInfo())