Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Translate library/math.po rst: 87-102, 239-374 #992

Open
wants to merge 11 commits into
base: 3.13
Choose a base branch
from
87 changes: 61 additions & 26 deletions library/math.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ msgid ""
msgstr ""
"Project-Id-Version: Python 3.13\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2024-09-23 07:52+0800\n"
"PO-Revision-Date: 2024-04-26 15:15+0800\n"
"POT-Creation-Date: 2024-03-14 00:03+0000\n"
"PO-Revision-Date: 2024-10-21 23:50+0800\n"
"Last-Translator: Adrian Liaw <[email protected]>\n"
"Language-Team: Chinese - TAIWAN (https://github.com/python/python-docs-zh-"
"tw)\n"
Expand All @@ -17,7 +17,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=1; plural=0;\n"
"X-Generator: Poedit 3.4.2\n"
"X-Generator: Poedit 3.5\n"

#: ../../library/math.rst:2
msgid ":mod:`!math` --- Mathematical functions"
Expand Down Expand Up @@ -114,7 +114,6 @@ msgstr ""
"以整數回傳 *n* 的階乘。若 *n* 非整數型別或其值為負會引發 :exc:`ValueError`。"

#: ../../library/math.rst:74
#, fuzzy
msgid "Floats with integral values (like ``5.0``) are no longer accepted."
msgstr "允許傳入其值為整數的浮點數(如:``5.0``)已被棄用。"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved

Expand All @@ -135,6 +134,8 @@ msgid ""
"``float`` format. This operation often provides better accuracy than the "
"direct expression ``(x * y) + z``."
msgstr ""
"融合乘加運算。回傳 ``(x * y) + z``,用近似於無限精度及範圍的方式計算,而後一"
"次轉換為浮點數格式。此操作通常能提供比運算式 ``(x * y) + z`` 更高的精度。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 round 是四捨五入的那個 round 嗎?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

然後這邊的 precision 跟 accuracy 的翻譯可能還是要分開,精確度跟準確度應該還是不太一樣
precision 精確度
accuracy 準確度

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

根據wiki對Fused multiply-add的說明,我認為此處的round含義上確實類似四捨五入

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

accuracy已修


#: ../../library/math.rst:92
msgid ""
Expand All @@ -144,6 +145,9 @@ msgid ""
"``fma(inf, 0, nan)``. In these cases, ``math.fma`` returns a NaN, and does "
"not raise any exception."
msgstr ""
"此函式遵循 IEEE-754 標準中規範的融合乘加(fusedMultiplyAdd)運算。該標準保留"
"一種由實作環境決定的案例,即 ``fma(0, inf, nan)`` 和 ``fma(inf, 0, nan)`` 的"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved
"結果;在此案例中,``math.fma`` 回傳 ``NaN`` 且不會引發例外。"

#: ../../library/math.rst:103
msgid ""
Expand Down Expand Up @@ -347,35 +351,35 @@ msgstr "回傳 ``x * (2**i)``。此函式本質上為 :func:`frexp` 的反函式
msgid ""
"Return the fractional and integer parts of *x*. Both results carry the sign "
"of *x* and are floats."
msgstr ""
msgstr "回傳 *x* 的小數及整數部分,兩者皆為與 *x* 同號的浮點數。"

#: ../../library/math.rst:245
msgid "Return the floating-point value *steps* steps after *x* towards *y*."
msgstr ""
msgstr "回傳 *x* 向 *y* *steps* 步的浮點數值。"

#: ../../library/math.rst:247
msgid "If *x* is equal to *y*, return *y*, unless *steps* is zero."
msgstr ""
msgstr "除非 *steps* 為零,否則當 *x* 與 *y* 相等時回傳 *y*。"

#: ../../library/math.rst:249
msgid "Examples:"
msgstr "範例:"

#: ../../library/math.rst:251
msgid "``math.nextafter(x, math.inf)`` goes up: towards positive infinity."
msgstr ""
msgstr "``math.nextafter(x, math.inf)`` 增加:往正無限。"

#: ../../library/math.rst:252
msgid "``math.nextafter(x, -math.inf)`` goes down: towards minus infinity."
msgstr ""
msgstr "``math.nextafter(x, -math.inf)`` 減少:往負無限。"

#: ../../library/math.rst:253
msgid "``math.nextafter(x, 0.0)`` goes towards zero."
msgstr ""
msgstr "``math.nextafter(x, 0.0)`` 靠近零。"

#: ../../library/math.rst:254
msgid "``math.nextafter(x, math.copysign(math.inf, x))`` goes away from zero."
msgstr ""
msgstr "``math.nextafter(x, math.copysign(math.inf, x))`` 遠離零。"

#: ../../library/math.rst:256
msgid "See also :func:`math.ulp`."
Expand All @@ -389,32 +393,36 @@ msgstr "新增 *steps* 引數。"
msgid ""
"Return the number of ways to choose *k* items from *n* items without "
"repetition and with order."
msgstr ""
msgstr "回傳從 *n* 個物品中不重複且考慮排序地取出 *k* 個物品的方法數。"

#: ../../library/math.rst:268
msgid ""
"Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates to zero when "
"``k > n``."
msgstr ""
msgstr "當 ``k <= n`` 時其值為 ``n! / (n - k)!``,否則其值為 ``0``。"

#: ../../library/math.rst:271
msgid ""
"If *k* is not specified or is ``None``, then *k* defaults to *n* and the "
"function returns ``n!``."
msgstr ""
"若未給定 *k* 或其值為 ``None``,則 *k* 值預設為 *n*,且函式回傳 ``n!``。"

#: ../../library/math.rst:282
msgid ""
"Calculate the product of all the elements in the input *iterable*. The "
"default *start* value for the product is ``1``."
msgstr ""
"計算傳入的 *iterable* 中所有元素的乘積。預設的乘積起始值 *start* 為 ``1``。"

#: ../../library/math.rst:285
msgid ""
"When the iterable is empty, return the start value. This function is "
"intended specifically for use with numeric values and may reject non-numeric "
"types."
msgstr ""
"當 *iterable* 為空時,回傳 *start* 值。此函式特別用於計算數值,並可能拒絕處理"
"非數字類型。"

#: ../../library/math.rst:294
msgid ""
Expand All @@ -425,6 +433,10 @@ msgid ""
"*even* integer is used for ``n``. The remainder ``r = remainder(x, y)`` "
"thus always satisfies ``abs(r) <= 0.5 * abs(y)``."
msgstr ""
"回傳 *x* 對 *y* 根據 IEEE 754 定義的餘數。對有限數 *x* 及有限非零數 *y*,該餘"
"數值為 ``x - n*y``,``n`` 是最接近 ``x / y`` 精確值的整數。若 ``x / y`` 剛好"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

quotient 沒翻到,然後這句也沒有精確度歐

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我是將the exact value of the quotient x / y合翻為x / y精確值
quotient主要是擔心商可能會誤解為僅指運算結果的整數部分,這部分我會再思考一下

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這邊的 difference 應該不是餘數?
看起來比較接近
"這是 x - n*y 的另一種寫法" 之類的

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因為上一句定義了x,y兩數,所以我將this翻為該餘數值與第一句的根據 IEEE 754 定義的餘數對應,此處的difference我想應該是指差(減法運算的結果),這部分我會再想一下

"位於兩個連續整數的正中間,``n`` 為最接近的 *偶* 數。因此該餘數 ``r = "
"remainder(x, y)`` 必滿足 ``abs(r) <= 0.5 * abs(y)``。"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved

#: ../../library/math.rst:301
msgid ""
Expand All @@ -433,34 +445,38 @@ msgid ""
"x)`` raise :exc:`ValueError` for any non-NaN *x*. If the result of the "
"remainder operation is zero, that zero will have the same sign as *x*."
msgstr ""
"特殊情況遵循 IEEE 754:特別是,對任何有限數 *x*,``remainder(x, math.inf)`` "
"值為 *x*;對任何非 ``NaN`` 值 *x*,``remainder(x, 0)`` 及 ``remainder(math."
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

Suggested change
"值為 *x*;對任何非 ``NaN`` 值 *x*,``remainder(x, 0)`` 及 ``remainder(math."
"的值為 *x*;對任何非 ``NaN`` 值 *x*,``remainder(x, 0)`` 及 ``remainder(math."

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修

"inf, x)`` 會引發 :exc:`ValueError`。若取餘數操作的結果為零,則該零值會與 *x* "
"同號。"

#: ../../library/math.rst:307
msgid ""
"On platforms using IEEE 754 binary floating point, the result of this "
"operation is always exactly representable: no rounding error is introduced."
msgstr ""
"在遵循 IEEE 754 浮點標準的平台上,此操作的結果必能精準表示,不會出現捨入誤"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

binary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我確認了一下,IEEE 754定義了二進位制及十進位制的浮點數
已修為在使用 IEEE 754 浮點標準中二進制浮點數的平台上

"差。"

#: ../../library/math.rst:315
msgid "Return the sum of products of values from two iterables *p* and *q*."
msgstr ""
msgstr "回傳兩個可疊代物件值乘積的總和。"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p&q

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

已修


#: ../../library/math.rst:317
msgid "Raises :exc:`ValueError` if the inputs do not have the same length."
msgstr ""
msgstr "若兩個傳入物件長度不同會引發 :exc:`ValueError`。"

#: ../../library/math.rst:319 ../../library/math.rst:514
msgid "Roughly equivalent to::"
msgstr ""

#: ../../library/math.rst:321
msgid "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))"
msgstr "sum(itertools.starmap(operator.mul, zip(p, q, strict=True)))"
msgstr "約等價於:::"

#: ../../library/math.rst:323
#: ../../library/math.rst:307
msgid ""
"For float and mixed int/float inputs, the intermediate products and sums are "
"computed with extended precision."
msgstr ""
"對浮點數或混合整數及浮點數的傳入物件,其過程中的乘積及總和皆使用延伸精度計"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"對浮點數或混合整數及浮點數的傳入物件,其過程中的乘積及總和皆使用延伸精度計"
"對浮點數或混合整數及浮點數的傳入物件,其過程中的乘積及總和皆使用延伸精確度計"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

因為fsum()處將extended precision翻為延伸精度,此處我傾向統一用詞

"算。"

#: ../../library/math.rst:331
msgid ""
Expand All @@ -470,53 +486,65 @@ msgid ""
"delegates to :meth:`x.__trunc__ <object.__trunc__>`, which should return an :"
"class:`~numbers.Integral` value."
msgstr ""
"回傳去除小數部分而僅餘整數部分的 *x*。此函式會向零捨入:若 *x* 為正值,"
"``trunc()`` 等價於 :func:`floor`;若 *x* 為負值,``trunc()`` 等價於 :func:"
"`ceil`。若 *x* 非浮點數,此函式將委派給 :meth:`x.__trunc__ <object."
"__trunc__>`,而後回傳一 :class:`~numbers.Integral` 值。"

#: ../../library/math.rst:339
msgid "Return the value of the least significant bit of the float *x*:"
msgstr ""
msgstr "回傳浮點數 *x* 的最低有效位元值:"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved

#: ../../library/math.rst:341
msgid "If *x* is a NaN (not a number), return *x*."
msgstr ""
msgstr "若 *x* 為 ``NaN``,回傳 *x*。"

#: ../../library/math.rst:342
msgid "If *x* is negative, return ``ulp(-x)``."
msgstr ""
msgstr "若 *x* 為負值,回傳 ``ulp(-x)``。"

#: ../../library/math.rst:343
msgid "If *x* is a positive infinity, return *x*."
msgstr ""
msgstr "若 *x* 為正無限值,回傳 *x*。"

#: ../../library/math.rst:344
msgid ""
"If *x* is equal to zero, return the smallest positive *denormalized* "
"representable float (smaller than the minimum positive *normalized* float, :"
"data:`sys.float_info.min <sys.float_info>`)."
msgstr ""
"若 *x* 等於零,回傳 *反正規化* 可表示的最小正浮點數(此值小於 *正規化* 可表示"
"的最小正浮點數 :data:`sys.float_info.min <sys.float_info>`)。"

#: ../../library/math.rst:347
msgid ""
"If *x* is equal to the largest positive representable float, return the "
"value of the least significant bit of *x*, such that the first float smaller "
"than *x* is ``x - ulp(x)``."
msgstr ""
"若 *x* 等於可表示的最大正浮點數,回傳 *x* 的最低有效位元值,使 ``x-ulp(x)`` "
"為第一個小於 *x* 的浮點數值。"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved

#: ../../library/math.rst:350
msgid ""
"Otherwise (*x* is a positive finite number), return the value of the least "
"significant bit of *x*, such that the first float bigger than *x* is ``x + "
"ulp(x)``."
msgstr ""
"否則(當 *x* 為正有限數),回傳 *x* 的最低有效位元值,使 ``x+ulp(x)`` 為第一"
"個大於 *x* 的浮點數值。"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved

#: ../../library/math.rst:354
msgid "ULP stands for \"Unit in the Last Place\"."
msgstr ""
msgstr "ULP 即最後一位上的單位值(Unit in the Last Place)。"

#: ../../library/math.rst:356
msgid ""
"See also :func:`math.nextafter` and :data:`sys.float_info.epsilon <sys."
"float_info>`."
msgstr ""
"另請參閱 :func:`math.nextafter` 及 :data:`sys.float_info.epsilon <sys."
"float_info>`。"

#: ../../library/math.rst:362
msgid ""
Expand All @@ -525,6 +553,9 @@ msgid ""
"pair of values, rather than returning their second return value through an "
"'output parameter' (there is no such thing in Python)."
msgstr ""
"請注意 :func:`frexp` 及 :func:`modf` 的呼叫/回傳模式與 C 語言中相應函式不同:"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

very nit

Suggested change
"請注意 :func:`frexp` 及 :func:`modf` 的呼叫/回傳模式與 C 語言中相應函式不同"
"請注意 :func:`frexp` 及 :func:`modf` 的呼叫/回傳模式與 C 語言中的相應函式不同"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

這部分我想了一下,覺得與C語言中相應的函式不同比較順,已修

"它們傳入一個引數並回傳一對值,而非透過一個「輸出參數(output parameter)」傳"
Carisa-Li marked this conversation as resolved.
Show resolved Hide resolved
"遞第二個回傳值(Python 沒有那種東西)。"

#: ../../library/math.rst:367
msgid ""
Expand All @@ -534,6 +565,10 @@ msgid ""
"(the same as the platform C double type), in which case any float *x* with "
"``abs(x) >= 2**52`` necessarily has no fractional bits."
msgstr ""
"使用 :func:`ceil`、:func:`floor` 及 :func:`modf` 三個函式時,請注意 *所有* 足"
"夠大的浮點數都是精確的整數。Python 的浮點數型別的精確度通常不會超過 53 位元"
"(與 C 語言 double 型別相同),因此當浮點數 *x* 滿足 ``abs(x) >= 2**52`` 時,"
"它必然沒有小數部分。"

#: ../../library/math.rst:375
msgid "Power and logarithmic functions"
Expand Down