HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/numpy/core/__pycache__/machar.cpython-310.pyc
o

6��a?*�@s^dZdgZddlmZddlmZddlmZed�Gdd�d��Ze	dkr-e
e��d	Sd	S)
z�
Machine arithmetics - determine the parameters of the
floating-point arithmetic system

Author: Pearu Peterson, September 2003

�MachAr�)�any)�errstate)�
set_module�numpyc@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] 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
        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�3/usr/lib/python3/dist-packages/numpy/core/machar.py�<lambda>dszMachAr.<lambda>zPython floating point numbercCsBtdd��|�|||||�Wd�dS1swYdS)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)�underN)r�_do_init)�self�
float_conv�int_conv�float_to_float�float_to_str�titlerrr	�__init__bs"�zMachAr.__init__c.Cs�d}d}|d�}||}	||}
|}t|�D]}||}||}
|
|}t|||
k�r.n
qt|||jf��|}t|�D]}||}||}
||
|�}t|dk�rVn
q>t|||jf��|}||�}d}|}t|�D]}|d}||}||}
|
|}t|||
k�r�n
qnt|||jf��||	}|}t|�D]}||}||}
|
|}t|||
k�r�n
q�t|||jf��||}
d}t|
||
k�r�d}||}||}
|dkr�t|
||
k�r�d}|d}||}|}t|�D]}||}q�|}t|�D]&}||}
t|
||
k��rn||}|d}|dk�r&tdt����qt|||jf��|}|}|d}|}t|�D]}||}
t|
||
k��rRn||}|d}�qAt|||jf��|}d}||}
|dk�rt|
|||
k��rd}d}d}|}||} d}!t|�D]<}|}"|"|"}||}|| }
t|||
k��s�tt|�|"k��r�n"|
|}t|||k��r�n|d}||}�q�t|||jf��|d	k�r�|d}#||}$nd}#|}%||%k�r�|%|}%|#d}#||%k�s�|%|%d}$t|�D]C}|"}&|"|}"|"|}|"| }
t|||
k��rEtt|"�|&k��rE|d}|
|}t|||"k��rCt|
|"k��rCd}!|"}&n
�qn	t|||jf��|}'|$||dk�ri|d	k�ri|$|$}$|#d}#|$|'}(||!}|dk�rz|(d}(|(|'}|dk�r�|�s�|(d}(|d
k�r�|(d}(t||"k��r�|(d}(||})t|)||)k��r�|||})|)|&|||})|(|'d}t|�D]}*|dk�r�|)|)})�q�|)|})�q�||_||_||_||�|_	||�|_
||_||�|_||�|_
||_|#|_|'|_||&�|_||&�|_|(|_||)�|_||)�|_||_||_|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�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�math�int�log10�	precision�
resolution�_str_resolution).rrrrrr�	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.�jr4�tenr8rrr	r
tsl����

��
 $



�$ �











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__)r�fmtrrr	�__str__Gs�

zMachAr.__str__N)	�__name__�
__module__�__qualname__�__doc__�floatr5rr
rUrrrr	rsP
�T�__main__N)rY�__all__�numpy.core.fromnumericr�numpy.core._ufunc_configr�numpy.core.overridesrrrV�printrrrr	�<module>sF�