Announcement: All noncommercial projects registered to use Earth Engine beforeApril 15, 2025 mustverify noncommercial eligibility to maintain access. If you have not verified by September 26, 2025, your access may be on hold.
ee.Number.signum Stay organized with collections Save and categorize content based on your preferences.
Page Summary
The signum function returns 0 if the input is 0, 1 if it's greater than 0, and -1 if it's less than 0.
The
Number.signum()usage returns a Number.The input value for the
signumfunction must be a Number.
| Usage | Returns |
|---|---|
Number.signum() | Number |
| Argument | Type | Details |
|---|---|---|
this:input | Number | The input value. |
Examples
Code Editor (JavaScript)
print('Sign of -5',ee.Number(-5).signum());// -1print('Sign of 0',ee.Number(0).signum());// 0print('Sign of 5',ee.Number(5).signum());// 1
Python setup
See the Python Environment page for information on the Python API and usinggeemap for interactive development.
importeeimportgeemap.coreasgeemap
Colab (Python)
display('Sign of -5:',ee.Number(-5).signum())# -1display('Sign of 0:',ee.Number(0).signum())# 0display('Sign of 5:',ee.Number(5).signum())# 1
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-07-13 UTC.