Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 79a8d12

Browse files
Copilotjosix
andcommitted
Complete Decimal objects section translation
Co-authored-by: josix <[email protected]>
1 parent c00eb7c commit 79a8d12

File tree

1 file changed

+51
-3
lines changed

1 file changed

+51
-3
lines changed

library/decimal.po

Lines changed: 51 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -548,11 +548,11 @@ msgstr ""
548548

549549
#: ../../library/decimal.rst:343
550550
msgid "Decimal objects"
551-
msgstr ""
551+
msgstr "Decimal 物件"
552552

553553
#: ../../library/decimal.rst:348
554554
msgid "Construct a new :class:`Decimal` object based from *value*."
555-
msgstr ""
555+
msgstr "基於 *value* 建構一個新的 :class:`Decimal` 物件。"
556556

557557
#: ../../library/decimal.rst:350
558558
msgid ""
@@ -562,6 +562,9 @@ msgid ""
562562
"after leading and trailing whitespace characters, as well as underscores "
563563
"throughout, are removed::"
564564
msgstr ""
565+
"*value* 可以是整數、字串、元組、:class:`float` 或其他 :class:`Decimal` 物件。"
566+
"如果沒有提供 *value*,則回傳 ``Decimal('0')``。如果 *value* 是字串,在移除"
567+
"前後空白字元以及整個字串中的底線後,它應該符合十進位數字字串語法::"
565568

566569
#: ../../library/decimal.rst:355
567570
msgid ""
@@ -577,6 +580,17 @@ msgid ""
577580
"numeric-value ::= decimal-part [exponent-part] | infinity\n"
578581
"numeric-string ::= [sign] numeric-value | [sign] nan"
579582
msgstr ""
583+
"sign ::= '+' | '-'\n"
584+
"digit ::= '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | "
585+
"'9'\n"
586+
"indicator ::= 'e' | 'E'\n"
587+
"digits ::= digit [digit]...\n"
588+
"decimal-part ::= digits '.' [digits] | ['.'] digits\n"
589+
"exponent-part ::= indicator [sign] digits\n"
590+
"infinity ::= 'Infinity' | 'Inf'\n"
591+
"nan ::= 'NaN' [digits] | 'sNaN' [digits]\n"
592+
"numeric-value ::= decimal-part [exponent-part] | infinity\n"
593+
"numeric-string ::= [sign] numeric-value | [sign] nan"
580594

581595
#: ../../library/decimal.rst:366
582596
msgid ""
@@ -587,6 +601,10 @@ msgid ""
587601
"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable "
588602
"spellings for positive infinity."
589603
msgstr ""
604+
"在上面出現 ``digit`` 的地方也允許其他 Unicode 十進位數字。這些包括來自各種其他"
605+
"字母表的十進位數字(例如阿拉伯-印度數字和天城數字)以及全形數字 ``'\\uff10'`` "
606+
"到 ``'\\uff19'``。大小寫不重要,所以例如 ``inf``、``Inf``、``INFINITY`` 和 "
607+
"``iNfINity`` 都是正無窮大的可接受拼寫。"
590608

591609
#: ../../library/decimal.rst:373
592610
msgid ""
@@ -595,6 +613,9 @@ msgid ""
595613
"an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), -3))`` returns "
596614
"``Decimal('1.414')``."
597615
msgstr ""
616+
"如果 *value* 是 :class:`tuple`,它應該有三個元件:一個符號(``0`` 代表正數或 "
617+
"``1`` 代表負數)、一個數字的 :class:`tuple`,以及一個整數指數。例如,"
618+
"``Decimal((0, (1, 4, 1, 4), -3))`` 回傳 ``Decimal('1.414')``。"
598619

599620
#: ../../library/decimal.rst:378
600621
msgid ""
@@ -604,6 +625,9 @@ msgid ""
604625
"``Decimal(float('1.1'))`` converts to "
605626
"``Decimal('1.100000000000000088817841970012523233890533447265625')``."
606627
msgstr ""
628+
"如果 *value* 是 :class:`float`,二進位浮點數值會被無損轉換為其精確的十進位"
629+
"等價值。這種轉換通常需要 53 位或更多位數的精度。例如,``Decimal(float('1.1'))`` "
630+
"轉換為 ``Decimal('1.100000000000000088817841970012523233890533447265625')``。"
607631

608632
#: ../../library/decimal.rst:384
609633
msgid ""
@@ -612,6 +636,8 @@ msgid ""
612636
"``Decimal('3.00000')`` records all five zeros even if the context precision "
613637
"is only three."
614638
msgstr ""
639+
"*context* 精度不會影響儲存多少位數。這完全由 *value* 中的位數決定。例如,即使"
640+
"上下文精度只有三位,``Decimal('3.00000')`` 也會記錄所有五個零。"
615641

616642
#: ../../library/decimal.rst:389
617643
msgid ""
@@ -620,28 +646,35 @@ msgid ""
620646
"exception is raised; otherwise, the constructor returns a new Decimal with "
621647
"the value of ``NaN``."
622648
msgstr ""
649+
"*context* 引數的目的是決定當 *value* 是格式不正確的字串時該怎麼辦。如果上下文"
650+
"捕捉 :const:`InvalidOperation`,就會引發例外;否則,建構函式會回傳一個值為 "
651+
"``NaN`` 的新 Decimal。"
623652

624653
#: ../../library/decimal.rst:394
625654
msgid "Once constructed, :class:`Decimal` objects are immutable."
626-
msgstr ""
655+
msgstr "一旦建構,:class:`Decimal` 物件就是不可變的。"
627656

628657
#: ../../library/decimal.rst:396
629658
msgid ""
630659
"The argument to the constructor is now permitted to be a :class:`float` "
631660
"instance."
632661
msgstr ""
662+
"建構函式的引數現在允許是 :class:`float` 實例。"
633663

634664
#: ../../library/decimal.rst:400
635665
msgid ""
636666
":class:`float` arguments raise an exception if the :exc:`FloatOperation` "
637667
"trap is set. By default the trap is off."
638668
msgstr ""
669+
"如果設定了 :exc:`FloatOperation` 陷阱,:class:`float` 引數會引發例外。預設"
670+
"情況下陷阱是關閉的。"
639671

640672
#: ../../library/decimal.rst:404
641673
msgid ""
642674
"Underscores are allowed for grouping, as with integral and floating-point "
643675
"literals in code."
644676
msgstr ""
677+
"允許使用底線進行分組,就像程式碼中的整數和浮點數字面值一樣。"
645678

646679
#: ../../library/decimal.rst:408
647680
msgid ""
@@ -652,6 +685,10 @@ msgid ""
652685
"compared, sorted, and coerced to another type (such as :class:`float` or :"
653686
"class:`int`)."
654687
msgstr ""
688+
"Decimal 浮點數物件與其他內建數值型別(如 :class:`float` 和 :class:`int`)共享"
689+
"許多屬性。所有常用的數學運算和特殊方法都適用。同樣地,decimal 物件可以被複製、"
690+
"pickle 序列化、列印、用作字典鍵、用作集合元素、比較、排序,以及強制轉換為其他"
691+
"型別(如 :class:`float` 或 :class:`int`)。"
655692

656693
#: ../../library/decimal.rst:415
657694
msgid ""
@@ -660,6 +697,8 @@ msgid ""
660697
"applied to Decimal objects, the sign of the result is the sign of the "
661698
"*dividend* rather than the sign of the divisor::"
662699
msgstr ""
700+
"Decimal 物件的算術運算與整數和浮點數的算術運算之間有一些小差異。當餘數運算子 "
701+
"``%`` 應用於 Decimal 物件時,結果的符號是 *被除數* 的符號,而不是除數的符號::"
663702

664703
#: ../../library/decimal.rst:420
665704
msgid ""
@@ -679,6 +718,8 @@ msgid ""
679718
"integer part of the true quotient (truncating towards zero) rather than its "
680719
"floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::"
681720
msgstr ""
721+
"整數除法運算子 ``//`` 的行為類似,回傳真商的整數部分(向零截斷)而不是其底數,"
722+
"以保持通常的恆等式 ``x == (x // y) * y + x % y``::"
682723

683724
#: ../../library/decimal.rst:429
684725
msgid ""
@@ -697,6 +738,8 @@ msgid ""
697738
"The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-"
698739
"integer`` operations (respectively) as described in the specification."
699740
msgstr ""
741+
"``%`` 和 ``//`` 運算子分別實作規格中描述的 ``remainder`` 和 ``divide-integer`` "
742+
"運算。"
700743

701744
#: ../../library/decimal.rst:438
702745
msgid ""
@@ -708,6 +751,11 @@ msgid ""
708751
"This avoids confusing results when doing equality comparisons between "
709752
"numbers of different types."
710753
msgstr ""
754+
"Decimal 物件通常不能在算術運算中與浮點數或 :class:`fractions.Fraction` 實例"
755+
"結合:例如,嘗試將 :class:`Decimal` 與 :class:`float` 相加會引發 :exc:"
756+
"`TypeError`。但是,可以使用 Python 的比較運算子來比較 :class:`Decimal` 實例 "
757+
"``x`` 與另一個數字 ``y``。這避免了在不同型別的數字之間進行相等比較時產生"
758+
"令人困惑的結果。"
711759

712760
#: ../../library/decimal.rst:446
713761
msgid ""

0 commit comments

Comments
 (0)