Example #1
0
 def is_w(self, space, w_other):
     from pypy.rlib.longlong2float import float2longlong
     if not isinstance(w_other, W_AbstractFloatObject):
         return False
     if self.user_overridden_class or w_other.user_overridden_class:
         return self is w_other
     one = float2longlong(space.float_w(self))
     two = float2longlong(space.float_w(w_other))
     return one == two
Example #2
0
 def is_w(self, space, w_other):
     from pypy.rlib.longlong2float import float2longlong
     if not isinstance(w_other, W_AbstractFloatObject):
         return False
     if self.user_overridden_class or w_other.user_overridden_class:
         return self is w_other
     one = float2longlong(space.float_w(self))
     two = float2longlong(space.float_w(w_other))
     return one == two
Example #3
0
 def immutable_unique_id(self, space):
     if self.user_overridden_class:
         return None
     from pypy.rlib.longlong2float import float2longlong
     from pypy.objspace.std.model import IDTAG_COMPLEX as tag
     real = space.float_w(space.getattr(self, space.wrap("real")))
     imag = space.float_w(space.getattr(self, space.wrap("imag")))
     real_b = rbigint.fromrarith_int(float2longlong(real))
     imag_b = rbigint.fromrarith_int(float2longlong(imag))
     val = real_b.lshift(64).or_(imag_b).lshift(3).or_(rbigint.fromint(tag))
     return space.newlong_from_rbigint(val)
Example #4
0
 def unique_id(self, space):
     if self.user_overridden_class:
         return W_Object.unique_id(self, space)
     from pypy.rlib.longlong2float import float2longlong
     from pypy.objspace.std.model import IDTAG_COMPLEX as tag
     real = space.float_w(space.getattr(self, space.wrap("real")))
     imag = space.float_w(space.getattr(self, space.wrap("imag")))
     real_b = rbigint.fromrarith_int(float2longlong(real))
     imag_b = rbigint.fromrarith_int(float2longlong(imag))
     val = real_b.lshift(64).or_(imag_b).lshift(3).or_(rbigint.fromint(tag))
     return space.newlong_from_rbigint(val)
Example #5
0
 def is_w(self, space, w_other):
     from pypy.rlib.longlong2float import float2longlong
     if not isinstance(w_other, W_AbstractComplexObject):
         return False
     if self.user_overridden_class or w_other.user_overridden_class:
         return self is w_other
     real1 = space.float_w(space.getattr(self,    space.wrap("real")))
     real2 = space.float_w(space.getattr(w_other, space.wrap("real")))
     imag1 = space.float_w(space.getattr(self,    space.wrap("imag")))
     imag2 = space.float_w(space.getattr(w_other, space.wrap("imag")))
     real1 = float2longlong(real1)
     real2 = float2longlong(real2)
     imag1 = float2longlong(imag1)
     imag2 = float2longlong(imag2)
     return real1 == real2 and imag1 == imag2
Example #6
0
 def is_w(self, space, w_other):
     from pypy.rlib.longlong2float import float2longlong
     if not isinstance(w_other, W_AbstractComplexObject):
         return False
     if self.user_overridden_class or w_other.user_overridden_class:
         return self is w_other
     real1 = space.float_w(space.getattr(self, space.wrap("real")))
     real2 = space.float_w(space.getattr(w_other, space.wrap("real")))
     imag1 = space.float_w(space.getattr(self, space.wrap("imag")))
     imag2 = space.float_w(space.getattr(w_other, space.wrap("imag")))
     real1 = float2longlong(real1)
     real2 = float2longlong(real2)
     imag1 = float2longlong(imag1)
     imag2 = float2longlong(imag2)
     return real1 == real2 and imag1 == imag2
Example #7
0
 def immutable_unique_id(self, space):
     if self.user_overridden_class:
         return None
     from pypy.rlib.longlong2float import float2longlong
     from pypy.objspace.std.model import IDTAG_FLOAT as tag
     val = float2longlong(space.float_w(self))
     b = rbigint.fromrarith_int(val)
     b = b.lshift(3).or_(rbigint.fromint(tag))
     return space.newlong_from_rbigint(b)
Example #8
0
 def unique_id(self, space):
     if self.user_overridden_class:
         return W_Object.unique_id(self, space)
     from pypy.rlib.longlong2float import float2longlong
     from pypy.objspace.std.model import IDTAG_FLOAT as tag
     val = float2longlong(space.float_w(self))
     b = rbigint.fromrarith_int(val)
     b = b.lshift(3).or_(rbigint.fromint(tag))
     return space.newlong_from_rbigint(b)
Example #9
0
def pack_double(fmtiter):
    doubleval = fmtiter.accept_float_arg()
    value = longlong2float.float2longlong(doubleval)
    if fmtiter.bigendian:
        for i in range_8_unroll:
            x = (value >> (8 * i)) & 0xff
            fmtiter.result.append(chr(x))
    else:
        for i in range_8_unroll:
            fmtiter.result.append(chr(value & 0xff))
            value >>= 8
Example #10
0
def pack_double(fmtiter):
    doubleval = fmtiter.accept_float_arg()
    value = longlong2float.float2longlong(doubleval)
    if fmtiter.bigendian:
        for i in range_8_unroll:
            x = (value >> (8*i)) & 0xff
            fmtiter.result.append(chr(x))
    else:
        for i in range_8_unroll:
            fmtiter.result.append(chr(value & 0xff))
            value >>= 8
Example #11
0
def op_convert_float_bytes_to_longlong(a):
    from pypy.rlib.longlong2float import float2longlong
    return float2longlong(a)
Example #12
0
 def _push_longlong(self, floatval, ll_args, i):
     """
     Takes a longlong represented as a python Float. It's a hack for the
     jit, else we could not see the whole libffi module at all"""
     self._push_arg(float2longlong(floatval), ll_args, i)
Example #13
0
 def f(x):
     ll = float2longlong(x)
     return longlong2float(ll)
Example #14
0
 def FloatImmedLoc(floatstorage):
     from pypy.rlib.longlong2float import float2longlong
     value = intmask(float2longlong(floatstorage))
     return ImmedLoc(value)
def fn(f1):
    ll = float2longlong(f1)
    f2 = longlong2float(ll)
    return f2
 def f(f1):
     try:
         ll = float2longlong(f1)
         return longlong2float(ll)
     except Exception:
         return 500
Example #17
0
def fn(f1):
    ll = float2longlong(f1)
    f2 = longlong2float(ll)
    return f2
Example #18
0
 def f(x):
     ll = float2longlong(x)
     return longlong2float(ll)
Example #19
0
 def f(f1):
     try:
         ll = float2longlong(f1)
         return longlong2float(ll)
     except Exception:
         return 500
Example #20
0
 def FloatImmedLoc(floatstorage):
     from pypy.rlib.longlong2float import float2longlong
     value = intmask(float2longlong(floatstorage))
     return ImmedLoc(value)