# numbers module¶

 binaryninja.numbers.ABCMeta Metaclass for defining Abstract Base Classes (ABCs). binaryninja.numbers.Complex Complex defines the operations that work on the builtin complex type. binaryninja.numbers.Integral Integral adds a conversion to long and the bit-string operations. binaryninja.numbers.Number All numbers inherit from this class. binaryninja.numbers.Rational .numerator and .denominator should be in lowest terms. binaryninja.numbers.Real To Complex, Real adds the operations that work on real numbers. binaryninja.numbers.abstractproperty A decorator indicating abstract properties. binaryninja.numbers.abstractmethod(funcobj) A decorator indicating abstract methods.

Abstract Base Classes (ABCs) for numbers, according to PEP 3141.

TODO: Fill out more detailed documentation on the operators.

class Number

Bases: object

All numbers inherit from this class.

If you just want to check if an argument x is a number, without caring what kind, use isinstance(x, Number).

class Complex

Bases: numbers.Number

Complex defines the operations that work on the builtin complex type.

In short, those are: a conversion to complex, .real, .imag, +, -, *, /, abs(), .conjugate, ==, and !=.

If it is given heterogenous arguments, and doesn’t have special knowledge about them, it should fall back to the builtin complex type as described below.

conjugate()

(x+y*i).conjugate() returns (x-y*i).

imag

Retrieve the imaginary component of this number.

This should subclass Real.

real

Retrieve the real component of this number.

This should subclass Real.

class Real

To Complex, Real adds the operations that work on real numbers.

In short, those are: a conversion to float, trunc(), divmod, %, <, <=, >, and >=.

Real also provides defaults for the derived operations.

conjugate()

Conjugate is a no-op for Reals.

imag

Real numbers have no imaginary component.

real

Real numbers are their real component.

class Rational

Bases: numbers.Real

.numerator and .denominator should be in lowest terms.

denominator
numerator
class Integral

Integral adds a conversion to long and the bit-string operations.

denominator

Integers have a denominator of 1.

numerator

Integers are their own numerators.