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.

BitNot

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

BitNot( value )
bitnot( value )
BitNot( value )
BitNot( value )
BitNot( value )
BitNot( value )

Description

The BitNot function returns the Two’s Complement of a number. The argument must be a number, and fractional values are truncated before the operation is applied.

Parameters

Parameter Type Definition and Requirements

value

Number

A single value to take the two’s complement.

Returns

A Number which is the two’s complement of the value.

Examples

The following query executes an array of independent bitwise NOT operations and returns results in the result array. The result array position matches the position in the execution array.

client.query(
  [
    q.BitNot(0),
    q.BitNot(1),
    q.BitNot(7),
  ]
)
.then((ret) => console.log(ret))
.catch((err) => console.error(
  'Error: [%s] %s: %s',
  err.name,
  err.message,
  err.errors()[0].description,
))
[ -1, -2, -8 ]
result = client.query(
  [
    q.bitnot(0),
    q.bitnot(1),
    q.bitnot(7),
  ]
)
print(result)
[-1, -2, -8]
result, err := client.Query(
	f.Arr{
		f.BitNot(0),
		f.BitNot(1),
		f.BitNot(7),
	})

if err != nil {
	fmt.Fprintln(os.Stderr, err)
} else {
	fmt.Println(result)
}
[-1 -2 -8]
try
{
    Value result = await client.Query(
        Arr(
            BitNot(0),
            BitNot(1),
            BitNot(7)
        )
    );

    Console.WriteLine(result);
}
catch (Exception e)
{
    Console.WriteLine($"ERROR: {e.Message}");
}
Arr(LongV(-1), LongV(-2), LongV(-8))
System.out.println(
    client.query(
        Arr(
            BitNot(Value(0)),
            BitNot(Value(1)),
            BitNot(Value(7))
        )
    ).get());
[-1, -2, -8]
[
  BitNot(0),
  BitNot(1),
  BitNot(7),
]
[ -1, -2, -8 ]
Query metrics:
  •    bytesIn:  40

  •   bytesOut:  23

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