1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
Ë
Kñúh”.ãó`—dZdgZddlmZddlmZGd„d«Zedk(ree««yy)z€
Machine arithmetic - determine the parameters of the
floating-point arithmetic system
 
Author: Pearu Peterson, September 2003
 
ÚMachAré)Úerrstate)Úanycó0—eZdZdZeeed„dfd„Zd„Zd„Zy)raw
    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ó
—|d›S)Nz24.16e©)Úvs úFH:\Change_password\venv_build\Lib\site-packages\numpy/_core/_machar.pyú<lambda>zMachAr.<lambda>is
€¨1¨V¨*€ózPython floating point numbercóp—td¬«5|j|||||«ddd«y#1swYyxYw)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Útitles      r
Ú__init__zMachAr.__init__gs9€ô˜HÔ %ñ    UØ M‰M˜* h°À ÈeÔ T÷    U÷    Uñ    Uús,¬5có² —d}d}|d«}||z}    ||z
}
|} t|«D]$} | | z} | |z} | | z
}t||z
|
k7«sŒ$nt| |jfz«‚|}t|«D]'} ||z}| |z} || | z
«}t|dk7«sŒ'nt|| |jfz«‚|}||«}d}|}t|«D])} |dz}||z}||z} | |z
}t||z
|
k7«sŒ)nt|| |jfz«‚||    z }|} t|«D]$} | | z} | |z} | | z
}t||z
|
k7«sŒ$nt|| |jfz«‚| |z} d}t| | z
|
k7«rd}| |z}||z} |dk(rt| |z
|
k7«rd}|dz}||z }|} t|«D]}| |z} Œ    | }t|«D]?} || z
} t| |z
|
k7«rnA| |z} |dz
}|dksŒ+tdt    «z«‚t|| |jfz«‚| }| }| dz
}|} t|«D]$} || z} t| |z
|
k7«rn&| |z} |dz}Œ&t|| |jfz«‚| }d}||z} |dk(rt| |z|z
|
k7«rd}d}d}|}||z} d}!t|«D]_} |}"|"|"z}||z} || z} t| | z|
k(«stt |«|"k\«rn>| |z}t||z|k(«rn&|dz}||z}Œat|| |jfz«‚|d    k7r |dz}#||z}$n!d}#|}%||%k\r|%|z}%|#dz}#||%k\rŒ|%|%zdz
}$t|«D]m} |"}&|"|z}"|"|z} |"| z} t| | z|
k7«rHtt |"«|&k«r1|dz}| |z}t||z|"k(«sŒXt| |"k7«sŒgd}!|"}&nnt|| |jfz«‚| }'|$||zdz
kr|d    k7r
|$|$z}$|#dz}#|$|'z}(||!z}|dk\r|(dz
}(|(|'z}|dk(r|s|(dz
}(|d
kDr|(dz
}(t| |"k7«r|(dz
}(||z
})t|)|z|)k7«r|||zz
})|)|&|z|z|zz })|(|'zdz}t|«D]}*|dk(r|)|)z})Œ|)|z})Œt |&||zz «}+||_||_||_||«|_    ||«|_
||_ ||«|_ ||«|_ ||_|#|_|'|_||&«|_||&«|_|(|_||)«|_||)«|_||_||_|j|_|j"|_|j(|_|j"|_||j"«|_||+«|_||+«|_ddl},tA|,jC||j«« «|_"|    |    z|    z|    z|    z}-|-|jD z}.||.«|_#||.«|_$y) Ni'z'Did not converge after %d tries with %srééÿÿÿÿéé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Úsmallest_normalÚ_str_smallest_normalÚsmallest_subnormalÚ_str_smallest_subnormalÚmathÚintÚlog10Ú    precisionÚ
resolutionÚ_str_resolution)/rrrrrrÚ    max_iterNÚmsgÚoneÚtwoÚzeroÚaÚ_ÚtempÚtemp1ÚbÚitempr$Úbetar%Úbetahr4Útempar&ÚbetainÚir'r)r*r,ÚkÚzÚtÚnxresÚyr-ÚmxÚizr/r.r1r2Újr:r<Útenr@s/                                               r
rzMachAr._do_initys݀؈    Ø7ˆÙ˜‹mˆØC‰iˆØS‰yˆð ˆÜyÓ!ò    5ˆAؐA‘ˆAؐs‘7ˆDؘ1‘HˆEܐ5˜3‘; $Ñ&Õ'Ùð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4Ø ˆÜyÓ!ò    5ˆAؐA‘ˆAؐq‘5ˆDÙ˜T A™XÓ&ˆEܐ5˜A‘:Ùð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4؈٘%Ó ˆðˆØ ˆÜyÓ!ò    5ˆAؐa‘ˆBؐD‘ˆAؐs‘7ˆDؘ1‘HˆEܐ5˜3‘; $Ñ&Õ'Ùð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4às‘
ˆØ ˆÜyÓ!ò    5ˆAؐA‘ˆAؐs‘7ˆDؘ1‘HˆEܐ5˜3‘; $Ñ&Õ'Ùð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4ؐ5‰yˆØˆÜ ˆta‰x˜4ÑÔ  ØˆDؐD‘ˆØu‰}ˆØ 1Š9œ˜T E™\¨TÑ1Ô2؈DðQ‘ˆØt‘ˆØ ˆÜu“ò    ˆAؐF‘
‰Að    à ˆÜyÓ!ò     5ˆAؘ‘7ˆDܐ4˜#‘: Ñ%Ô&ÙØD‘ˆAؘA‘IˆEàq‹yÜ"ð$AÜDJÃHñ$NóOðOð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4ؐˆØˆð˜‘ˆØ ˆäyÓ!ò    5ˆAؘ‘7ˆDܐ4˜#‘: Ñ%Ô&ÙØD‘ˆAؘa‘Z‰Fð     5ô˜s a¨¯© ^Ñ3Ó4Ð 4ØˆðˆØS‰yˆØ 1Š9œ˜T C™Z¨#Ñ-°Ñ5Ô6؈Dð ˆØ ˆØ ˆØ #‰IˆØˆÜyÓ!ò     5ˆA؈AؐA‘ˆAؐC‘ˆAؐq‘5ˆDܐ1q‘5˜D‘=Ô!¤S¬¨Q«°1©Ô%5ÙØ˜6‘MˆEܐ5˜4‘< 1Ñ$Ô%ÙØA‘ˆAؐA‘‰Að     5ô˜s a¨¯© ^Ñ3Ó4Ð 4Ø BŠ;ؐq‘5ˆDؐQ‘‰BàˆD؈Bؐr’'ؘ%‘ZØ˜a‘xðr“'ðb‘˜1‘ˆBôyÓ!ò    5ˆA؈DؐF‘
ˆAؐC‘ˆAؐq‘5ˆDܐA˜‘E˜d‘?Ô#¬¬C°«F°T©MÔ(:ؘ‘EØ˜v™ Üu˜t‘| qÑ(Õ)¬c°$¸!±)­nؐEؐDÙáð    5ô˜s a¨¯© ^Ñ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ˆŒØC‰i˜#‰o Ñ# cÑ)ˆØ˜dŸn™n˜_Ñ-ˆ
Ù(¨Ó4ˆŒÙ+¨JÓ7ˆÕr có$—d}||jzS)NaCMachine 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__zMachAr.__str__Rs€ð     Uð     ðT—]‘]Ñ"Ð"r N)    Ú__name__Ú
__module__Ú __qualname__Ú__doc__Úfloatr=rrr^rr r
rrs+„ñTðl#(°#Ø %Ù5Ø5óUò$W8ór #r Ú__main__N)    rbÚ__all__Ú _ufunc_configrÚ fromnumericrrr_Úprintrr r
ú<module>ris>ðñð ˆ*€å#Ý÷
O#ñO#ðd
 ˆzÒÙ    ‰&‹(…Oðr