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. |
Divide
This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics. |
Divide( value_1, value_2, ... )
divide( value_1, value_2, ... )
Divide( value_1, value_2, ... )
Divide( value_1, value_2, ... )
Divide( value_1, value_2, ... )
Divide( value_1, value_2, ... )
Description
The Divide
function computes the quotient of two or more numbers.
When all of the numbers are integers, the result is a Long
integer value. When any of the numbers is a floating-point number, the
result is a Double-precision, floating-point value.
Attempting to Divide
an empty list results in an "invalid
argument" error.
Attempting to Divide
any value by zero results in a "invalid
argument" error.
Returns
A Number which is the result of dividing two or more numbers. When all of the parameters are integers, the result is a Long (integer division). Otherwise, the result is a Double (floating-point division).
Examples
-
The following query executes two equivalent division operations. The first example provides the
Divide
function a list of numbers. The second equivalent operation first divides 10 by 5, the takes the result of that operation and divides it by 2:1
1
1
LongV(1)
1
1
is equivalent to:
1
1
1
LongV(1)
1
1
-
The following query demonstrates that dividing with integers results in an integer result:
0
0
0
LongV(0)
0
0
-
The following query demonstrates that dividing with a double value results in a floating-point result:
0.5
0.5
0.5
DoubleV(0.5)
0.5
0.5
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!