# Divide

``Not available in this language yet.``
``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.

## Parameters

Argument Type Definition and Requirements

`value`

Number

Two or more numbers to divide.

## 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

1. 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:

``client.Query(Divide(10, 5, 2));``
``1``
``````curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "divide": [ 10, 5, 2 ] }'``````
``````HTTP/1.1 200 OK
{ "resource": 1 }``````
``````result, _ := client.Query(f.Divide(10, 5, 2))

fmt.Println(result)``````
``1``
``````System.out.println(
client.query(
Divide(Value(10), Value(5), Value(2))
).get());``````
``1``
``````client.query(q.Divide(10, 5, 2))
.then((ret) => console.log(ret))``````
``1``
``````print(client.query(
q.divide(10, 5, 2)
))``````
``1``
``````println(Await.result(
client.query(
Divide(10, 5, 2)
),
5.seconds
))``````
``1``

is equivalent to:

``client.Query(Divide(Divide(10, 5), 2));``
``1``
``````curl https://db.fauna.com/ \
-u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
-d '{ "divide": [ { "divide": [ 10, 5 ] }, 2 ] }'``````
``````HTTP/1.1 200 OK
{ "resource": 1 }``````
``````result, _ := client.Query(f.Divide(f.Divide(10, 5), 2))

fmt.Println(result)``````
``1``
``````System.out.println(
client.query(
Divide(Divide(Value(10), Value(5)), Value(2))
).get());``````
``1``
``````client.query(q.Divide(q.Divide(10, 5), 2))
.then((ret) => console.log(ret))``````
``1``
``````print(client.query(
q.divide(q.divide(10, 5), 2)
))``````
``1``
``````println(Await.result(
client.query(
Divide(Divide(10, 5), 2)
),
5.seconds
))``````
``1``
2. The following query demonstrates that dividing with integers results in an integer result:

``client.Query(Divide(1, 2));``
``LongV(0)``
``````result, _ := client.Query(f.Divide(1, 2))

fmt.Println(result)``````
``0``
``````System.out.println(
client.query(
Divide(Value(1), Value(2))
).get());``````
``0``
``````client.query(q.Divide(1, 2))
.then((ret) => console.log(ret))``````
``0``
``````print(client.query(
q.divide(1, 2)
))``````
``0``
``````println(Await.result(
client.query(
Divide(1, 2)
),
5.seconds
))``````
``0``
3. The following query demonstrates that dividing with a double value results in a floating-point result:

``Not available in this language yet.``
``Not available in this language yet.``
``````System.out.println(
client.query(
Divide(Value(1), ToDouble(Value(2)))
).get());``````
``0.5``
``````client.query(q.Divide(1, q.ToDouble(2)))
.then((ret) => console.log(ret))``````
``0.5``
``Not available in this language yet.``
``````println(Await.result(
client.query(
Divide(1, ToDouble(2))
),
5.seconds
))``````
``0.5``