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.

Abs

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

Abs( value )
abs( value )
Abs( value )
Abs( value )
Abs( value )

Description

The Abs function is used to get the absolute value of a number.

Parameters

Parameter Type Definition and Requirements

value

Number

Take the absolute value of this argument.

Returns

A number which is the absolute value of a numeric input argument.

Examples

The following query returns the absolute value of -100:

client.query(
  q.Abs(-100)
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
100
result = client.query(
  q.abs(-100)
)
print(result)
100
result, err := client.Query(
	f.Abs(-100))

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
100
try
{
    Value result = await client.Query(
        Abs(-100)
    );
    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
LongV(100)
Abs(-100)
100
Query metrics:
  •    bytesIn:  12

  •   bytesOut:  16

  • computeOps:   1

  •    readOps:   0

  •   writeOps:   0

  •  readBytes:   0

  • writeBytes:   0

  •  queryTime: 2ms

  •    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!