def div_by(self, other): if isinstance(other, Number): if other.value == 0: return None, RTError(other.pos_start, other.pos_end, 'Division by zero', self.context) return Number(self.value / other.value).set_context( self.context), None else: return None, Value.illegal_operation(self, other)
def anded_by(self, other): if isinstance(other, Number): return Number(int(self.value and other.value)).set_context(self.context), None else: return None, Value.illegal_operation(self, other)
def get_comparison_gte(self, other): if isinstance(other, Number): return Number(int(self.value >= other.value)).set_context( self.context), None else: return None, Value.illegal_operation(self, other)
def power_op(self, other): if isinstance(other, Number): return Number(self.value**other.value).set_context( self.context), None else: return None, Value.illegal_operation(self, other)
def notted(self, other): if isinstance(other, Number): return Number(int(1 if self.value == 0 else 0)).set_context( self.context), None else: return None, Value.illegal_operation(self, other)