FQL v4 will be decommissioned on June 30, 2025. Ensure that you complete your migration from FQL v4 to FQL v10 by that date.

For more details, review the migration guide. Contact support@fauna.com with any questions.

Floor

This reference topic applies to FQL v4. Go to this page for the latest FQL v10 reference topics.

Floor( value )
floor( value )
Floor( value )
Floor( value )
Floor( value )

Description

The Floor function returns the largest value that is less than or equal to the argument and is equal to a mathematical integer.

Parameters

Parameter Type Definition and Requirements

value

Number

Take the floor of this value.

Returns

A number which is the result of the Floor operation.

Examples

The following query executes an array of independent floor operations and returns the results in an array. The result array position matches the execution array position. The top operation in the execution array, floor of 7.0, returns a long value of 7 in the top position of the result array.

client.query([
  q.Floor(7.0),
  q.Floor(1.11),
  q.Floor(2.99),
])
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ 7, 1, 2 ]
result = client.query(
  [
    q.floor(7.0),
    q.floor(1.11),
    q.floor(2.99),
  ]
)
print(result)
[7.0, 1.0, 2.0]
result, err := client.Query(
	f.Arr{
		f.Floor(7.0),
		f.Floor(1.11),
		f.Floor(2.99),
	})

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[7 1 2]
try
{
    Value result = await client.Query(
        Arr(
            Floor(7.0),
            Floor(1.11),
            Floor(2.99)
        )
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(DoubleV(7), DoubleV(1), DoubleV(2))
[
  Floor(7.0),
  Floor(1.11),
  Floor(2.99)
]
[ 7, 1, 2 ]
Query metrics:
  •    bytesIn:  43

  •   bytesOut:  24

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 1ms

  •    retries:   0

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!