@@ -548,11 +548,11 @@ msgstr ""
548
548
549
549
#: ../../library/decimal.rst:343
550
550
msgid "Decimal objects"
551
- msgstr ""
551
+ msgstr "Decimal 物件 "
552
552
553
553
#: ../../library/decimal.rst:348
554
554
msgid "Construct a new :class:`Decimal` object based from *value*."
555
- msgstr ""
555
+ msgstr "基於 *value* 建構一個新的 :class:`Decimal` 物件。 "
556
556
557
557
#: ../../library/decimal.rst:350
558
558
msgid ""
@@ -562,6 +562,9 @@ msgid ""
562
562
"after leading and trailing whitespace characters, as well as underscores "
563
563
"throughout, are removed::"
564
564
msgstr ""
565
+ "*value* 可以是整數、字串、元組、:class:`float` 或其他 :class:`Decimal` 物件。"
566
+ "如果沒有提供 *value*,則回傳 ``Decimal('0')``。如果 *value* 是字串,在移除"
567
+ "前後空白字元以及整個字串中的底線後,它應該符合十進位數字字串語法::"
565
568
566
569
#: ../../library/decimal.rst:355
567
570
msgid ""
@@ -577,6 +580,17 @@ msgid ""
577
580
"numeric-value ::= decimal-part [exponent-part] | infinity\n"
578
581
"numeric-string ::= [sign] numeric-value | [sign] nan"
579
582
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"
580
594
581
595
#: ../../library/decimal.rst:366
582
596
msgid ""
@@ -587,6 +601,10 @@ msgid ""
587
601
"example, ``inf``, ``Inf``, ``INFINITY``, and ``iNfINity`` are all acceptable "
588
602
"spellings for positive infinity."
589
603
msgstr ""
604
+ "在上面出現 ``digit`` 的地方也允許其他 Unicode 十進位數字。這些包括來自各種其他"
605
+ "字母表的十進位數字(例如阿拉伯-印度數字和天城數字)以及全形數字 ``'\\ uff10'`` "
606
+ "到 ``'\\ uff19'``。大小寫不重要,所以例如 ``inf``、``Inf``、``INFINITY`` 和 "
607
+ "``iNfINity`` 都是正無窮大的可接受拼寫。"
590
608
591
609
#: ../../library/decimal.rst:373
592
610
msgid ""
@@ -595,6 +613,9 @@ msgid ""
595
613
"an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), -3))`` returns "
596
614
"``Decimal('1.414')``."
597
615
msgstr ""
616
+ "如果 *value* 是 :class:`tuple`,它應該有三個元件:一個符號(``0`` 代表正數或 "
617
+ "``1`` 代表負數)、一個數字的 :class:`tuple`,以及一個整數指數。例如,"
618
+ "``Decimal((0, (1, 4, 1, 4), -3))`` 回傳 ``Decimal('1.414')``。"
598
619
599
620
#: ../../library/decimal.rst:378
600
621
msgid ""
@@ -604,6 +625,9 @@ msgid ""
604
625
"``Decimal(float('1.1'))`` converts to "
605
626
"``Decimal('1.100000000000000088817841970012523233890533447265625')``."
606
627
msgstr ""
628
+ "如果 *value* 是 :class:`float`,二進位浮點數值會被無損轉換為其精確的十進位"
629
+ "等價值。這種轉換通常需要 53 位或更多位數的精度。例如,``Decimal(float('1.1'))`` "
630
+ "轉換為 ``Decimal('1.100000000000000088817841970012523233890533447265625')``。"
607
631
608
632
#: ../../library/decimal.rst:384
609
633
msgid ""
@@ -612,6 +636,8 @@ msgid ""
612
636
"``Decimal('3.00000')`` records all five zeros even if the context precision "
613
637
"is only three."
614
638
msgstr ""
639
+ "*context* 精度不會影響儲存多少位數。這完全由 *value* 中的位數決定。例如,即使"
640
+ "上下文精度只有三位,``Decimal('3.00000')`` 也會記錄所有五個零。"
615
641
616
642
#: ../../library/decimal.rst:389
617
643
msgid ""
@@ -620,28 +646,35 @@ msgid ""
620
646
"exception is raised; otherwise, the constructor returns a new Decimal with "
621
647
"the value of ``NaN``."
622
648
msgstr ""
649
+ "*context* 引數的目的是決定當 *value* 是格式不正確的字串時該怎麼辦。如果上下文"
650
+ "捕捉 :const:`InvalidOperation`,就會引發例外;否則,建構函式會回傳一個值為 "
651
+ "``NaN`` 的新 Decimal。"
623
652
624
653
#: ../../library/decimal.rst:394
625
654
msgid "Once constructed, :class:`Decimal` objects are immutable."
626
- msgstr ""
655
+ msgstr "一旦建構,:class:`Decimal` 物件就是不可變的。 "
627
656
628
657
#: ../../library/decimal.rst:396
629
658
msgid ""
630
659
"The argument to the constructor is now permitted to be a :class:`float` "
631
660
"instance."
632
661
msgstr ""
662
+ "建構函式的引數現在允許是 :class:`float` 實例。"
633
663
634
664
#: ../../library/decimal.rst:400
635
665
msgid ""
636
666
":class:`float` arguments raise an exception if the :exc:`FloatOperation` "
637
667
"trap is set. By default the trap is off."
638
668
msgstr ""
669
+ "如果設定了 :exc:`FloatOperation` 陷阱,:class:`float` 引數會引發例外。預設"
670
+ "情況下陷阱是關閉的。"
639
671
640
672
#: ../../library/decimal.rst:404
641
673
msgid ""
642
674
"Underscores are allowed for grouping, as with integral and floating-point "
643
675
"literals in code."
644
676
msgstr ""
677
+ "允許使用底線進行分組,就像程式碼中的整數和浮點數字面值一樣。"
645
678
646
679
#: ../../library/decimal.rst:408
647
680
msgid ""
@@ -652,6 +685,10 @@ msgid ""
652
685
"compared, sorted, and coerced to another type (such as :class:`float` or :"
653
686
"class:`int`)."
654
687
msgstr ""
688
+ "Decimal 浮點數物件與其他內建數值型別(如 :class:`float` 和 :class:`int`)共享"
689
+ "許多屬性。所有常用的數學運算和特殊方法都適用。同樣地,decimal 物件可以被複製、"
690
+ "pickle 序列化、列印、用作字典鍵、用作集合元素、比較、排序,以及強制轉換為其他"
691
+ "型別(如 :class:`float` 或 :class:`int`)。"
655
692
656
693
#: ../../library/decimal.rst:415
657
694
msgid ""
@@ -660,6 +697,8 @@ msgid ""
660
697
"applied to Decimal objects, the sign of the result is the sign of the "
661
698
"*dividend* rather than the sign of the divisor::"
662
699
msgstr ""
700
+ "Decimal 物件的算術運算與整數和浮點數的算術運算之間有一些小差異。當餘數運算子 "
701
+ "``%`` 應用於 Decimal 物件時,結果的符號是 *被除數* 的符號,而不是除數的符號::"
663
702
664
703
#: ../../library/decimal.rst:420
665
704
msgid ""
@@ -679,6 +718,8 @@ msgid ""
679
718
"integer part of the true quotient (truncating towards zero) rather than its "
680
719
"floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::"
681
720
msgstr ""
721
+ "整數除法運算子 ``//`` 的行為類似,回傳真商的整數部分(向零截斷)而不是其底數,"
722
+ "以保持通常的恆等式 ``x == (x // y) * y + x % y``::"
682
723
683
724
#: ../../library/decimal.rst:429
684
725
msgid ""
@@ -697,6 +738,8 @@ msgid ""
697
738
"The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-"
698
739
"integer`` operations (respectively) as described in the specification."
699
740
msgstr ""
741
+ "``%`` 和 ``//`` 運算子分別實作規格中描述的 ``remainder`` 和 ``divide-integer`` "
742
+ "運算。"
700
743
701
744
#: ../../library/decimal.rst:438
702
745
msgid ""
@@ -708,6 +751,11 @@ msgid ""
708
751
"This avoids confusing results when doing equality comparisons between "
709
752
"numbers of different types."
710
753
msgstr ""
754
+ "Decimal 物件通常不能在算術運算中與浮點數或 :class:`fractions.Fraction` 實例"
755
+ "結合:例如,嘗試將 :class:`Decimal` 與 :class:`float` 相加會引發 :exc:"
756
+ "`TypeError`。但是,可以使用 Python 的比較運算子來比較 :class:`Decimal` 實例 "
757
+ "``x`` 與另一個數字 ``y``。這避免了在不同型別的數字之間進行相等比較時產生"
758
+ "令人困惑的結果。"
711
759
712
760
#: ../../library/decimal.rst:446
713
761
msgid ""
0 commit comments