@@ -32,6 +32,8 @@ msgid ""
3232"decimal floating-point arithmetic. It offers several advantages over the :"
3333"class:`float` datatype:"
3434msgstr ""
35+ ":mod:`decimal` 模組提供對快速正確捨入的十進位浮點運算的支援。相較於 :class:"
36+ "`float` 資料型別,它提供了幾個優勢:"
3537
3638#: ../../library/decimal.rst:37
3739msgid ""
@@ -41,6 +43,9 @@ msgid ""
4143"people learn at school.\" -- excerpt from the decimal arithmetic "
4244"specification."
4345msgstr ""
46+ "Decimal「基於一個以人為設計考量的浮點模型,並且必然有一個至關重要的指導原則 "
47+ "—— 電腦必須提供與人們在學校學習的算術運算方式相同的算術運算。」—— 摘自十進位"
48+ "算術規範。"
4449
4550#: ../../library/decimal.rst:42
4651msgid ""
@@ -49,6 +54,9 @@ msgid ""
4954"point. End users typically would not expect ``1.1 + 2.2`` to display as "
5055"``3.3000000000000003`` as it does with binary floating point."
5156msgstr ""
57+ "Decimal 數字可以被精確表示。相對地,像 ``1.1`` 和 ``2.2`` 這樣的數字在二進位"
58+ "浮點數中沒有精確的表示方式。終端使用者通常不會期望 ``1.1 + 2.2`` 顯示為 "
59+ "``3.3000000000000003``,但這正是二進位浮點數的表現。"
5260
5361#: ../../library/decimal.rst:47
5462msgid ""
@@ -59,6 +67,10 @@ msgid ""
5967"accumulate. For this reason, decimal is preferred in accounting applications "
6068"which have strict equality invariants."
6169msgstr ""
70+ "精確性延續到算術運算中。在十進位浮點數中,``0.1 + 0.1 + 0.1 - 0.3`` 完全"
71+ "等於零。在二進位浮點數中,結果是 ``5.5511151231257827e-017``。雖然接近零,"
72+ "但這些差異會妨礙可靠的相等性測試,並且差異可能累積。因此,在具有嚴格相等"
73+ "不變量的會計應用程式中,decimal 是首選。"
6274
6375#: ../../library/decimal.rst:54
6476msgid ""
@@ -69,13 +81,19 @@ msgid ""
6981"multiplicands. For instance, ``1.3 * 1.2`` gives ``1.56`` while ``1.30 * "
7082"1.20`` gives ``1.5600``."
7183msgstr ""
84+ "decimal 模組納入了有效位數的概念,使得 ``1.30 + 1.20`` 等於 ``2.50``。尾隨"
85+ "零被保留以表示有效性。這是金融應用程式的慣例表示法。對於乘法,「課本」方法"
86+ "使用被乘數中的所有數字。例如,``1.3 * 1.2`` 得到 ``1.56``,而 ``1.30 * "
87+ "1.20`` 得到 ``1.5600``。"
7288
7389#: ../../library/decimal.rst:61
7490msgid ""
7591"Unlike hardware based binary floating point, the decimal module has a user "
7692"alterable precision (defaulting to 28 places) which can be as large as "
7793"needed for a given problem:"
7894msgstr ""
95+ "與基於硬體的二進位浮點數不同,decimal 模組具有使用者可變的精度(預設為 28 位),"
96+ "可以根據給定問題的需要設定得足夠大:"
7997
8098#: ../../library/decimal.rst:73
8199msgid ""
@@ -86,6 +104,10 @@ msgid ""
86104"signal handling. This includes an option to enforce exact arithmetic by "
87105"using exceptions to block any inexact operations."
88106msgstr ""
107+ "二進位和十進位浮點數都是根據已發布的標準實作的。雖然內建的 float 型別只"
108+ "暴露其功能的一小部分,但 decimal 模組暴露了標準的所有必要部分。必要時,"
109+ "程式設計師對捨入和訊號處理有完全的控制權。這包括透過使用例外來阻止任何"
110+ "不精確運算以強制執行精確算術的選項。"
89111
90112#: ../../library/decimal.rst:80
91113msgid ""
@@ -94,12 +116,15 @@ msgid ""
94116"rounded floating-point arithmetic.\" -- excerpt from the decimal arithmetic "
95117"specification."
96118msgstr ""
119+ "decimal 模組被設計為支援「無偏見地支援精確的未捨入十進位算術(有時稱為定點"
120+ "算術)和捨入浮點算術。」—— 摘自十進位算術規範。"
97121
98122#: ../../library/decimal.rst:85
99123msgid ""
100124"The module design is centered around three concepts: the decimal number, "
101125"the context for arithmetic, and signals."
102126msgstr ""
127+ "模組設計圍繞三個概念:decimal 數字、算術情境和訊號。"
103128
104129#: ../../library/decimal.rst:88
105130msgid ""
@@ -109,6 +134,9 @@ msgid ""
109134"``-Infinity``, and ``NaN``. The standard also differentiates ``-0`` from "
110135"``+0``."
111136msgstr ""
137+ "decimal 數字是不可變的。它有符號、係數數字和指數。為了保持有效性,係數數字"
138+ "不會截斷尾隨零。Decimal 也包含特殊值,如 ``Infinity``、``-Infinity`` 和 "
139+ "``NaN``。標準也區分 ``-0`` 和 ``+0``。"
112140
113141#: ../../library/decimal.rst:94
114142msgid ""
@@ -119,6 +147,11 @@ msgid ""
119147"`ROUND_FLOOR`, :const:`ROUND_HALF_DOWN`, :const:`ROUND_HALF_EVEN`, :const:"
120148"`ROUND_HALF_UP`, :const:`ROUND_UP`, and :const:`ROUND_05UP`."
121149msgstr ""
150+ "算術情境是一個指定精度、捨入規則、指數限制、指示運算結果的旗標,以及決定"
151+ "訊號是否被視為例外的陷阱啟用器的環境。捨入選項包括 :const:`ROUND_CEILING`、"
152+ ":const:`ROUND_DOWN`、:const:`ROUND_FLOOR`、:const:`ROUND_HALF_DOWN`、:const:"
153+ "`ROUND_HALF_EVEN`、:const:`ROUND_HALF_UP`、:const:`ROUND_UP` 和 :const:"
154+ "`ROUND_05UP`。"
122155
123156#: ../../library/decimal.rst:101
124157msgid ""
@@ -130,6 +163,11 @@ msgid ""
130163"`Subnormal`, :const:`Overflow`, :const:`Underflow` and :const:"
131164"`FloatOperation`."
132165msgstr ""
166+ "訊號是在計算過程中產生的例外條件群組。根據應用程式的需求,訊號可能被忽略、"
167+ "視為資訊性質,或被視為例外。decimal 模組中的訊號包括::const:`Clamped`、"
168+ ":const:`InvalidOperation`、:const:`DivisionByZero`、:const:`Inexact`、:const:"
169+ "`Rounded`、:const:`Subnormal`、:const:`Overflow`、:const:`Underflow` 和 "
170+ ":const:`FloatOperation`。"
133171
134172#: ../../library/decimal.rst:108
135173msgid ""
@@ -138,12 +176,17 @@ msgid ""
138176"one, an exception is raised. Flags are sticky, so the user needs to reset "
139177"them before monitoring a calculation."
140178msgstr ""
179+ "每個訊號都有一個旗標和一個陷阱啟用器。當遇到訊號時,其旗標被設定為一,然後,"
180+ "如果陷阱啟用器被設定為一,就會引發例外。旗標是黏性的,因此使用者需要在監控"
181+ "計算之前重設它們。"
141182
142183#: ../../library/decimal.rst:116
143184msgid ""
144185"IBM's General Decimal Arithmetic Specification, `The General Decimal "
145186"Arithmetic Specification <https://speleotrove.com/decimal/decarith.html>`_."
146187msgstr ""
188+ "IBM 的一般十進位算術規範,`一般十進位算術規範 "
189+ "<https://speleotrove.com/decimal/decarith.html>`_。"
147190
148191#: ../../library/decimal.rst:125
149192msgid "Quick-start tutorial"
@@ -414,6 +457,8 @@ msgid ""
414457"`ExtendedContext`. The former is especially useful for debugging because "
415458"many of the traps are enabled:"
416459msgstr ""
460+ "根據標準,:mod:`decimal` 模組提供兩個現成可用的標準情境,:const:`BasicContext` "
461+ "和 :const:`ExtendedContext`。前者特別適用於除錯,因為許多陷阱都已啟用:"
417462
418463#: ../../library/decimal.rst:275
419464msgid ""
@@ -466,6 +511,9 @@ msgid ""
466511"cleared, so it is best to clear the flags before each set of monitored "
467512"computations by using the :meth:`~Context.clear_flags` method. ::"
468513msgstr ""
514+ "情境也有訊號旗標用於監控計算過程中遇到的例外條件。旗標會保持設定狀態直到"
515+ "明確清除,因此最好在每組受監控的計算之前使用 :meth:`~Context.clear_flags` "
516+ "方法清除旗標: ::"
469517
470518#: ../../library/decimal.rst:304
471519msgid ""
@@ -491,12 +539,15 @@ msgid ""
491539"(digits beyond the context precision were thrown away) and that the result "
492540"is inexact (some of the discarded digits were non-zero)."
493541msgstr ""
542+ "*flags* 條目顯示對 pi 的有理逼近已被捨入(超出情境精度的數字被丟棄),並且"
543+ "結果是不精確的(一些被丟棄的數字非零)。"
494544
495545#: ../../library/decimal.rst:316
496546msgid ""
497547"Individual traps are set using the dictionary in the :attr:`~Context.traps` "
498548"attribute of a context:"
499549msgstr ""
550+ "個別陷阱使用情境的 :attr:`~Context.traps` 屬性中的字典設定:"
500551
501552#: ../../library/decimal.rst:319
502553msgid ""
@@ -528,6 +579,9 @@ msgid ""
528579"the bulk of the program manipulates the data no differently than with other "
529580"Python numeric types."
530581msgstr ""
582+ "大多數程式只在程式開始時調整一次目前情境。在許多應用程式中,資料在迴圈內"
583+ "透過單次轉換轉換為 :class:`Decimal`。設定情境並建立 decimal 後,程式的大部分"
584+ "操作資料的方式與其他 Python 數值型別沒有什麼不同。"
531585
532586#: ../../library/decimal.rst:343
533587msgid "Decimal objects"
@@ -745,12 +799,14 @@ msgid ""
745799"Mixed-type comparisons between :class:`Decimal` instances and other numeric "
746800"types are now fully supported."
747801msgstr ""
802+ ":class:`Decimal` 實例與其他數值型別之間的混合型別比較現在完全支援。"
748803
749804#: ../../library/decimal.rst:450
750805msgid ""
751806"In addition to the standard numeric properties, decimal floating-point "
752807"objects also have a number of specialized methods:"
753808msgstr ""
809+ "除了標準數值屬性外,decimal 浮點數物件也有許多專門的方法:"
754810
755811#: ../../library/decimal.rst:456
756812msgid ""
@@ -759,6 +815,8 @@ msgid ""
759815"returns seven. Used for determining the position of the most significant "
760816"digit with respect to the decimal point."
761817msgstr ""
818+ "在移出係數的最右邊數字直到只剩下前導數字後,回傳調整後的指數:"
819+ "``Decimal('321e+5').adjusted()`` 回傳七。用於確定最高有效數字相對於小數點的位置。"
762820
763821#: ../../library/decimal.rst:463
764822msgid ""