ó
_xTc           @   s£   d  d l  m Z d  d l Z d  d l m Z d  d l m Z m Z d  d l	 m
 Z
 d  d l Z d  d l Z d   Z d   Z e d k r e d	 e j d
  n  d S(   i’’’’(   t   divisionN(   t   flex(   t   Exception_expectedt   approx_equal(   t   format_cpu_timesc         C   sw  t  j d d  } | j d |   d d } | j   } d GHt j   } x) t |  D] } t j j d |  } qV Wd t j   | GHx# t |  D] } t  j	 |  } q Wd	 t j   | GHt j   } x# t |  D] } t  j	 |  }	 qŚ Wd
 t j   | GH|	 j
 d  st  xU | | g D]G }
 t  j t  j |
 j   |	 |	   } t | d d d s(t  q(Wd  S(   Nt   seedi    t   sizeid   i2   s   showing wall clock times!t   array_of_floats   jacks_expf(): %.2f ss   std::exp(float): %.2f ss   std::exp(double): %.2f st   epsgńhćµųä>(   R   t   mersenne_twistert   random_doublet   as_floatt   timet   xranget   scitbxt   matht
   jacks_expft   expt   all_gtt   AssertionErrort   maxt   abst	   as_doubleR   (   t   n_argumentst   n_iterationst   mtt   dt   ft   t0t   i_iterationt   jeft   seft   sedt   eft   max_rel_err(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/scitbx/math/tests/tst_exp_functions.pyt   exercise_with_random_arguments	   s&    &c         C   s{  |  g  d g g k s t   t |   d k r6 t } n t } | su d } d } d d d d d d	 g } d } d
 } n' d
 } d } t d d  } d } d
 } t d | d |  x½ t t g D]Æ } x¦ | D] } | rŻ | GHn  y? t j j d | d | d | d |  }	 | rt	 |	  GHn  WqÉ t
 k
 rW}
 t |
  d k sFt   | sSt   PqÉ XqÉ W| s¼ t  q¼ q¼ Wt   GHd  S(   Ns   --comprehensivei    i  i
   i’’’i’’’’i   i   i   ią i   i   R   R   t   negative_signt   exponentt   mantissa_step_sizet   j_samples-   jacks_expf(): function argument out of range.(   R   t   lent   Falset   Truet   rangeR#   R   R   t   exercise_jacks_expft   listt   RuntimeErrort   strR   R   (   t   argst   comprehensiveR   R   t	   exponentsR&   R'   R$   R%   t   rt   e(    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/scitbx/math/tests/tst_exp_functions.pyt   run   sJ    		 	 	t   __main__R0   i   (   t
   __future__R    t   scitbx.mathR   t   scitbx.array_familyR   t   libtbx.test_utilsR   R   t   libtbx.utilsR   R   t   sysR#   R5   t   __name__t   argv(    (    (    sQ   /public2/ftp/pub/ccp4/6.5/ccp4-6.5/lib/py2/scitbx/math/tests/tst_exp_functions.pyt   <module>   s   		)