@@ -315,6 +315,8 @@ msgid ""
315315"Fortran, and many others) often won't display the exact decimal number you "
316316"expect."
317317msgstr ""
318+ ":dfn:`表示性错误` 是指某些(其实是大多数)十进制小数无法以二进制(以 2 为基数的计数制)精确表示这一事实造成的错误。 这就是为什么 "
319+ "Python(或者 Perl、C、C++、Java、Fortran 以及许多其他语言)经常不会显示你所期待的精确十进制数值的主要原因。"
318320
319321#: ../../tutorial/floatingpoint.rst:220
320322msgid ""
@@ -325,58 +327,64 @@ msgid ""
325327" to convert 0.1 to the closest fraction it can of the form *J*/2**\\ *N* "
326328"where *J* is an integer containing exactly 53 bits. Rewriting ::"
327329msgstr ""
330+ "为什么会这样? 1/10 是无法用二进制小数精确表示的。 目前(2000年11月)几乎所有使用 IEEE-754 "
331+ "浮点运算标准的机器以及几乎所有系统平台都会将 Python 浮点数映射为 IEEE-754 “双精度类型”。 754 双精度类型包含 53 "
332+ "位精度,因此在输入时,计算会尽量将 0.1 转换为以 *J*/2**\\ *N* 形式所能表示的最接近分数,其中 *J* 为恰好包含 53 "
333+ "个二进制位的整数。 重新将 ::"
328334
329335#: ../../tutorial/floatingpoint.rst:229
330336msgid "as ::"
331- msgstr ""
337+ msgstr "写为 :: "
332338
333339#: ../../tutorial/floatingpoint.rst:233
334340msgid ""
335341"and recalling that *J* has exactly 53 bits (is ``>= 2**52`` but ``< "
336342"2**53``), the best value for *N* is 56::"
337- msgstr ""
343+ msgstr "并且由于 *J* 恰好有 53 位 (即 ``>= 2**52`` 但 ``< 2**53``),*N* 的最佳值为 56:: "
338344
339345#: ../../tutorial/floatingpoint.rst:239
340346msgid ""
341347"That is, 56 is the only value for *N* that leaves *J* with exactly 53 bits."
342348" The best possible value for *J* is then that quotient rounded::"
343- msgstr ""
349+ msgstr "也就是说,56 是唯一的 *N* 值能令 *J* 恰好有 53 位。 这样 *J* 的最佳可能值就是经过舍入的商:: "
344350
345351#: ../../tutorial/floatingpoint.rst:246
346352msgid ""
347353"Since the remainder is more than half of 10, the best approximation is "
348354"obtained by rounding up::"
349- msgstr ""
355+ msgstr "由于余数超过 10 的一半,最佳近似值可通过四舍五入获得:: "
350356
351357#: ../../tutorial/floatingpoint.rst:252
352358msgid ""
353359"Therefore the best possible approximation to 1/10 in 754 double precision "
354360"is::"
355- msgstr ""
361+ msgstr "这样在 754 双精度下 1/10 的最佳近似值为:: "
356362
357363#: ../../tutorial/floatingpoint.rst:256
358364msgid ""
359365"Dividing both the numerator and denominator by two reduces the fraction to::"
360- msgstr ""
366+ msgstr "分子和分母都除以二则结果小数为:: "
361367
362368#: ../../tutorial/floatingpoint.rst:260
363369msgid ""
364370"Note that since we rounded up, this is actually a little bit larger than "
365371"1/10; if we had not rounded up, the quotient would have been a little bit "
366372"smaller than 1/10. But in no case can it be *exactly* 1/10!"
367373msgstr ""
374+ "请注意由于我们做了向上舍入,这个结果实际上略大于 1/10;如果我们没有向上舍入,则商将会略小于 1/10。 但无论如何它都不会是 *精确的* "
375+ "1/10!"
368376
369377#: ../../tutorial/floatingpoint.rst:264
370378msgid ""
371379"So the computer never \" sees\" 1/10: what it sees is the exact fraction "
372380"given above, the best 754 double approximation it can get::"
373- msgstr ""
381+ msgstr "因此计算永远不会“看到”1/10:它实际看到的就是上面所给出的小数,它所能达到的最佳 754 双精度近似值:: "
374382
375383#: ../../tutorial/floatingpoint.rst:270
376384msgid ""
377385"If we multiply that fraction by 10\\ *\\ *55, we can see the value out to 55 "
378386"decimal digits::"
379- msgstr ""
387+ msgstr "如果我们将该小数乘以 10 \\ * \\ *55,我们可以看到该值输出为 55 位的十进制数:: "
380388
381389#: ../../tutorial/floatingpoint.rst:276
382390msgid ""
@@ -385,9 +393,12 @@ msgid ""
385393" displaying the full decimal value, many languages (including older versions"
386394" of Python), round the result to 17 significant digits::"
387395msgstr ""
396+ "这意味着存储在计算机中的确切数值等于十进制数值 "
397+ "0.1000000000000000055511151231257827021181583404541015625。 许多语言(包括较旧版本的 "
398+ "Python)都不会显示这个完整的十进制数值,而是将结果舍入为 17 位有效数字::"
388399
389400#: ../../tutorial/floatingpoint.rst:284
390401msgid ""
391402"The :mod:`fractions` and :mod:`decimal` modules make these calculations "
392403"easy::"
393- msgstr ""
404+ msgstr ":mod:`fractions` 和 :mod:`decimal` 模块可令进行此类计算更加容易:: "
0 commit comments