Lichen

Changeset

888:b76b924d350a
2019-02-01 Paul Boddie raw files shortlog changelog graph Merged changes from trailing-data. float-preallocation
     1.1 --- a/lib/operator/binary.py	Fri Feb 01 00:58:04 2019 +0100
     1.2 +++ b/lib/operator/binary.py	Fri Feb 01 01:30:23 2019 +0100
     1.3 @@ -25,7 +25,8 @@
     1.4                     int_lshift, int_rshift, \
     1.5                     int_and, int_not, int_or, int_xor, \
     1.6                     is_int, \
     1.7 -                   float_add, float_div, float_mul, float_pow, float_sub
     1.8 +                   float_add, float_div, float_mul, float_pow, float_sub, \
     1.9 +                   int_float
    1.10  
    1.11  # These functions defer method lookup by wrapping the attribute access in
    1.12  # lambda functions. Thus, the appropriate methods are defined locally, but no
    1.13 @@ -89,8 +90,11 @@
    1.14  def pow(a, b):
    1.15      if is_int(a) and is_int(b):
    1.16          return int_pow(a, b)
    1.17 -    elif a.__class__ is float and b.__class__ is float:
    1.18 -        return float_pow(a, b)
    1.19 +    elif a.__class__ is float:
    1.20 +        if is_int(b):
    1.21 +            b = int_float(b)
    1.22 +        if b.__class__ is float:
    1.23 +            return float_pow(a, b)
    1.24      return binary_op(a, b, lambda a: a.__pow__, lambda b: b.__rpow__)
    1.25  
    1.26  def rshift(a, b):