
ّRMc           @   s  d  Z  d d k Z d d k Z d d k l Z d d k l Z e Z d Z	 d Z
 d Z xC e
 e j o5 e e
  e j o" e
 d 9Z
 e d 9Z e	 d 7Z	 qY We	 d Z e d d Z e Z d	 Z d e d Z d e d Z d Z x7 d e >e j o% e d 7Z e d
 j  p
 t d  q WdM Z e e Z y8 d d k l Z l Z l Z l Z l Z l Z l Z Wnd e j
 oX d   Z d   Z d   Z d Z  d Z! d Z" d   Z d   Z d   Z d   Z n Xy d d k l# Z# Wn e j
 o d   Z# n Xd   Z$ d   Z% d   Z& d   Z' d e' _( d   Z) d  e) _( [	 [
 [ d!   Z* d"   Z+ d#   Z, e i- d$ j o d%   Z. n
 d&   Z. d'   Z/ d(   Z0 d  e0 _( d)   Z1 d*   Z2 d e2 _( d+   Z3 d  e3 _( d,   Z4 d- e5 f d.     YZ6 d/ e6 f d0     YZ7 d1 e6 f d2     YZ8 h  Z9 e: d3  Z; d4 e i< f d5     YZ= d6 e i< f d7     YZ> e; d8 e e  Z? e; d9 e: e  Z@ e; d: e d	  ZA e; d; e: d	  ZB eA e d  ZC eA e? j	 o
 eA ZD n e ZD d<   ZE d=   ZF d>   ZG d? ZH d ZI d ZJ d@ ZK d ZL d ZM dA ZN dB   ZO d dC  ZP dD   ZQ dE eR f dF     YZS dG eR f dH     YZT dI e i< f dJ     YZU dK e i< f dL     YZV d S(N   s  
This file defines restricted arithmetic:

classes and operations to express integer arithmetic,
such that before and after translation semantics are
consistent

r_uint   an unsigned integer which has no overflow
         checking. It is always positive and always
         truncated to the internal machine word size.
intmask  mask a possibly long value when running on CPython
         back to a signed int value
ovfcheck check on CPython whether the result of a signed
         integer operation did overflow
ovfcheck_lshift
         << with oveflow checking
         catering to 2.3/2.4 differences about <<
ovfcheck_float_to_int
         convert to an integer or raise OverflowError
r_longlong
         like r_int but double word size
r_ulonglong
         like r_uint but double word size
widen(x)
         if x is of a type smaller than lltype.Signed or
         lltype.Unsigned, widen it to lltype.Signed.
         Useful because the translator doesn't support
         arithmetic on the smaller types.

These are meant to be erased by translation, r_uint
in the process should mark unsigned values, ovfcheck should
mark where overflow checking is required.


iN(   t   extregistry(   t   objectmodeli    i   l    i   i@   ic   s   LONG_BIT_SHIFT value not found?gZbti(   t   isinft   isnant   copysignt   acosht   asinht   atanht   log1pc         C   s   |  t  j p |  t  j S(   t   NOT_RPYTHON(   t   INFINITY(   t   x(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   F   s    c         C   s
   |  |  j S(   R	   (    (   t   v(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   J   s    c         C   s\   |  d j  o |  }  n | d j p& | d j o! t  i | d  d j o |  Sn |  Sd S(   s(   NOT_RPYTHON. Return x with the sign of yg        g      N(   t   matht   atan2(   R   t   y(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   N   s
    3g      0>g      Ag9B.?c         C   s   t  |   o t Sn |  d j  o t d   n |  t j o* t |   o |  Sqi t i |   t Sn |  d j o d Sn |  d j o8 |  |  } t i d |  d |  t i | d   Sn |  d } t	 | t i d | | |   S(   R	   g      ?s   math domain errorg        g       @(
   R   t   NANt
   ValueErrort	   _2_to_p28R   R   t   logt   _ln2t   sqrtR   (   R   t   t(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   [   s    
.
c         C   s   t  |   } t |   p t |   o |  Sn | t j  o |  Sn | t j o t i |  t } nq | d j o4 t i d | d t i |  |  d  |  } n0 |  |  } t	 | | d t i d |   } t
 | |   S(   R	   g       @g      ?(   t   absR   R   t	   _2_to_m28R   R   R   R   R   R   R   (   R   t   absxt   wR   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   n   s    4
%c         C   s   t  |   o |  Sn t |   } | d j o t d   n | t j  o |  Sn | d j  o. | | } d t | | | d |  } n d t | | d |  } t | |   S(   R	   g      ?s   math domain errorg      ?(   R   R   R   R   R   R   (   R   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   ~   s    
$c         C   s   d d k  l } t |   | i d j  o |  Sn[ d |  j o
 d j n o+ d |  } t i |  | d |  | Sn t i d |   Sd S(   R	   i(   t   rfloatg       @g      g      ?N(   t	   pypy.rlibR   R   t   DBL_EPSILONR   R   (   R   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR      s    
!(   t   expm1c         C   se   t  |   d j  oA t i |   } | d j o |  Sn | d |  t i |  Sn t i |   d S(   R	   gffffff?g      ?(   R   R   t   expR   (   R   t   u(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR      s    c         C   sU   t  |   } | t i |  d j o t i |  } n t i |  } t | |   S(   Ng      ?(   R   R   t   floort   ceilR   (   R   R   t   r(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   round_away   s
    c         C   s   t  |  t  o t |   Sn t  |  t i  o |  Sn t  |  t  p t  t |   }  |  t M}  |  t j o |  d t 8}  n t |   S(   Ni   (	   t
   isinstancet   intR   t   Symbolict   floatt   AssertionErrort   longt	   LONG_MASKt	   LONG_TEST(   t   n(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   intmask   s    
c         C   sj   t  |  t  o t |   }  n t  |  t  p t  |  t M}  |  t j o |  d t 8}  n t |   S(   Ni   (   R%   R&   R*   R)   t   LONGLONG_MASKt   LONGLONG_TESTt
   r_longlong(   R-   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   longlongmask   s    
c         C   s<   d d k  l } t | i |    o t |   Sn |  Sd  S(   Ni(   t   lltype(   t   pypy.rpython.lltypesystemR3   t   _should_widen_typet   typeOfR.   (   R-   R3   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   widen   s    s   specialize:argtype(0)c         C   s   d d k  l } l } |  | i j o t Sn |  | i j o t Sn | i i |  } t	 | t
  p t  | i t j  p | i t j o | i S(   Ni(   R3   t   rffi(   R4   R3   R8   t   Boolt   Truet   Signedt   Falset   platformt   numbertype_to_rclasst
   issubclasst   base_intR)   t   BITSt   LONG_BITt   SIGNED(   t   tpR3   R8   t   r_class(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR5      s    s   specialize:memoc         C   su   t  |  t  p
 t d  t  |  t  p
 t d  t  |  t  p
 t d  t |   t j o t d  n |  S(   R	   s    unexpected ovf check on unsigneds$   ovfcheck not supported on r_longlongs%   ovfcheck not supported on r_ulonglongs&   signed integer expression did overflow(   R%   t   r_uintR)   R1   t   r_ulonglongt   typeR*   t   OverflowError(   R#   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   ovfcheck   s    c         C   s<   t  |  t  p
 t d  t  |  t  o t d  n |  S(   Ns    unexpected ovf check on unsigneds&   signed integer expression did overflow(   R%   RF   R)   R*   RI   (   R#   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   _local_ovfcheck   s    c         C   s   t  t t |   | >  S(   R	   (   RK   R&   R*   (   t   at   b(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   ovfcheck_lshift   s    ic         C   sM   t  |   o
 t  n d |  j  o
 d j  n o t |   Sn t  d  S(   Ng      g      A(   R   RI   R&   (   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   ovfcheck_float_to_int   s
    
c         C   sM   t  |   o
 t  n d |  j o
 d j  n o t |   Sn t  d  S(   Ng      g      C(   R   RI   R&   (   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRO      s
    
c         C   s   |  | j o |  t  j o t Sn |  Sn | t  t t f j o |  t  j o t Sn |  Sn |  t  t t f j o | Sn t d  |  i o | i t |  i | i   S(   N(   t   boolR&   R*   t	   build_intt   NoneRC   t   maxRA   (   t	   self_typet
   other_type(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   compute_restype  s    c         C   s)   |  t  t t f j o t Sn |  i Sd  S(   N(   RP   R&   R*   R:   RC   (   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   signedtype  s    c         C   sv   |  t  j o t  Sn |  i t i j o t d  |  i t i  Sn1 |  i t i j p t  t d  |  i t i  Sd  S(   N(   R&   RA   t   r_intRQ   RR   RC   R1   R)   (   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   normalizedinttype  s    c         C   s#   d d k  l } t | i |    S(   Ni(   R3   (   R4   R3   t   most_neg_value_ofR6   (   R   R3   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   most_neg_value_of_same_type#  s    c         C   s   d d k  l } l } |  | i j o t i d Sn | i i |  } t | t	  p t
  | i o | | i d ?d  Sn | d  Sd  S(   Ni(   R3   R8   i   i    (   R4   R3   R8   R;   t   syst   maxintR=   R>   R?   R@   R)   RC   t   MASK(   RD   R3   R8   RE   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRZ   (  s    
c         C   sP   |  o |  |  d @d j p t   d } x  |  o | d 7} |  d L}  q, W| S(   s   
    Calculates the highest set bit in n.  This function assumes that n is a
    power of 2 (and thus only has a single set bit).
    i   i    i(   R)   (   R-   t   i(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   highest_bit4  s    # 
R@   c           B   s  e  Z d  Z d   Z d   Z d   Z e Z d   Z d   Z d   Z	 e	 Z
 d   Z e Z d   Z e Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z e Z d   Z e Z d   Z e Z d   Z d   Z d   Z d   Z d d  Z! d d  Z" RS(   s&    fake unsigned integer implementation c         C   su   t  |   } t  |  } y |  i | | f |  SWn t j
 o n Xt | |  } | |  i | | f <| |  S(   s   
        if one argument is int or long, the other type wins.
        otherwise, produce the largest class to hold the result.
        (   RH   t   typemapt   KeyErrorRV   (   t   selft   othert   valueRT   RU   t   restype(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   _widenE  s    c         C   s:   |  t  j o t d   n t t  |   i |  |  Sd  S(   Ns   abstract base!(   R@   t	   TypeErrort   supert   __new__(   t   klasst   val(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRj   T  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __add__Z  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __sub__`  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rsub__e  s    c         C   sN   t  |   } t | t t  f  p | | Sn t  |  } |  i | | |  S(   N(   R*   R%   R&   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __mul__j  s
    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __div__r  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rdiv__y  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __mod__  s    c         C   s,   t  |   } t  |  } |  i | | |  S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rmod__  s    c         C   sK   t  |   } t  |  } t | |  } |  i | d  |  i | d  f S(   Ni    i   (   R*   t   divmodt	   __class__(   Rc   Rd   R   R   t   res(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   __divmod__  s    c         C   s)   t  |   } t  |  } |  i | | > S(   N(   R*   Rv   (   Rc   R-   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   __lshift__  s    c         C   s,   t  |   } t  |  } |  i | | | > S(   N(   R*   Rg   (   Rc   R-   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rlshift__  s    c         C   s,   t  |   } t  |  } |  i | | | ? S(   N(   R*   Rg   (   Rc   R-   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   __rshift__  s    c         C   s,   t  |   } t  |  } |  i | | | ? S(   N(   R*   Rg   (   Rc   R-   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rrshift__  s    c         C   s,   t  |   } t  |  } |  i | | | B S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __or__  s    c         C   s,   t  |   } t  |  } |  i | | | @ S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __and__  s    c         C   s,   t  |   } t  |  } |  i | | | A S(   N(   R*   Rg   (   Rc   Rd   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __xor__  s    c         C   s   t  |   } |  i |  S(   N(   R*   Rv   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __neg__  s    c         C   s   t  |   } |  i t |   S(   N(   R*   Rv   R   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __abs__  s    c         C   s   |  i  |   S(   N(   Rv   (   Rc   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __pos__  s    c         C   s   t  |   } |  i |  S(   N(   R*   Rv   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt
   __invert__  s    c         C   s:   t  |   } t  |  } t | | |  } |  i | |  S(   N(   R*   t   powRg   (   Rc   Rd   t   mR   R   Rw   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __pow__  s    c         C   s:   t  |   } t  |  } t | | |  } |  i | |  S(   N(   R*   R   Rg   (   Rc   Rd   R   R   R   Rw   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __rpow__  s    N(#   t   __name__t
   __module__t   __doc__Rg   Rj   Rm   t   __radd__Rn   Ro   Rp   t   __rmul__Rq   t   __floordiv__Rr   t   __rfloordiv__Rs   Rt   Rx   Ry   Rz   R{   R|   R}   t   __ror__R~   t   __rand__R   t   __rxor__R   R   R   R   RR   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR@   A  s@   																						t
   signed_intc           B   s    e  Z e Z d  d  Z h  Z RS(   i    c         C   s   t  |  t j o t |  } n | |  i d ?j p | |  i d ?d j  o t d | |  i f   n | d j  o | |  i @} n t t |   i |  |  S(   Ni   s(   %s does not fit in signed %d-bit integeri    (	   RH   R(   R*   R^   RI   RA   Ri   R   Rj   (   Rk   Rl   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRj     s    -(   R   R   R:   RC   Rj   Ra   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   t   unsigned_intc           B   s    e  Z e Z d  d  Z h  Z RS(   i    c         C   sF   t  | t t f  o t |  } n t t |   i |  | |  i @ S(   N(   R%   R(   R*   Ri   R   Rj   R^   (   Rk   Rl   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRj     s    (   R   R   R<   RC   Rj   Ra   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   c      
      s"  t  |  } | p, y t | | f SWq? t j
 o q? Xn | o
 t } n t } d | d } |  d  j o$ t d d d g | | f   n t |  | f h  | d <| d <| d <   | p   t | | f <n d	 t i	 f   f d
     Y} d t i	 f   f d     Y}   S(   Ni   i   s   No predefined %sint%dR    t    R^   RA   t   SIGNt   ForValuesEntryc              s   e  Z   Z   f d    Z RS(   c            s    d d k  l } | i d    S(   Ni(   t   modelt	   knowntype(   t   pypy.annotationR   t   SomeInteger(   Rc   t   annmodel(   t   int_type(    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   compute_annotation  s    (   R   R   t   _type_R   (    (   R   (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   t   ForTypeEntryc              s&   e  Z   Z   f d    Z d   Z RS(   c            s    d d k  l } | i d    S(   Ni(   R   R   (   R   R   R   (   Rc   t   args_st   kwds_sR   (   R   (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   compute_result_annotation  s    c         S   s&   | i  | i i  \ } | i   | S(   N(   t	   inputargst   r_resultt   lowleveltypet   exception_cannot_occur(   Rc   t   hopt   v_result(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   specialize_call  s    
(   R   R   t   _about_R   R   (    (   R   (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   (
   RP   t	   _inttypesRb   R   R   RR   Rh   RH   R    t   ExtRegistryEntry(   t   namet   signt   bitst   force_creationt   base_int_typet   maskR   R   (    (   R   s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyRQ     s(    	
$	t   BaseIntValueEntryc           B   s   e  Z e Z d    Z RS(   c         C   s    d d k  l } | i d t  S(   Ni(   R   R   (   R   R   R   RG   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    (   R   R   R@   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   t   BaseIntTypeEntryc           B   s   e  Z e Z d    Z RS(   c         O   s   t  d   d  S(   Ns   abstract base!(   Rh   (   Rc   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    (   R   R   R@   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   RX   RF   R1   RG   c         C   sj   t  o d d k l } | |   Sn t |   \ } } } } | o | o
 t  n t | | | |  S(   Ni(   t   strtod(   t   USE_SHORT_FLOAT_REPRt   pypy.rlib.rdtoaR   t   break_up_floatR   t   parts_to_float(   t   sR   R   t   before_pointt   after_pointt   exponent(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   rstring_to_float*  s    
c         C   s9  d } d } d } d } d } |  | d j o |  | } | d 7} n xA | t  |   j  o- |  | d j o | |  | 7} | d 7} qJ W| t  |   j o | | | | f Sn |  | d j oy | d 7} xA | t  |   j  o- |  | d j o | |  | 7} | d 7} q W| t  |   j o | | | | f Sq<n |  | d j o
 t  n | d 7} | t  |   j o
 t  n |  | d j o | |  | 7} | d 7} n | t  |   j o
 t  n xA | t  |   j  o- |  | d j o | |  | 7} | d 7} qW| t  |   j o
 t  n | | | | f S(	   Ni    R   s   +-i   t
   0123456789t   .t   eEs   -+(   t   lenR   (   R   R_   R   R   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   7  sN    
 $
 $



 $
c         C   s+   | p
 d } n t  d |  | | | f  S(   R	   t   0s
   %s%s.%se%s(   R(   (   R   t   beforeptt   afterptR   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR   l  s    
i   i   i   c         C   s   | t  @o
 d } n d } | d j o
 d } n d | | | f } | |  f } | t @o1 xY | D] } | d j o Pqd qd W| d 7} n, | d j o | i d  o | d  } n | S(	   R	   t   #R   R#   s   %rs	   %%%s.%d%ss   .eEs   .0i(   t   DTSF_ALTt   DTSF_ADD_DOT_0t   endswith(   R   t   codet	   precisiont   flagst   altt   fmtR   t   c(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   _formatd  s     

 	c         C   sE   t  o' d d k l } | |  | | |  Sn t |  | | |  Sd  S(   Ni(   t   dtoa_formatd(   R   R   R   R   (   R   R   R   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   formatd  s    c         C   sS   t  |   o
 t } n t |   o
 t } n t } t |  | | |  } | | f S(   N(   R   t   DIST_NANR   t   DIST_INFINITYt   DIST_FINITER   (   Re   RD   R   R   t   specialt   result(    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   double_to_string  s    

t   r_singlefloatc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s  A value of the C type 'float'.

    This is a single-precision floating-point number.
    Regular 'float' values in Python and RPython are double-precision.
    Note that we consider this as a black box for now - the only thing
    you can do with it is cast it back to a regular float.c         C   s%   d d  k  } | i d |  |  _ d  S(   Nit   f(   t   structt   packt   _bytes(   Rc   t   floatvalR   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __init__  s    c         C   s#   d d  k  } | i d |  i  d S(   NiR   i    (   R   t   unpackR   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt	   __float__  s    c         C   s   t  d   d  S(   Ns(   not supported on r_singlefloat instances(   Rh   (   Rc   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __nonzero__  s    c         C   s   t  d   d  S(   Ns(   not supported on r_singlefloat instances(   Rh   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __cmp__  s    c         C   s#   |  i  | i  j o |  i | i j S(   N(   Rv   R   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __eq__  s    c         C   s   |  i  |  S(   N(   R   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyt   __ne__  s    (	   R   R   R   R   R   R   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   					t   r_longfloatc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s   A value of the C type 'long double'.

    Note that we consider this as a black box for now - the only thing
    you can do with it is cast it back to a regular float.c         C   s   | |  _  d  S(   N(   Re   (   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   s   |  i  S(   N(   Re   (   Rc   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   s   t  d   d  S(   Ns&   not supported on r_longfloat instances(   Rh   (   Rc   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   s   t  d   d  S(   Ns&   not supported on r_longfloat instances(   Rh   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   s#   |  i  | i  j o |  i | i j S(   N(   Rv   Re   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   s   |  i  |  S(   N(   R   (   Rc   Rd   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    (	   R   R   R   R   R   R   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   					t   For_r_singlefloat_values_Entryc           B   s   e  Z e Z d    Z RS(   c         C   s   d d k  l } | i   S(   Ni(   R   (   R   R   t   SomeSingleFloat(   Rc   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    (   R   R   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   t   For_r_singlefloat_type_Entryc           B   s    e  Z e Z d    Z d   Z RS(   c         O   s   d d k  l } | i   S(   Ni(   R   (   R   R   R   (   Rc   R   R   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s    c         C   sK   d d k  l } | i | i  \ } | i   | i d | g d | i S(   Ni(   R3   t   cast_primitivet
   resulttype(   R4   R3   R   t   FloatR   t   genopt   SingleFloat(   Rc   R   R3   R   (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s
    
(   R   R   R   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pyR     s   	g      (W   R   R\   R   t   pypy.rpythonR    R   R   R:   R   t   _bitst   _itestt   _LtestRH   R&   RB   R+   R,   t   LONGLONG_BITR/   R0   t   LONG_BIT_SHIFTR)   R
   R   R   R   R   R   R   R   R   t   ImportErrorR   R   R   R   R$   R.   R2   R7   t   _annspecialcase_R5   RJ   RK   RN   R]   RO   RV   RW   RY   R[   RZ   R`   R*   R@   R   R   R   R<   RQ   R   R   R   RX   RF   R1   RG   t   longlongmaxt   r_int64R   R   R   t   DTSF_STR_PRECISIONt	   DTSF_SIGNR   R   R   R   R   R   R   R   t   objectR   R   R   R   (    (    (    s)   /64/home/arigo/u/pypy/rlib/rarithmetic.pys   <module>#   s     


 

8																
					
									
		(
		5			
