def __sub__(self, y): if y is zero: return self if isinstance(y, SHPR): return subHPR(self, y) if isinstance(y, Factory.SFact): return Factory.Lift0F(self, hprType) - y Errors.errorOnStaticTypes("Sub", "SHPR", y)
def __sub__(self, y): if y is zero: return self if isinstance(y, SP2): return subP2(self, y) if isinstance( y, Factory.SFact): return Factory.Lift0F(self, p2Type) - y Errors.errorOnStaticTypes("Sub", "SP2", y)
def __add__(self, y): if y is zero: return self if isinstance(y, SHPR): return addHPR(self, y) if isinstance(y, Factory.SFact): return y + self Errors.errorOnStaticTypes("Add", "SHPR", y)
def __sub__(self, y): if y is zero: return self if isinstance(y, SP3): return subP3(self, y) if isinstance(y, Factory.SFact): return Factory.Lift0F(self, p3Type) - y Errors.errorOnStaticTypes("Sub", "SP3", y)
def __rmul__(self, y): if y is zero: return zero if isinstance(y, type(1)) or isinstance(y, type(1.0)): return scaleP2(y, self) if getPtype(y).includes(numType): return scaleP2(y, self) Errors.errorOnStaticTypes("Mul", "SP2", y)
def __radd__(self, y): if y is zero: return self if isinstance(y, SP3): return addP3(self, y) if isinstance(y, Factory.SFact): return y + self Errors.errorOnStaticTypes("Add", "SP3", y)
def __rmul__(self, y): if y is zero: return zero if isinstance(y, type(1)) or isinstance(y,type(1.0)): return scaleP2(y, self) if getPtype(y).includes(numType): return scaleP2(y, self) Errors.errorOnStaticTypes("Mul", "SP2", y)
def __div__(self, y): if y is zero: print("Universal Explosion") return zero if isinstance(y, type(1)) or isinstance(y, type(1.0)): return scaleP3((1.0 / y), self) if getPtype(y).includes(numType): return scaleP3((1.0 / y), self) Errors.errorOnStaticTypes("Div", "SP2", y)
def __rmul__(self, y): if y is zero: return zero.rmul(self, y) if isinstance(y, type(1)) or isinstance(y, type(1.5)): return scaleP3(y, self) #print(getPtype(y)) if getPtype(y).includes(numType): return scaleP3(y, self) Errors.errorOnStaticTypes("Mul", "SP3", y)
def __add__(self, y): if y is zero: return self if isinstance(y, SP2): return addP2(self, y) if isinstance(y, Factory.SFact): return y + self Errors.errorOnStaticTypes("Add", "SP2", y) sys.exit()
def __div__(self, y): if y is zero: print("Universal Explosion") return zero if isinstance(y, type(1)) or isinstance(y,type(1.0)): return scaleP3((1.0/y), self) if getPtype(y).includes(numType): return scaleP3((1.0/y), self) Errors.errorOnStaticTypes("Div", "SP2", y)
def __rsub__(self, y): if y is zero: return zero.sub(self, zero) if isinstance(y, SP3): return subP3(y, self) Errors.errorOnStaticTypes("Sub", "SP3", y)
def __radd__(self, y): if y is zero: return self if isinstance(y, SHPR): return addHPR(self, y) Errors.errorOnStaticTypes("Add", "SHPR", y)
def __radd__(self, y): if y is zero: return self if isinstance(y, SP2): return addP2(self, y) Errors.errorOnStaticTypes("Add", "SP2", y)
def __rsub__(self, y): if y is zero: return zero.sub(self, zero) if isinstance(y, SP2): return subP2(y, self) Errors.errorOnStaticTypes("Sub", "SP2", y)
def __rsub__(self, y): if y is zero: return self if isinstance(y, SHPR): return subHPR(self, y) Errors.errorOnStaticTypes("Sub", "SHPR", y)