|
| 1 | +# SOME DESCRIPTIVE TITLE. |
| 2 | +# Copyright (C) 2001-2021, Python Software Foundation |
| 3 | +# This file is distributed under the same license as the Python package. |
| 4 | +# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR. |
| 5 | +# |
| 6 | +# Translators: |
| 7 | +# Ciarbin Ciarbin <mrciarbin@gmail.com>, 2021 |
| 8 | +# |
| 9 | +#, fuzzy |
| 10 | +msgid "" |
| 11 | +msgstr "" |
| 12 | +"Project-Id-Version: Python 3.9\n" |
| 13 | +"Report-Msgid-Bugs-To: \n" |
| 14 | +"POT-Creation-Date: 2021-01-01 05:02+0000\n" |
| 15 | +"PO-Revision-Date: 2017-02-16 23:40+0000\n" |
| 16 | +"Last-Translator: Ciarbin Ciarbin <mrciarbin@gmail.com>, 2021\n" |
| 17 | +"Language-Team: Polish (https://www.transifex.com/python-doc/teams/5390/pl/)\n" |
| 18 | +"MIME-Version: 1.0\n" |
| 19 | +"Content-Type: text/plain; charset=UTF-8\n" |
| 20 | +"Content-Transfer-Encoding: 8bit\n" |
| 21 | +"Language: pl\n" |
| 22 | +"Plural-Forms: nplurals=4; plural=(n==1 ? 0 : (n%10>=2 && n%10<=4) && (n" |
| 23 | +"%100<12 || n%100>14) ? 1 : n!=1 && (n%10>=0 && n%10<=1) || (n%10>=5 && n" |
| 24 | +"%10<=9) || (n%100>=12 && n%100<=14) ? 2 : 3);\n" |
| 25 | + |
| 26 | +msgid "Floating Point Arithmetic: Issues and Limitations" |
| 27 | +msgstr "Arytmetyka liczb zmiennoprzecinkowych: Problemy i ograniczenia" |
| 28 | + |
| 29 | +msgid "" |
| 30 | +"Floating-point numbers are represented in computer hardware as base 2 " |
| 31 | +"(binary) fractions. For example, the decimal fraction ::" |
| 32 | +msgstr "" |
| 33 | +"Liczby zmiennoprzecinkowe są reprezentowane w systemie komputerowym jako " |
| 34 | +"ułamki o podstawie 2 (binarne). Na przykład, ułamek dziesiętny ::" |
| 35 | + |
| 36 | +msgid "" |
| 37 | +"has value 1/10 + 2/100 + 5/1000, and in the same way the binary fraction ::" |
| 38 | +msgstr "" |
| 39 | + |
| 40 | +msgid "" |
| 41 | +"has value 0/2 + 0/4 + 1/8. These two fractions have identical values, the " |
| 42 | +"only real difference being that the first is written in base 10 fractional " |
| 43 | +"notation, and the second in base 2." |
| 44 | +msgstr "" |
| 45 | + |
| 46 | +msgid "" |
| 47 | +"Unfortunately, most decimal fractions cannot be represented exactly as " |
| 48 | +"binary fractions. A consequence is that, in general, the decimal floating-" |
| 49 | +"point numbers you enter are only approximated by the binary floating-point " |
| 50 | +"numbers actually stored in the machine." |
| 51 | +msgstr "" |
| 52 | + |
| 53 | +msgid "" |
| 54 | +"The problem is easier to understand at first in base 10. Consider the " |
| 55 | +"fraction 1/3. You can approximate that as a base 10 fraction::" |
| 56 | +msgstr "" |
| 57 | + |
| 58 | +msgid "or, better, ::" |
| 59 | +msgstr "" |
| 60 | + |
| 61 | +msgid "" |
| 62 | +"and so on. No matter how many digits you're willing to write down, the " |
| 63 | +"result will never be exactly 1/3, but will be an increasingly better " |
| 64 | +"approximation of 1/3." |
| 65 | +msgstr "" |
| 66 | + |
| 67 | +msgid "" |
| 68 | +"In the same way, no matter how many base 2 digits you're willing to use, the " |
| 69 | +"decimal value 0.1 cannot be represented exactly as a base 2 fraction. In " |
| 70 | +"base 2, 1/10 is the infinitely repeating fraction ::" |
| 71 | +msgstr "" |
| 72 | + |
| 73 | +msgid "" |
| 74 | +"Stop at any finite number of bits, and you get an approximation. On most " |
| 75 | +"machines today, floats are approximated using a binary fraction with the " |
| 76 | +"numerator using the first 53 bits starting with the most significant bit and " |
| 77 | +"with the denominator as a power of two. In the case of 1/10, the binary " |
| 78 | +"fraction is ``3602879701896397 / 2 ** 55`` which is close to but not exactly " |
| 79 | +"equal to the true value of 1/10." |
| 80 | +msgstr "" |
| 81 | + |
| 82 | +msgid "" |
| 83 | +"Many users are not aware of the approximation because of the way values are " |
| 84 | +"displayed. Python only prints a decimal approximation to the true decimal " |
| 85 | +"value of the binary approximation stored by the machine. On most machines, " |
| 86 | +"if Python were to print the true decimal value of the binary approximation " |
| 87 | +"stored for 0.1, it would have to display ::" |
| 88 | +msgstr "" |
| 89 | + |
| 90 | +msgid "" |
| 91 | +"That is more digits than most people find useful, so Python keeps the number " |
| 92 | +"of digits manageable by displaying a rounded value instead ::" |
| 93 | +msgstr "" |
| 94 | + |
| 95 | +msgid "" |
| 96 | +"Just remember, even though the printed result looks like the exact value of " |
| 97 | +"1/10, the actual stored value is the nearest representable binary fraction." |
| 98 | +msgstr "" |
| 99 | + |
| 100 | +msgid "" |
| 101 | +"Interestingly, there are many different decimal numbers that share the same " |
| 102 | +"nearest approximate binary fraction. For example, the numbers ``0.1`` and " |
| 103 | +"``0.10000000000000001`` and " |
| 104 | +"``0.1000000000000000055511151231257827021181583404541015625`` are all " |
| 105 | +"approximated by ``3602879701896397 / 2 ** 55``. Since all of these decimal " |
| 106 | +"values share the same approximation, any one of them could be displayed " |
| 107 | +"while still preserving the invariant ``eval(repr(x)) == x``." |
| 108 | +msgstr "" |
| 109 | + |
| 110 | +msgid "" |
| 111 | +"Historically, the Python prompt and built-in :func:`repr` function would " |
| 112 | +"choose the one with 17 significant digits, ``0.10000000000000001``. " |
| 113 | +"Starting with Python 3.1, Python (on most systems) is now able to choose the " |
| 114 | +"shortest of these and simply display ``0.1``." |
| 115 | +msgstr "" |
| 116 | + |
| 117 | +msgid "" |
| 118 | +"Note that this is in the very nature of binary floating-point: this is not a " |
| 119 | +"bug in Python, and it is not a bug in your code either. You'll see the same " |
| 120 | +"kind of thing in all languages that support your hardware's floating-point " |
| 121 | +"arithmetic (although some languages may not *display* the difference by " |
| 122 | +"default, or in all output modes)." |
| 123 | +msgstr "" |
| 124 | + |
| 125 | +msgid "" |
| 126 | +"For more pleasant output, you may wish to use string formatting to produce a " |
| 127 | +"limited number of significant digits::" |
| 128 | +msgstr "" |
| 129 | + |
| 130 | +msgid "" |
| 131 | +"It's important to realize that this is, in a real sense, an illusion: you're " |
| 132 | +"simply rounding the *display* of the true machine value." |
| 133 | +msgstr "" |
| 134 | + |
| 135 | +msgid "" |
| 136 | +"One illusion may beget another. For example, since 0.1 is not exactly 1/10, " |
| 137 | +"summing three values of 0.1 may not yield exactly 0.3, either::" |
| 138 | +msgstr "" |
| 139 | + |
| 140 | +msgid "" |
| 141 | +"Also, since the 0.1 cannot get any closer to the exact value of 1/10 and 0.3 " |
| 142 | +"cannot get any closer to the exact value of 3/10, then pre-rounding with :" |
| 143 | +"func:`round` function cannot help::" |
| 144 | +msgstr "" |
| 145 | + |
| 146 | +msgid "" |
| 147 | +"Though the numbers cannot be made closer to their intended exact values, " |
| 148 | +"the :func:`round` function can be useful for post-rounding so that results " |
| 149 | +"with inexact values become comparable to one another::" |
| 150 | +msgstr "" |
| 151 | + |
| 152 | +msgid "" |
| 153 | +"Binary floating-point arithmetic holds many surprises like this. The " |
| 154 | +"problem with \"0.1\" is explained in precise detail below, in the " |
| 155 | +"\"Representation Error\" section. See `The Perils of Floating Point <http://" |
| 156 | +"www.lahey.com/float.htm>`_ for a more complete account of other common " |
| 157 | +"surprises." |
| 158 | +msgstr "" |
| 159 | + |
| 160 | +msgid "" |
| 161 | +"As that says near the end, \"there are no easy answers.\" Still, don't be " |
| 162 | +"unduly wary of floating-point! The errors in Python float operations are " |
| 163 | +"inherited from the floating-point hardware, and on most machines are on the " |
| 164 | +"order of no more than 1 part in 2\\*\\*53 per operation. That's more than " |
| 165 | +"adequate for most tasks, but you do need to keep in mind that it's not " |
| 166 | +"decimal arithmetic and that every float operation can suffer a new rounding " |
| 167 | +"error." |
| 168 | +msgstr "" |
| 169 | + |
| 170 | +msgid "" |
| 171 | +"While pathological cases do exist, for most casual use of floating-point " |
| 172 | +"arithmetic you'll see the result you expect in the end if you simply round " |
| 173 | +"the display of your final results to the number of decimal digits you " |
| 174 | +"expect. :func:`str` usually suffices, and for finer control see the :meth:" |
| 175 | +"`str.format` method's format specifiers in :ref:`formatstrings`." |
| 176 | +msgstr "" |
| 177 | + |
| 178 | +msgid "" |
| 179 | +"For use cases which require exact decimal representation, try using the :mod:" |
| 180 | +"`decimal` module which implements decimal arithmetic suitable for accounting " |
| 181 | +"applications and high-precision applications." |
| 182 | +msgstr "" |
| 183 | + |
| 184 | +msgid "" |
| 185 | +"Another form of exact arithmetic is supported by the :mod:`fractions` module " |
| 186 | +"which implements arithmetic based on rational numbers (so the numbers like " |
| 187 | +"1/3 can be represented exactly)." |
| 188 | +msgstr "" |
| 189 | + |
| 190 | +msgid "" |
| 191 | +"If you are a heavy user of floating point operations you should take a look " |
| 192 | +"at the Numerical Python package and many other packages for mathematical and " |
| 193 | +"statistical operations supplied by the SciPy project. See <https://scipy." |
| 194 | +"org>." |
| 195 | +msgstr "" |
| 196 | + |
| 197 | +msgid "" |
| 198 | +"Python provides tools that may help on those rare occasions when you really " |
| 199 | +"*do* want to know the exact value of a float. The :meth:`float." |
| 200 | +"as_integer_ratio` method expresses the value of a float as a fraction::" |
| 201 | +msgstr "" |
| 202 | + |
| 203 | +msgid "" |
| 204 | +"Since the ratio is exact, it can be used to losslessly recreate the original " |
| 205 | +"value::" |
| 206 | +msgstr "" |
| 207 | + |
| 208 | +msgid "" |
| 209 | +"The :meth:`float.hex` method expresses a float in hexadecimal (base 16), " |
| 210 | +"again giving the exact value stored by your computer::" |
| 211 | +msgstr "" |
| 212 | + |
| 213 | +msgid "" |
| 214 | +"This precise hexadecimal representation can be used to reconstruct the float " |
| 215 | +"value exactly::" |
| 216 | +msgstr "" |
| 217 | + |
| 218 | +msgid "" |
| 219 | +"Since the representation is exact, it is useful for reliably porting values " |
| 220 | +"across different versions of Python (platform independence) and exchanging " |
| 221 | +"data with other languages that support the same format (such as Java and " |
| 222 | +"C99)." |
| 223 | +msgstr "" |
| 224 | + |
| 225 | +msgid "" |
| 226 | +"Another helpful tool is the :func:`math.fsum` function which helps mitigate " |
| 227 | +"loss-of-precision during summation. It tracks \"lost digits\" as values are " |
| 228 | +"added onto a running total. That can make a difference in overall accuracy " |
| 229 | +"so that the errors do not accumulate to the point where they affect the " |
| 230 | +"final total:" |
| 231 | +msgstr "" |
| 232 | + |
| 233 | +msgid "Representation Error" |
| 234 | +msgstr "" |
| 235 | + |
| 236 | +msgid "" |
| 237 | +"This section explains the \"0.1\" example in detail, and shows how you can " |
| 238 | +"perform an exact analysis of cases like this yourself. Basic familiarity " |
| 239 | +"with binary floating-point representation is assumed." |
| 240 | +msgstr "" |
| 241 | + |
| 242 | +msgid "" |
| 243 | +":dfn:`Representation error` refers to the fact that some (most, actually) " |
| 244 | +"decimal fractions cannot be represented exactly as binary (base 2) " |
| 245 | +"fractions. This is the chief reason why Python (or Perl, C, C++, Java, " |
| 246 | +"Fortran, and many others) often won't display the exact decimal number you " |
| 247 | +"expect." |
| 248 | +msgstr "" |
| 249 | + |
| 250 | +msgid "" |
| 251 | +"Why is that? 1/10 is not exactly representable as a binary fraction. Almost " |
| 252 | +"all machines today (November 2000) use IEEE-754 floating point arithmetic, " |
| 253 | +"and almost all platforms map Python floats to IEEE-754 \"double precision" |
| 254 | +"\". 754 doubles contain 53 bits of precision, so on input the computer " |
| 255 | +"strives to convert 0.1 to the closest fraction it can of the form *J*/2**\\ " |
| 256 | +"*N* where *J* is an integer containing exactly 53 bits. Rewriting ::" |
| 257 | +msgstr "" |
| 258 | + |
| 259 | +msgid "as ::" |
| 260 | +msgstr "" |
| 261 | + |
| 262 | +msgid "" |
| 263 | +"and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< " |
| 264 | +"2**53``), the best value for *N* is 56::" |
| 265 | +msgstr "" |
| 266 | + |
| 267 | +msgid "" |
| 268 | +"That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits. " |
| 269 | +"The best possible value for *J* is then that quotient rounded::" |
| 270 | +msgstr "" |
| 271 | + |
| 272 | +msgid "" |
| 273 | +"Since the remainder is more than half of 10, the best approximation is " |
| 274 | +"obtained by rounding up::" |
| 275 | +msgstr "" |
| 276 | + |
| 277 | +msgid "" |
| 278 | +"Therefore the best possible approximation to 1/10 in 754 double precision " |
| 279 | +"is::" |
| 280 | +msgstr "" |
| 281 | + |
| 282 | +msgid "" |
| 283 | +"Dividing both the numerator and denominator by two reduces the fraction to::" |
| 284 | +msgstr "" |
| 285 | + |
| 286 | +msgid "" |
| 287 | +"Note that since we rounded up, this is actually a little bit larger than " |
| 288 | +"1/10; if we had not rounded up, the quotient would have been a little bit " |
| 289 | +"smaller than 1/10. But in no case can it be *exactly* 1/10!" |
| 290 | +msgstr "" |
| 291 | + |
| 292 | +msgid "" |
| 293 | +"So the computer never \"sees\" 1/10: what it sees is the exact fraction " |
| 294 | +"given above, the best 754 double approximation it can get::" |
| 295 | +msgstr "" |
| 296 | + |
| 297 | +msgid "" |
| 298 | +"If we multiply that fraction by 10\\*\\*55, we can see the value out to 55 " |
| 299 | +"decimal digits::" |
| 300 | +msgstr "" |
| 301 | + |
| 302 | +msgid "" |
| 303 | +"meaning that the exact number stored in the computer is equal to the decimal " |
| 304 | +"value 0.1000000000000000055511151231257827021181583404541015625. Instead of " |
| 305 | +"displaying the full decimal value, many languages (including older versions " |
| 306 | +"of Python), round the result to 17 significant digits::" |
| 307 | +msgstr "" |
| 308 | + |
| 309 | +msgid "" |
| 310 | +"The :mod:`fractions` and :mod:`decimal` modules make these calculations " |
| 311 | +"easy::" |
| 312 | +msgstr "" |
0 commit comments