ee.Number.bitwiseNot
Calculates the bitwise NOT of the input, in the smallest signed integer type that can hold the input.
Usage | Returns |
---|
Number.bitwiseNot() | Number |
Argument | Type | Details |
---|
this: input | Number | The input value. |
Examples
/**
* Unsigned 8-bit type example.
*
* 25 as binary: 00011001
* Flip each digit: 11100110
*
* 11100110 is signed 8-bit binary for -26.
* (binary interpreted using smallest signed integer type containing the input).
*/
print(ee.Number(25).bitwiseNot());
Python setup
See the
Python Environment page for information on the Python API and using
geemap
for interactive development.
import ee
import geemap.core as geemap
"""Unsigned 8-bit type example.
25 as binary: 00011001
Flip each digit: 11100110
11100110 is signed 8-bit binary for -26.
(binary interpreted using smallest signed integer type containing the input).
"""
print(ee.Number(25).bitwiseNot().getInfo())
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-10-06 UTC.
[null,null,["Last updated 2023-10-06 UTC."],[[["`Number.bitwiseNot()` calculates the bitwise NOT of a number, essentially flipping each bit in the binary representation of the input."],["The result is interpreted as a signed integer using the smallest data type that can accommodate the input value."],["For example, the bitwise NOT of 25 (binary 00011001) is -26 (binary 11100110 in signed 8-bit representation)."]]],["The `bitwiseNot()` method computes the bitwise NOT of a given number. It takes a number as input and returns a number. The operation inverts each bit in the binary representation of the input. The result is interpreted using the smallest signed integer type capable of holding the input. For example, inputting 25 (00011001 in binary) results in -26 (11100110 in binary) after the bits are flipped.\n"]]