Skip to content

_dtypes module

Default data types for internal use.


float_ class { #vectorbtpro.dtypes.float64 data-toc-label="float" }

float64(
    x=0,
    /
)

Double-precision floating-point number type, compatible with Python float and C double.

:Character code: 'd' :Canonical name: numpy.double :Alias: numpy.float_ :Alias on this platform (Darwin arm64): numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.

Superclasses

  • builtins.float
  • numpy.floating
  • numpy.generic
  • numpy.inexact
  • numpy.number

as_integer_ratio method

float64.as_integer_ratio(
    ...
)

double.as_integer_ratio() -> (int, int)

Return a pair of integers, whose ratio is exactly equal to the original floating point number, and with a positive denominator. Raise OverflowError on infinities and a ValueError on NaNs.

np.double(10.0).as_integer_ratio() (10, 1) np.double(0.0).as_integer_ratio() (0, 1) np.double(-.25).as_integer_ratio() (-1, 4)


is_integer method

float64.is_integer(
    ...
)

double.is_integer() -> bool

Return True if the floating point number is finite with integral value, and False otherwise.

.. versionadded:: 1.22

Examples

np.double(-2.0).is_integer() True np.double(3.2).is_integer() False


int_ class { #vectorbtpro.dtypes.int64 data-toc-label="int" }

int64(
    ...
)

Signed integer type, compatible with Python int and C long.

:Character code: 'l' :Canonical name: numpy.int_ :Alias on this platform (Darwin arm64): numpy.int64: 64-bit signed integer (-9_223_372_036_854_775_808 to 9_223_372_036_854_775_807). :Alias on this platform (Darwin arm64): numpy.intp: Signed integer large enough to fit pointer, compatible with C intptr_t.

Superclasses

  • numpy.generic
  • numpy.integer
  • numpy.number
  • numpy.signedinteger

bit_count method

int64.bit_count(
    ...
)

int64.bit_count() -> int

Computes the number of 1-bits in the absolute value of the input. Analogous to the builtin int.bit_count or popcount in C++.

Examples

np.int64(127).bit_count() 7 np.int64(-127).bit_count() 7