@@ -147,14 +147,16 @@ msgstr ""
147
147
148
148
#: ../../library/decimal.rst:125
149
149
msgid "Quick-start tutorial"
150
- msgstr ""
150
+ msgstr "快速入門教學 "
151
151
152
152
#: ../../library/decimal.rst:127
153
153
msgid ""
154
154
"The usual start to using decimals is importing the module, viewing the "
155
155
"current context with :func:`getcontext` and, if necessary, setting new "
156
156
"values for precision, rounding, or enabled traps::"
157
157
msgstr ""
158
+ "使用 decimal 的通常起始步驟是匯入模組、使用 :func:`getcontext` 檢視目前的上下文,"
159
+ "以及若有必要的話,設定精度、捨入方式或啟用陷阱的新值::"
158
160
159
161
#: ../../library/decimal.rst:131
160
162
msgid ""
@@ -166,6 +168,13 @@ msgid ""
166
168
"\n"
167
169
">>> getcontext().prec = 7 # Set a new precision"
168
170
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 # 設定新的精度"
169
178
170
179
#: ../../library/decimal.rst:139
171
180
msgid ""
@@ -175,6 +184,9 @@ msgid ""
175
184
"values such as ``NaN`` which stands for \" Not a number\" , positive and "
176
185
"negative ``Infinity``, and ``-0``::"
177
186
msgstr ""
187
+ "Decimal 實例可以從整數、字串、浮點數或元組建構。從整數或浮點數建構會執行該整數"
188
+ "或浮點數值的精確轉換。Decimal 數字包含特殊值,例如代表「非數字」的 ``NaN``、"
189
+ "正負 ``Infinity``,以及 ``-0``::"
178
190
179
191
#: ../../library/decimal.rst:145
180
192
msgid ""
@@ -213,13 +225,32 @@ msgstr ""
213
225
"Decimal('NaN')\n"
214
226
">>> Decimal('-Infinity')\n"
215
227
"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')"
216
245
217
246
#: ../../library/decimal.rst:163
218
247
msgid ""
219
248
"If the :exc:`FloatOperation` signal is trapped, accidental mixing of "
220
249
"decimals and floats in constructors or ordering comparisons raises an "
221
250
"exception::"
222
251
msgstr ""
252
+ "如果 :exc:`FloatOperation` 信號被捕捉,在建構函式或排序比較中意外混用 decimal "
253
+ "和 float 會引發例外::"
223
254
224
255
#: ../../library/decimal.rst:167
225
256
msgid ""
@@ -255,6 +286,8 @@ msgid ""
255
286
"digits input. Context precision and rounding only come into play during "
256
287
"arithmetic operations."
257
288
msgstr ""
289
+ "新 Decimal 的精度僅由輸入的數字位數決定。上下文精度和捨入只會在算術運算期間"
290
+ "發揮作用。"
258
291
259
292
#: ../../library/decimal.rst:186
260
293
msgid ""
@@ -285,6 +318,7 @@ msgid ""
285
318
"If the internal limits of the C version are exceeded, constructing a decimal "
286
319
"raises :class:`InvalidOperation`::"
287
320
msgstr ""
321
+ "如果超過 C 版本的內部限制,建構 decimal 會引發 :class:`InvalidOperation`::"
288
322
289
323
#: ../../library/decimal.rst:202
290
324
msgid ""
@@ -303,6 +337,7 @@ msgid ""
303
337
"Decimals interact well with much of the rest of Python. Here is a small "
304
338
"decimal floating-point flying circus:"
305
339
msgstr ""
340
+ "Decimal 與 Python 的其他部分互動良好。以下是一個小小的 decimal 浮點數展示:"
306
341
307
342
#: ../../library/decimal.rst:212
308
343
msgid ""
@@ -360,28 +395,34 @@ msgstr ""
360
395
361
396
#: ../../library/decimal.rst:241
362
397
msgid "And some mathematical functions are also available to Decimal:"
363
- msgstr ""
398
+ msgstr "而且 Decimal 也提供一些數學函式: "
364
399
365
400
#: ../../library/decimal.rst:253
366
401
msgid ""
367
402
"The :meth:`~Decimal.quantize` method rounds a number to a fixed exponent. "
368
403
"This method is useful for monetary applications that often round results to "
369
404
"a fixed number of places:"
370
405
msgstr ""
406
+ ":meth:`~Decimal.quantize` 方法將數字捨入到固定的指數。此方法對於經常將結果捨入"
407
+ "到固定位數的金融應用程式很有用:"
371
408
372
409
#: ../../library/decimal.rst:262
373
410
msgid ""
374
411
"As shown above, the :func:`getcontext` function accesses the current context "
375
412
"and allows the settings to be changed. This approach meets the needs of "
376
413
"most applications."
377
414
msgstr ""
415
+ "如上所示,:func:`getcontext` 函式存取目前的上下文並允許變更設定。這種方法滿足"
416
+ "大多數應用程式的需求。"
378
417
379
418
#: ../../library/decimal.rst:266
380
419
msgid ""
381
420
"For more advanced work, it may be useful to create alternate contexts using "
382
421
"the Context() constructor. To make an alternate active, use the :func:"
383
422
"`setcontext` function."
384
423
msgstr ""
424
+ "對於更進階的工作,使用 Context() 建構函式建立替代上下文可能會很有用。要使替代"
425
+ "上下文作用,請使用 :func:`setcontext` 函式。"
385
426
386
427
#: ../../library/decimal.rst:270
387
428
msgid ""
0 commit comments