Divide

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, ... )
Divide( value_1, value_2, ... )
Not available in this language yet.

Description

The Divide function computes the quotient of two or more numbers.

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.

Examples

The query below 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.

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "divide": [ 10, 5, 2 ] }'
client.Query(Divide(10, 5, 2));
System.out.println(
       client.query(Divide(Value(10), Value(5), Value(2)))
               .get());
result, _ := client.Query(f.Divide(10, 5, 2))

fmt.Println(result)
client.query(Divide(10, 5, 2))
client.query(q.divide(10, 5, 2))
$client.query do
  divide 10, 5, 2
end
client.query(Divide(10, 5, 2))
client.query(q.Divide(10, 5, 2))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": 1 }
1
1
1
1
1
1
1
1

is equivalent to:

curl https://db.fauna.com/ \
    -u fnAChGwBcAACAO70ziE0cfROosNJHdgBmJU1PgpL: \
    -d '{ "divide": [ { "divide": [ 10, 5 ] }, 2 ] }'
client.Query(Divide(Divide(10, 5), 2));
System.out.println(
     client.query(Divide(Divide(Value(10), Value(5)), Value(2)))
     .get());
result, _ := client.Query(f.Divide(f.Divide(10, 5), 2))

fmt.Println(result)
client.query(Divide(Divide(10, 5), 2))
client.query(q.divide(q.divide(10, 5), 2))
$client.query do
  divide divide(10, 5), 2
end
client.query(Divide(Divide(10, 5), 2))
client.query(q.Divide(q.Divide(10, 5), 2))
.then((ret) => console.log(ret))
HTTP/1.1 200 OK
{ "resource": 1 }
1
1
1
1
1
1
1
1

Was this article helpful?

We're sorry to hear that.
Tell us how we can improve! documentation@fauna.com

Thank you for your feedback!