ee.Number.divide

Divides the first value by the second, returning 0 for division by 0.
UsageReturns
Number.divide(right)Number
ArgumentTypeDetails
this: leftNumberThe left-hand value.
rightNumberThe right-hand value.

Examples

Code Editor (JavaScript)

print('5 / 10', ee.Number(5).divide(ee.Number(10)));  // 0.5
print('5 / 10.2', ee.Number(5).divide(ee.Number(10.2)));  // 0.490196078
print('5 / -10.2', ee.Number(5).divide(ee.Number(-10.2)));  // -0.490196078
print('-10.2 / 5', ee.Number(-10.2).divide(ee.Number(5)));  // -2.04
print('-10.2 / -5', ee.Number(-10.2).divide(ee.Number(-5)));  // 2.04
print('0 / 10', ee.Number(0).divide(ee.Number(10)));  // 0
print('10 / 0', ee.Number(10).divide(ee.Number(0)));  // 0