+
    ÖÍi1-  ã                   óh   € R t R.t^RIHt ^RIHt  ! R R4      t]R8X  d   ]! ]! 4       4       R# R# )z€
Machine arithmetic - determine the parameters of the
floating-point arithmetic system

Author: Pearu Peterson, September 2003

ÚMachAr)Úerrstate)Úanyc                   óF   a € ] tR t^t o Rt]]]R R3R ltR tR t	Rt
V tR# )	r   a;  
Diagnosing machine parameters.

Attributes
----------
ibeta : int
    Radix in which numbers are represented.
it : int
    Number of base-`ibeta` digits in the floating point mantissa M.
machep : int
    Exponent of the smallest (most negative) power of `ibeta` that,
    added to 1.0, gives something different from 1.0
eps : float
    Floating-point number ``beta**machep`` (floating point precision)
negep : int
    Exponent of the smallest power of `ibeta` that, subtracted
    from 1.0, gives something different from 1.0.
epsneg : float
    Floating-point number ``beta**negep``.
iexp : int
    Number of bits in the exponent (including its sign and bias).
minexp : int
    Smallest (most negative) power of `ibeta` consistent with there
    being no leading zeros in the mantissa.
xmin : float
    Floating-point number ``beta**minexp`` (the smallest [in
    magnitude] positive floating point number with full precision).
maxexp : int
    Smallest (positive) power of `ibeta` that causes overflow.
xmax : float
    ``(1-epsneg) * beta**maxexp`` (the largest [in magnitude]
    usable floating value).
irnd : int
    In ``range(6)``, information on what kind of rounding is done
    in addition, and on how underflow is handled.
ngrd : int
    Number of 'guard digits' used when truncating the product
    of two mantissas to fit the representation.
epsilon : float
    Same as `eps`.
tiny : float
    An alias for `smallest_normal`, kept for backwards compatibility.
huge : float
    Same as `xmax`.
precision : float
    ``- int(-log10(eps))``
resolution : float
    ``- 10**(-precision)``
smallest_normal : float
    The smallest positive floating point number with 1 as leading bit in
    the mantissa following IEEE-754. Same as `xmin`.
smallest_subnormal : float
    The smallest positive floating point number with 0 as leading bit in
    the mantissa following IEEE-754.

Parameters
----------
float_conv : function, optional
    Function that converts an integer or integer array to a float
    or float array. Default is `float`.
int_conv : function, optional
    Function that converts a float or float array to an integer or
    integer array. Default is `int`.
float_to_float : function, optional
    Function that converts a float array to float. Default is `float`.
    Note that this does not seem to do anything useful in the current
    implementation.
float_to_str : function, optional
    Function that converts a single float to a string. Default is
    ``lambda v:'%24.16e' %v``.
title : str, optional
    Title that is printed in the string representation of `MachAr`.

See Also
--------
finfo : Machine limits for floating point types.
iinfo : Machine limits for integer types.

References
----------
.. [1] Press, Teukolsky, Vetterling and Flannery,
       "Numerical Recipes in C++," 2nd ed,
       Cambridge University Press, 2002, p. 31.

c                ó
   € V R  # )z24.16e© )Úvs   &Ú5/usr/lib/python3/dist-packages/numpy/_core/_machar.pyÚ<lambda>ÚMachAr.<lambda>i   s
   € ¨1¨V¨*¨ó    zPython floating point numberc           	     óŽ   € \        RR7      ;_uu_ 4        V P                  WW4V4       RRR4       R#   + '       g   i     R# ; i)zñ

float_conv - convert integer to float (array)
int_conv   - convert float (array) to integer
float_to_float - convert float array to float
float_to_str - convert array float to str
title        - description of used floating point numbers

Úignore)ÚunderN)r   Ú_do_init)ÚselfÚ
float_convÚint_convÚfloat_to_floatÚfloat_to_strÚtitles   &&&&&&r	   Ú__init__ÚMachAr.__init__g   s.   € ô ˜H×%Ö%Ø�M‰M˜*°ÈeÔT÷ &×%×%Ò%ús	   •3³A	c                óÆ  € R pRpV! ^4      pWˆ,           p	Wˆ,
          p
Tp\        V4       F7  pW»,           pW¸,           pWÛ,
          p\        Wè,
          V
8g  4      '       g   K7   M 	  \        VXVP                  3,          4      hTp\        V4       F7  pWÿ,           pW¿,           pV! WÛ,
          4      p\        V^ 8g  4      '       g   K7   M	  \        W|VP                  3,          4      hTpV! V4      pRpTp\        V4       FA  pV^,           pVV,          pWø,           pWß,
          p\        Wè,
          V
8g  4      '       g   KA   M	  \        W|VP                  3,          4      hVV	,          pTp\        V4       F7  pW»,           pW¸,           pWÛ,
          p\        Wè,
          V
8g  4      '       g   K7   M	  \        W|VP                  3,          4      hVV,           p^ p\        WÛ,
          V
8g  4      '       d   ^pVV,           pVV,           pV^ 8X  d   \        VV,
          V
8g  4      '       d   ^pV^,           pVV,          pTp\        V4       F  pVV,          pK  	  Tp\        V4       FZ  pW‹,
          p\        WØ,
          V
8g  4      '       d    MTVV,          pV^,
          pV^ 8  g   KB  \        R\	        4       ,          4      h	  \        W|VP                  3,          4      hV) pTpV) ^,
          pTp\        V4       F9  pW‹,           p\        WØ,
          V
8g  4      '       d    M3VV,          pV^,           pK;  	  \        W|VP                  3,          4      hTp^ pVV,           pV^ 8X  d$   \        WØ,          V,
          V
8g  4      '       d   ^p^ p^pTpVV,           p ^ p!\        V4       F‘  pTp"V"V",          pVV,          pVV ,          p\        W»,           V
8H  4      '       g   \        \        V4      V"8¬  4      '       d    MYVV,          p\        VV,          V8H  4      '       d    M3V^,           pVV,           pK“  	  \        W|VP                  3,          4      hV^
8w  d   V^,           p#VV,           p$M/^p#Tp%VV%8¼  d   V%V,          p%V#^,           p#K  V%V%,           ^,
          p$\        V4       F¢  pT"p&V"V,          p"V"V,          pV"V ,          p\        W»,           V
8g  4      '       di   \        \        V"4      V&8  4      '       dL   V^,           pVV,          p\        VV,          V"8H  4      '       d   \        VV"8g  4      '       d   ^p!T"p& M%K   K¢   M	  \        W|VP                  3,          4      hV) p'V$VV,           ^,
          8:  d   V^
8w  d   V$V$,           p$V#^,           p#V$V',           p(VV!,           pV^8¼  d
   V(^,
          p(V(V',           pV^8X  d   V'       g
   V(^,
          p(V^8”  d
   V(^,
          p(\        VV"8g  4      '       d
   V(^,
          p(VV,
          p)\        V)V,          V)8g  4      '       d   VVV,          ,
          p)V)V&V,          V,          V,          ,          p)V(V',           ^,           p\        V4       F  p*V^8X  d   V)V),           p)K  V)V,          p)K   	  \        V&VV,          ,          4      p+VV n        VV n        VV n        V! V4      V n	        V! V4      V n
        VV n        V! V4      V n        V! V4      V n        VV n        V#V n        V'V n        V! V&4      V n        V! V&4      V n        V(V n        V! V)4      V n        V! V)4      V n        VV n        WPn        V P                  V n        V P"                  V n        V P(                  V n        V P"                  V n        V! V P"                  4      V n        V! V+4      V n        V! V+4      V n        ^ RIp,\A        V,PC                  V! V P                  4      4      ) 4      V n"        W™,           V	,           V	,           V	,           p-V-V PD                  ) ,          p.V! V.4      V n#        V! V.4      V n$        R# )i'  z'Did not converge after %d tries with %szAcould not determine machine tolerance for 'negep', locals() -> %sNéÿÿÿÿ)%Úranger   ÚRuntimeErrorÚdtypeÚlocalsÚabsÚibetaÚitÚnegepÚepsnegÚ_str_epsnegÚmachepÚepsÚ_str_epsÚngrdÚiexpÚminexpÚxminÚ	_str_xminÚmaxexpÚxmaxÚ	_str_xmaxÚirndr   ÚepsilonÚtinyÚhugeÚsmallest_normalÚ_str_smallest_normalÚsmallest_subnormalÚ_str_smallest_subnormalÚmathÚintÚlog10Ú	precisionÚ
resolutionÚ_str_resolution)/r   r   r   r   r   r   Ú	max_iterNÚmsgÚoneÚtwoÚzeroÚaÚ_ÚtempÚtemp1ÚbÚitempr    Úbetar!   Úbetahr0   Útempar"   ÚbetainÚir#   r%   r&   r(   ÚkÚzÚtÚnxresÚyr)   ÚmxÚizr+   r*   r-   r.   Újr6   r8   Útenr<   s/   &&&&&&                                         r	   r   ÚMachAr._do_inity   s›  € Øˆ	Ø7ˆÙ˜‹mˆØ�iˆØ�yˆð ˆÜ�yÖ!ˆAØ•ˆAØ•7ˆDØ•HˆEÜ�5•; $Ñ&×'Ô'Ùñ "ô ˜s a¨¯© ^Õ3Ó4Ð4ØˆÜ�yÖ!ˆAØ•ˆAØ•5ˆDÙ˜T�XÓ&ˆEÜ�5˜A‘:�ŒÙñ "ô ˜s¨¯© ^Õ3Ó4Ð4ØˆÙ˜%Ó ˆð ˆØˆÜ�yÖ!ˆAØ�a•ˆBØ�D•ˆAØ•7ˆDØ•HˆEÜ�5•; $Ñ&×'Ô'Ùñ "ô ˜s¨¯© ^Õ3Ó4Ð4à�s•
ˆØˆÜ�yÖ!ˆAØ•ˆAØ•7ˆDØ•HˆEÜ�5•; $Ñ&×'Ô'Ùñ "ô ˜s¨¯© ^Õ3Ó4Ð4Ø�5�yˆØˆÜˆt�x˜4Ñ× Ò ØˆDØ�D•ˆØ�u�}ˆØ�1Œ9œ˜T E�\¨TÑ1×2Ò2ØˆDð �Q•ˆØ�t•ˆØˆÜ�u–ˆAØ�F•
ŠAñ àˆÜ�yÖ!ˆAØ•7ˆDÜ�4•: Ñ%×&Ò&ÙØ�D•ˆAØ˜A•IˆEà�qŽyÜ"ð $AÜDJÃHõ$Nó Oð Oñ "ô ˜s¨¯© ^Õ3Ó4Ð4Ø�ˆØˆð �˜•ˆØˆä�yÖ!ˆAØ•7ˆDÜ�4•: Ñ%×&Ò&ÙØ�D•ˆAØ˜a•ZŠFñ "ô ˜s¨¯© ^Õ3Ó4Ð4Øˆð ˆØ�S�yˆØ�1Œ9œ˜T�Z¨#Õ-°Ñ5×6Ò6ØˆDð ˆØˆØˆØ�#�IˆØˆÜ�yÖ!ˆAØˆAØ�A•ˆAØ�C•ˆAØ�q•5ˆDÜ�1•5˜D‘=×!Ò!¤S¬¨Q«°1©×%5Ò%5ÙØ˜6•MˆEÜ�5˜4•< 1Ñ$×%Ò%ÙØ�A•ˆAØ�A•ŠAñ "ô ˜s¨¯© ^Õ3Ó4Ð4Ø�BŒ;Ø�q•5ˆDØ�Q•‰BàˆDØˆBØ�r”'Ø˜%•Z�Ø˜a•x’Ø�b•˜1•ˆBô �yÖ!ˆAØˆDØ�F•
ˆAØ�C•ˆAØ�q•5ˆDÜ�A•E˜d‘?×#Ò#¬¬C°«F°T©M×(:Ò(:Ø˜•E�Ø˜v��Ü�u˜t•| qÑ(×)Ò)¬c°$¸!±)¯nªnØ�EØ�DÙñ /=Ñ)ñ
 ñ "ô ˜s¨¯© ^Õ3Ó4Ð4Ø�ˆð ��Q•˜•Œ?˜u¨œ{Ø�b•ˆBØ˜!•8ˆDØ�f•ˆØ�e�|ˆØ�1Œ9Ø˜a•ZˆFØ�V�OˆØ�AŒ:ŸaØ˜a•ZˆFØˆrŒ6Ø˜a•ZˆFÜˆq�A‰v�;Š;Ø˜a•ZˆFØ�V�|ˆÜˆt�c�z˜TÑ!×"Ò"Ø˜ �Õ&ˆDØ�t˜d•{ TÕ)¨DÕ0Õ1ˆØ�V�O˜aÕˆÜ�q–ˆAØ˜ŒzØ˜d•{’à˜d•{’ñ	 ô ! ¨°­Õ!4Ó5ÐàˆŒ
ØˆŒØˆŒ
Ù$ VÓ,ˆŒÙ'¨Ó/ˆÔØˆŒÙ! #Ó&ˆŒÙ$ SÓ)ˆŒØˆŒ	ØˆŒ	ØˆŒÙ" 4Ó(ˆŒ	Ù% dÓ+ˆŒØˆŒÙ" 4Ó(ˆŒ	Ù% dÓ+ˆŒØˆŒ	àŒ
à—x‘xˆŒØ—I‘IˆŒ	Ø—I‘IˆŒ	Ø#Ÿy™yˆÔÙ$0°·±Ó$;ˆÔ!Ù"0Ð1CÓ"DˆÔÙ'3Ð4FÓ'GˆÔ$ãÜ˜dŸj™j©¸¿¹Ó)AÓBÐBÓCˆŒØ�i˜#�o Õ# cÕ)ˆØ˜dŸn™n˜_Õ-ˆ
Ù(¨Ó4ˆŒÙ+¨JÓ7ˆÖr   c                ó*   € R pWP                   ,          # )aC  Machine parameters for %(title)s
---------------------------------------------------------------------
ibeta=%(ibeta)s it=%(it)s iexp=%(iexp)s ngrd=%(ngrd)s irnd=%(irnd)s
machep=%(machep)s     eps=%(_str_eps)s (beta**machep == epsilon)
negep =%(negep)s  epsneg=%(_str_epsneg)s (beta**epsneg)
minexp=%(minexp)s   xmin=%(_str_xmin)s (beta**minexp == tiny)
maxexp=%(maxexp)s    xmax=%(_str_xmax)s ((1-epsneg)*beta**maxexp == huge)
smallest_normal=%(smallest_normal)s    smallest_subnormal=%(smallest_subnormal)s
---------------------------------------------------------------------
)Ú__dict__)r   Úfmts   & r	   Ú__str__ÚMachAr.__str__R  s   € ð	Uð 	ð —]‘]Õ"Ð"r   )r'   r$   r=   r5   r7   r/   r,   r&   r1   r#   r3   r    r)   r0   r!   r%   r-   r*   r"   r(   r;   r<   r4   r6   r2   r   r.   r+   N)Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Úfloatr9   r   r   r[   Ú__static_attributes__Ú__classdictcell__)Ú__classdict__s   @r	   r   r      s3   ø‡ € ñTðl #(°#Ø %Ù5Ø5ôUò$W8÷r#ð #r   Ú__main__N)	ra   Ú__all__Ú_ufunc_configr   Úfromnumericr   r   r]   Úprintr   r   r	   Ú<module>rk      s>   ðñð ˆ*€å #Ý ÷
O#ñ O#ðd
 ˆzÔÙ	‰&‹(†Oñ r   