qbraid.runtime.schemas.Credits

class Credits(value)[source]

Represents a value in Credits, subclassing decimal.Decimal.

Parameters:

value (str or int or float) – The initial value for the Credits.

__init__()

Methods

__init__()

adjusted()

Return the adjusted exponent of the number.

as_integer_ratio()

Return a pair of integers, whose ratio is exactly equal to the original Decimal and with a positive denominator.

as_tuple()

Return a tuple representation of the number.

canonical()

Return the canonical encoding of the argument.

compare(other[, context])

Compare self to other.

compare_signal(other[, context])

Identical to compare, except that all NaNs signal.

compare_total(other[, context])

Compare two operands using their abstract representation rather than their numerical value.

compare_total_mag(other[, context])

Compare two operands using their abstract representation rather than their value as in compare_total(), but ignoring the sign of each operand.

conjugate()

Return self.

copy_abs()

Return the absolute value of the argument.

copy_negate()

Return the negation of the argument.

copy_sign(other[, context])

Return a copy of the first operand with the sign set to be the same as the sign of the second operand.

exp([context])

Return the value of the (natural) exponential function e**x at the given number.

fma(other, third[, context])

Fused multiply-add.

from_float()

Class method that converts a float to a decimal number, exactly.

is_canonical()

Return True if the argument is canonical and False otherwise.

is_finite()

Return True if the argument is a finite number, and False if the argument is infinite or a NaN.

is_infinite()

Return True if the argument is either positive or negative infinity and False otherwise.

is_nan()

Return True if the argument is a (quiet or signaling) NaN and False otherwise.

is_normal([context])

Return True if the argument is a normal finite non-zero number with an adjusted exponent greater than or equal to Emin.

is_qnan()

Return True if the argument is a quiet NaN, and False otherwise.

is_signed()

Return True if the argument has a negative sign and False otherwise.

is_snan()

Return True if the argument is a signaling NaN and False otherwise.

is_subnormal([context])

Return True if the argument is subnormal, and False otherwise.

is_zero()

Return True if the argument is a (positive or negative) zero and False otherwise.

ln([context])

Return the natural (base e) logarithm of the operand.

log10([context])

Return the base ten logarithm of the operand.

logb([context])

For a non-zero number, return the adjusted exponent of the operand as a Decimal instance.

logical_and(other[, context])

Return the digit-wise 'and' of the two (logical) operands.

logical_invert([context])

Return the digit-wise inversion of the (logical) operand.

logical_or(other[, context])

Return the digit-wise 'or' of the two (logical) operands.

logical_xor(other[, context])

Return the digit-wise 'exclusive or' of the two (logical) operands.

max(other[, context])

Maximum of self and other.

max_mag(other[, context])

Similar to the max() method, but the comparison is done using the absolute values of the operands.

min(other[, context])

Minimum of self and other.

min_mag(other[, context])

Similar to the min() method, but the comparison is done using the absolute values of the operands.

next_minus([context])

Return the largest number representable in the given context (or in the current default context if no context is given) that is smaller than the given operand.

next_plus([context])

Return the smallest number representable in the given context (or in the current default context if no context is given) that is larger than the given operand.

next_toward(other[, context])

If the two operands are unequal, return the number closest to the first operand in the direction of the second operand.

normalize([context])

Normalize the number by stripping the rightmost trailing zeros and converting any result equal to Decimal('0') to Decimal('0e0').

number_class([context])

Return a string describing the class of the operand.

quantize(exp[, rounding, context])

Return a value equal to the first operand after rounding and having the exponent of the second operand.

radix()

Return Decimal(10), the radix (base) in which the Decimal class does all its arithmetic.

remainder_near(other[, context])

Return the remainder from dividing self by other.

rotate(other[, context])

Return the result of rotating the digits of the first operand by an amount specified by the second operand.

same_quantum(other[, context])

Test whether self and other have the same exponent or whether both are NaN.

scaleb(other[, context])

Return the first operand with the exponent adjusted the second.

shift(other[, context])

Return the result of shifting the digits of the first operand by an amount specified by the second operand.

sqrt([context])

Return the square root of the argument to full precision.

to_eng_string([context])

Convert to an engineering-type string.

to_integral([rounding, context])

Identical to the to_integral_value() method.

to_integral_exact([rounding, context])

Round to the nearest integer, signaling Inexact or Rounded as appropriate if rounding occurs.

to_integral_value([rounding, context])

Round to the nearest integer without signaling Inexact or Rounded.

to_usd()

Converts Credits to USD by dividing the value by 100.

Attributes

imag

real