FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date. Fauna accounts created after August 21, 2024 must use FQL v10. These accounts will not be able to run FQL v4 queries or access the v4 Dashboard. For more details, see the v4 EOL announcement and migration guide. Contact support@fauna.com with any questions. |
Sign
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Sign( value )
sign( value )
Sign( value )
Sign( value )
Sign( value )
Sign( value )
Parameters
Parameter | Type | Definition and Requirements |
---|---|---|
|
Number |
Determine the sign of this Number. |
Returns
Long Values:
-
1 when the value of the argument is positive.
-
0 when the value of the argument is zero.
-
-1 when the value of the argument is negative.
Double Values:
-
-1 when the value of the argument is less than zero.
-
1 when the value is greater than or equal to zero or
NaN
.
Examples
The following query executes an array of independent sign operations and returns the results in an array. The result array position matches the execution array position. The first sign operation on the value 3 returns 1 for a positive number. The second operation returns zero for neither a positive nor negative number. The third sign operation on the value -3 returns -1 for a negative number.
[ 1, 0, -1 ]
[1, 0, -1]
[1 0 -1]
Arr(LongV(1), LongV(0), LongV(-1))
[1, 0, -1]
[ 1, 0, -1 ]
Is this article helpful?
Tell Fauna how the article can be improved:
Visit Fauna's forums
or email docs@fauna.com
Thank you for your feedback!