__sub__


Definition
The operator will subtract the values.

Syntax
__sub__

Parameters
number

Examples
fraction__sub__int()
The method subtracted the values.
 >>> Fraction(1).from_decimal(1).__sub__(Fraction(0,1))
Fraction(1, 1)

The method returns the value.
 >>> complex(2255888+0j).__sub__(22.9)
(2255865.1+0j)


The equal to following:
 >>> Fraction(0,1).real.__sub__(Fraction(0, 1))
Fraction(0, 1)


The value is:
 >>> Fraction(2,3).numerator.__sub__(2)
0

The equal to following:
 >>> Fraction(0,1).real.__sub__(Fraction(0, 1))
Fraction(0, 1)

The equation subtracted the value.
 >>> Fraction(2.111300).limit_denominator(1).__sub__(Fraction(2, 1))
Fraction(0, 1)

Decimal().__sub__(Decimal()
The method test the equality tow Decimal equations.
from decimal import Decimal

x=(Decimal(1).logical_and(Decimal(1))).__sub__(Decimal(0).logical_and(Decimal(1)))
y=(Decimal(1).logical_and(Decimal(1))).__mul__(Decimal(0).logical_and(Decimal(1)))
print(x.__eq__(y))

>>> 
False
>>>

Comments