Exemplo n.º 1
0
 def _do_op(cls, self, other, op):
     first, second = cls(self), cls(other)
     units = second.units or first.units
     value = op(float(first), float(second))
     value /= CONV_FACTOR.get(units, 1.0)
     return cls((value, units))
Exemplo n.º 2
0
 def __float__(self):
     return self.value * CONV_FACTOR.get(self.units, 1.0)
Exemplo n.º 3
0
 def __float__(self):
     return self.value * CONV_FACTOR.get(self.units, 1.0)
Exemplo n.º 4
0
 def _do_op(cls, self, other, op):
     first, second = cls(self), cls(other)
     units = second.units or first.units
     value = op(float(first), float(second))
     value /= CONV_FACTOR.get(units, 1.0)
     return cls((value, units))
Exemplo n.º 5
0
    def _do_op(cls, self, other, op):
        value = op(float(self), float(other))
        value /= CONV_FACTOR.get(self.units or other.units, 1.0)

        return cls((value, self.units or other.units))