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

Skip to content

Commit c00eb7c

Browse files
Copilotjosix
andcommitted
Complete Quick-start Tutorial translation
Co-authored-by: josix <[email protected]>
1 parent 9e9a67a commit c00eb7c

File tree

1 file changed

+43
-2
lines changed

1 file changed

+43
-2
lines changed

library/decimal.po

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,14 +147,16 @@ msgstr ""
147147

148148
#: ../../library/decimal.rst:125
149149
msgid "Quick-start tutorial"
150-
msgstr ""
150+
msgstr "快速入門教學"
151151

152152
#: ../../library/decimal.rst:127
153153
msgid ""
154154
"The usual start to using decimals is importing the module, viewing the "
155155
"current context with :func:`getcontext` and, if necessary, setting new "
156156
"values for precision, rounding, or enabled traps::"
157157
msgstr ""
158+
"使用 decimal 的通常起始步驟是匯入模組、使用 :func:`getcontext` 檢視目前的上下文,"
159+
"以及若有必要的話,設定精度、捨入方式或啟用陷阱的新值::"
158160

159161
#: ../../library/decimal.rst:131
160162
msgid ""
@@ -166,6 +168,13 @@ msgid ""
166168
"\n"
167169
">>> getcontext().prec = 7 # Set a new precision"
168170
msgstr ""
171+
">>> from decimal import *\n"
172+
">>> getcontext()\n"
173+
"Context(prec=28, rounding=ROUND_HALF_EVEN, Emin=-999999, Emax=999999,\n"
174+
" capitals=1, clamp=0, flags=[], traps=[Overflow, DivisionByZero,\n"
175+
" InvalidOperation])\n"
176+
"\n"
177+
">>> getcontext().prec = 7 # 設定新的精度"
169178

170179
#: ../../library/decimal.rst:139
171180
msgid ""
@@ -175,6 +184,9 @@ msgid ""
175184
"values such as ``NaN`` which stands for \"Not a number\", positive and "
176185
"negative ``Infinity``, and ``-0``::"
177186
msgstr ""
187+
"Decimal 實例可以從整數、字串、浮點數或元組建構。從整數或浮點數建構會執行該整數"
188+
"或浮點數值的精確轉換。Decimal 數字包含特殊值,例如代表「非數字」的 ``NaN``、"
189+
"正負 ``Infinity``,以及 ``-0``::"
178190

179191
#: ../../library/decimal.rst:145
180192
msgid ""
@@ -213,13 +225,32 @@ msgstr ""
213225
"Decimal('NaN')\n"
214226
">>> Decimal('-Infinity')\n"
215227
"Decimal('-Infinity')"
228+
">>> getcontext().prec = 28\n"
229+
">>> Decimal(10)\n"
230+
"Decimal('10')\n"
231+
">>> Decimal('3.14')\n"
232+
"Decimal('3.14')\n"
233+
">>> Decimal(3.14)\n"
234+
"Decimal('3.140000000000000124344978758017532527446746826171875')\n"
235+
">>> Decimal((0, (3, 1, 4), -2))\n"
236+
"Decimal('3.14')\n"
237+
">>> Decimal(str(2.0 ** 0.5))\n"
238+
"Decimal('1.4142135623730951')\n"
239+
">>> Decimal(2) ** Decimal('0.5')\n"
240+
"Decimal('1.414213562373095048801688724')\n"
241+
">>> Decimal('NaN')\n"
242+
"Decimal('NaN')\n"
243+
">>> Decimal('-Infinity')\n"
244+
"Decimal('-Infinity')"
216245

217246
#: ../../library/decimal.rst:163
218247
msgid ""
219248
"If the :exc:`FloatOperation` signal is trapped, accidental mixing of "
220249
"decimals and floats in constructors or ordering comparisons raises an "
221250
"exception::"
222251
msgstr ""
252+
"如果 :exc:`FloatOperation` 信號被捕捉,在建構函式或排序比較中意外混用 decimal "
253+
"和 float 會引發例外::"
223254

224255
#: ../../library/decimal.rst:167
225256
msgid ""
@@ -255,6 +286,8 @@ msgid ""
255286
"digits input. Context precision and rounding only come into play during "
256287
"arithmetic operations."
257288
msgstr ""
289+
"新 Decimal 的精度僅由輸入的數字位數決定。上下文精度和捨入只會在算術運算期間"
290+
"發揮作用。"
258291

259292
#: ../../library/decimal.rst:186
260293
msgid ""
@@ -285,6 +318,7 @@ msgid ""
285318
"If the internal limits of the C version are exceeded, constructing a decimal "
286319
"raises :class:`InvalidOperation`::"
287320
msgstr ""
321+
"如果超過 C 版本的內部限制,建構 decimal 會引發 :class:`InvalidOperation`::"
288322

289323
#: ../../library/decimal.rst:202
290324
msgid ""
@@ -303,6 +337,7 @@ msgid ""
303337
"Decimals interact well with much of the rest of Python. Here is a small "
304338
"decimal floating-point flying circus:"
305339
msgstr ""
340+
"Decimal 與 Python 的其他部分互動良好。以下是一個小小的 decimal 浮點數展示:"
306341

307342
#: ../../library/decimal.rst:212
308343
msgid ""
@@ -360,28 +395,34 @@ msgstr ""
360395

361396
#: ../../library/decimal.rst:241
362397
msgid "And some mathematical functions are also available to Decimal:"
363-
msgstr ""
398+
msgstr "而且 Decimal 也提供一些數學函式:"
364399

365400
#: ../../library/decimal.rst:253
366401
msgid ""
367402
"The :meth:`~Decimal.quantize` method rounds a number to a fixed exponent. "
368403
"This method is useful for monetary applications that often round results to "
369404
"a fixed number of places:"
370405
msgstr ""
406+
":meth:`~Decimal.quantize` 方法將數字捨入到固定的指數。此方法對於經常將結果捨入"
407+
"到固定位數的金融應用程式很有用:"
371408

372409
#: ../../library/decimal.rst:262
373410
msgid ""
374411
"As shown above, the :func:`getcontext` function accesses the current context "
375412
"and allows the settings to be changed. This approach meets the needs of "
376413
"most applications."
377414
msgstr ""
415+
"如上所示,:func:`getcontext` 函式存取目前的上下文並允許變更設定。這種方法滿足"
416+
"大多數應用程式的需求。"
378417

379418
#: ../../library/decimal.rst:266
380419
msgid ""
381420
"For more advanced work, it may be useful to create alternate contexts using "
382421
"the Context() constructor. To make an alternate active, use the :func:"
383422
"`setcontext` function."
384423
msgstr ""
424+
"對於更進階的工作,使用 Context() 建構函式建立替代上下文可能會很有用。要使替代"
425+
"上下文作用,請使用 :func:`setcontext` 函式。"
385426

386427
#: ../../library/decimal.rst:270
387428
msgid ""

0 commit comments

Comments
 (0)