HEX
Server: LiteSpeed
System: Linux standart9.isimtescil.net 3.10.0-962.3.2.lve1.5.26.7.el7.x86_64 #1 SMP Wed Oct 2 07:53:12 EDT 2019 x86_64
User: karalev (5310)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //opt/alt/python37/lib64/python3.7/site-packages/numpy/core/__pycache__/machar.cpython-37.pyc
B

<�Fd%*�@s\dZddlmZmZmZdgZddlmZddlm	Z	Gdd�de
�ZedkrXe
e��dS)	z�
Machine arithmetics - determine the parameters of the
floating-point arithmetic system

Author: Pearu Peterson, September 2003

�)�division�absolute_import�print_function�MachAr)�any)�errstatec@s8eZdZdZeeedd�dfdd�Zdd�Zd	d
�ZdS)ra�

    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] usable floating value).
    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
        Same as `xmin`.
    huge : float
        Same as `xmax`.
    precision : float
        ``- int(-log10(eps))``
    resolution : float
        ``- 10**(-precision)``

    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.

    cCsd|S)Nz%24.16e�)�vrr�D/opt/alt/python37/lib64/python3.7/site-packages/numpy/core/machar.py�<lambda>d�zMachAr.<lambda>zPython floating point numberc	Cs,tdd��|�|||||�WdQRXdS)a!

        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)ZunderN)r�_do_init)�self�
float_conv�int_conv�float_to_float�float_to_str�titlerrr
�__init__bszMachAr.__init__c.Cs�d}d}|d�}||}	||}
|}xLt|�D].}||}||}
|
|}t|||
k�r.Pq.Wt|||jf��|}xLt|�D].}||}||}
||
|�}t|dk�r�Pq�Wt|||jf��|}||�}d}|}xTt|�D]6}|d}||}||}
|
|}t|||
k�r�Pq�Wt|||jf��||	}|}xPt|�D]2}||}||}
|
|}t|||
k��rDP�qDWt|||jf��||}
d}t|
||
k��r�d}||}||}
|dk�r�t|
||
k��r�d}|d}||}|}xt|�D]}||}�q�W|}xht|�D]J}||}
t|
||
k��r<P||}|d}|dk�rtdt����qWt|||jf��|}|}|d}|}xPt|�D]2}||}
t|
||
k��r�P||}|d}�q�Wt|||jf��|}d}||}
|dk�rt|
|||
k��rd}d}d}|}||} d}!x�t|�D]t}|}"|"|"}||}|| }
t|||
k��s�tt|�|"k��r�P|
|}t|||k��r�P|d}||}�q<Wt|||jf��|d	k�r�|d}#||}$n6d}#|}%x ||%k�r
|%|}%|#d}#�q�W|%|%d}$x�t|�D]�}|"}&|"|}"|"|}|"| }
t|||
k��r�tt|"�|&k��r�|d}|
|}t|||"k��r�t|
|"k��r�d}!|"}&PnP�q"Wt|||jf��|}'|$||dk�r�|d	k�r�|$|$}$|#d}#|$|'}(||!}|dk�r|(d}(|(|'}|dk�r0|�s0|(d}(|d
k�rB|(d}(t||"k��rX|(d}(||})t|)||)k��r~|||})|)|&|||})|(|'d}x.t|�D]"}*|dk�r�|)|)})n|)|})�q�W||_||_||_||�|_	||�|_
||_||�|_||�|_
||_|#|_|'|_||&�|_||&�|_|(|_||)�|_||)�|_||_||_|j|_|j|_|j|_ddl}+t|+�||j���|_|	|	|	|	|	},|,|j}-||-�|_||-�|_ dS)Ni'z'Did not converge after %d tries with %s�r�����zAcould not determine machine tolerance for 'negep', locals() -> %s�
�)!�ranger�RuntimeErrorZdtype�locals�abs�ibeta�it�negep�epsnegZ_str_epsneg�machep�epsZ_str_eps�ngrd�iexp�minexp�xminZ	_str_xmin�maxexp�xmaxZ	_str_xmax�irndr�epsilonZtinyZhuge�math�intZlog10Z	precision�
resolutionZ_str_resolution).rrrrrrZ	max_iterN�msgZoneZtwoZzero�a�_ZtempZtemp1�bZitempr Zbetar!Zbetahr,Ztempar"Zbetain�ir#r$r%r&�k�z�tZnxres�yr'ZmxZizr)r(r*r+�jr.Ztenr0rrr
rts\

 $

$ 












zMachAr._do_initcCsd}||jS)Na�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)
---------------------------------------------------------------------
)�__dict__)rZfmtrrr
�__str__Gs	zMachAr.__str__N)	�__name__�
__module__�__qualname__�__doc__�floatr/rrr<rrrr
rsOT�__main__N)r@Z
__future__rrr�__all__Znumpy.core.fromnumericrZnumpy.core.numericr�objectrr=�printrrrr
�<module>sF