@@ -259,6 +259,8 @@ msgid ""
259259":const:`ExtendedContext`. The former is especially useful for debugging "
260260"because many of the traps are enabled:"
261261msgstr ""
262+ "根据标准,:mod:`decimal` 模块提供了两个现成的标准上下文 :const:`BasicContext` 和 "
263+ ":const:`ExtendedContext` 。 前者对调试特别有用,因为许多陷阱都已启用:"
262264
263265#: ../../library/decimal.rst:299
264266msgid ""
@@ -267,19 +269,22 @@ msgid ""
267269"cleared, so it is best to clear the flags before each set of monitored "
268270"computations by using the :meth:`clear_flags` method. ::"
269271msgstr ""
272+ "上下文还具有用于监视计算期间遇到的异常情况的信号标志。 标志保持设置直到明确清除,因此最好通过使用 :meth:`clear_flags` "
273+ "方法清除每组受监控计算之前的标志。::"
270274
271275#: ../../library/decimal.rst:312
272276msgid ""
273277"The *flags* entry shows that the rational approximation to :const:`Pi` was "
274278"rounded (digits beyond the context precision were thrown away) and that the "
275279"result is inexact (some of the discarded digits were non-zero)."
276280msgstr ""
281+ "* flags * 条目显示对 :const:`Pi` 的有理逼近被舍入(超出上下文精度的数字被抛弃)并且结果是不精确的(一些丢弃的数字不为零)。"
277282
278283#: ../../library/decimal.rst:316
279284msgid ""
280285"Individual traps are set using the dictionary in the :attr:`traps` field of "
281286"a context:"
282- msgstr ""
287+ msgstr "使用上下文的 :attr:`traps` 字段中的字典设置单个陷阱: "
283288
284289#: ../../library/decimal.rst:331
285290msgid ""
@@ -289,14 +294,16 @@ msgid ""
289294"the bulk of the program manipulates the data no differently than with other "
290295"Python numeric types."
291296msgstr ""
297+ "大多数程序仅在程序开始时调整当前上下文一次。 并且,在许多应用程序中,数据在循环内单个强制转换为 :class:`Decimal` 。 "
298+ "通过创建上下文集和小数,程序的大部分操作数据与其他 Python 数字类型没有区别。"
292299
293300#: ../../library/decimal.rst:343
294301msgid "Decimal objects"
295- msgstr ""
302+ msgstr "Decimal 对象 "
296303
297304#: ../../library/decimal.rst:348
298305msgid "Construct a new :class:`Decimal` object based from *value*."
299- msgstr ""
306+ msgstr "根据* value *构造一个新的 :class:`Decimal` 对象。 "
300307
301308#: ../../library/decimal.rst:350
302309msgid ""
@@ -306,6 +313,9 @@ msgid ""
306313"syntax after leading and trailing whitespace characters, as well as "
307314"underscores throughout, are removed::"
308315msgstr ""
316+ "* value *可以是整数,字符串,元组,:class:`float` ,或另一个 :class:`Decimal` 对象。 如果没有给出* "
317+ "value *,则返回``Decimal('0')``。 如果* value "
318+ "*是一个字符串,它应该在前导和尾随空格字符以及下划线被删除之后符合十进制数字字符串语法::"
309319
310320#: ../../library/decimal.rst:366
311321msgid ""
@@ -314,6 +324,8 @@ msgid ""
314324"example, Arabic-Indic and Devanāgarī digits) along with the fullwidth digits"
315325" ``'\\ uff10'`` through ``'\\ uff19'``."
316326msgstr ""
327+ "当上面出现 ``digit`` 时,也允许使用其他Unicode十进制数字。 这些包括来自各种其他字母表的十进制数字(例如,阿拉伯语 - 印度语和 "
328+ "Devanāgarī 数字)以及全宽数字 ``'\\ uff10'`` 到``'\\ uff19'``。"
317329
318330#: ../../library/decimal.rst:371
319331msgid ""
@@ -322,6 +334,9 @@ msgid ""
322334"digits, and an integer exponent. For example, ``Decimal((0, (1, 4, 1, 4), "
323335"-3))`` returns ``Decimal('1.414')``."
324336msgstr ""
337+ "如果* value *是一个 :class:`tuple` ,它应该有三个组件,一个符号( :const:`0` 表示正数或 :const:`1` "
338+ "表示负数),一个数字的 :class:`tuple` 和整数指数。 例如, ``Decimal((0, (1, 4, 1, 4), -3))`` "
339+ "返回``Decimal('1.414')``。"
325340
326341#: ../../library/decimal.rst:376
327342msgid ""
@@ -331,6 +346,9 @@ msgid ""
331346"``Decimal(float('1.1'))`` converts to "
332347"``Decimal('1.100000000000000088817841970012523233890533447265625')``."
333348msgstr ""
349+ "如果* value *是 :class:`float` ,则二进制浮点值无损地转换为其精确的十进制等效值。 此转换通常需要53位或更多位数的精度。 "
350+ "例如, ``Decimal(float('1.1'))`` "
351+ "转换为``Decimal('1.100000000000000088817841970012523233890533447265625')``。"
334352
335353#: ../../library/decimal.rst:382
336354msgid ""
@@ -339,6 +357,8 @@ msgid ""
339357"``Decimal('3.00000')`` records all five zeros even if the context precision "
340358"is only three."
341359msgstr ""
360+ "* context * 进度不会影响存储的位数。 这完全由* value *中的位数决定。 "
361+ "例如,``Decimal('3.00000')``记录所有五个零,即使上下文精度只有三。"
342362
343363#: ../../library/decimal.rst:387
344364msgid ""
@@ -347,28 +367,30 @@ msgid ""
347367"exception is raised; otherwise, the constructor returns a new Decimal with "
348368"the value of :const:`NaN`."
349369msgstr ""
370+ "* context *参数的目的是确定* value *是格式错误的字符串时该怎么做。 如果上下文陷阱 "
371+ ":const:`InvalidOperation`,则引发异常; 否则,构造函数返回一个新的Decimal,其值为 :const:`NaN`。"
350372
351373#: ../../library/decimal.rst:392
352374msgid "Once constructed, :class:`Decimal` objects are immutable."
353- msgstr ""
375+ msgstr "构造完成后, :class:`Decimal` 对象是不可变的。 "
354376
355377#: ../../library/decimal.rst:394
356378msgid ""
357379"The argument to the constructor is now permitted to be a :class:`float` "
358380"instance."
359- msgstr ""
381+ msgstr "现在允许构造函数的参数为 :class:`float` 实例。 "
360382
361383#: ../../library/decimal.rst:398
362384msgid ""
363385":class:`float` arguments raise an exception if the :exc:`FloatOperation` "
364386"trap is set. By default the trap is off."
365- msgstr ""
387+ msgstr ":class:`float` 参数在设置 :exc:`FloatOperation` 陷阱时引发异常。 默认情况下,陷阱已关闭。 "
366388
367389#: ../../library/decimal.rst:402
368390msgid ""
369391"Underscores are allowed for grouping, as with integral and floating-point "
370392"literals in code."
371- msgstr ""
393+ msgstr "允许下划线进行分组,就像代码中的整数和浮点文字一样。 "
372394
373395#: ../../library/decimal.rst:406
374396msgid ""
@@ -379,6 +401,9 @@ msgid ""
379401"compared, sorted, and coerced to another type (such as :class:`float` or "
380402":class:`int`)."
381403msgstr ""
404+ "十进制浮点对象与其他内置数值类型共享许多属性,例如 :class:`float` 和 :class:`int` 。 所有常用的数学运算和特殊方法都适用。"
405+ " 同样,十进制对象可以复制、pickle、打印、用作字典键、用作set元素、比较、排序和强制转换为另一种类型(例如 :class:`float`或 "
406+ ":class:`int`)。"
382407
383408#: ../../library/decimal.rst:413
384409msgid ""
@@ -387,19 +412,23 @@ msgid ""
387412"applied to Decimal objects, the sign of the result is the sign of the "
388413"*dividend* rather than the sign of the divisor::"
389414msgstr ""
415+ "算术对十进制对象和算术对整数和浮点数有一些小的差别。 当余数运算符 ``%`` 应用于Decimal对象时,结果的符号是* 被除数 "
416+ "*的符号,而不是除数的符号::"
390417
391418#: ../../library/decimal.rst:423
392419msgid ""
393420"The integer division operator ``//`` behaves analogously, returning the "
394421"integer part of the true quotient (truncating towards zero) rather than its "
395422"floor, so as to preserve the usual identity ``x == (x // y) * y + x % y``::"
396423msgstr ""
424+ "整数除法运算符``//``的行为类似,返回真商的整数部分(截断为零)而不是它的向下取整,以便保留通常的标识``x == (x // y) * y + x"
425+ " % y``::"
397426
398427#: ../../library/decimal.rst:432
399428msgid ""
400429"The ``%`` and ``//`` operators implement the ``remainder`` and ``divide-"
401430"integer`` operations (respectively) as described in the specification."
402- msgstr ""
431+ msgstr "``%`` 和``//``运算符实现了``remainder``和``divide-integer``操作(分别),如规范中所述。 "
403432
404433#: ../../library/decimal.rst:436
405434msgid ""
@@ -411,18 +440,22 @@ msgid ""
411440"``y``. This avoids confusing results when doing equality comparisons "
412441"between numbers of different types."
413442msgstr ""
443+ "十进制对象通常不能与浮点数或 :class:`fractions.Fraction` 实例在算术运算中结合使用:例如,尝试将 "
444+ ":class:`Decimal` 加到 :class:`float` ,将引发 :exc:`TypeError`。 但是,可以使用 Python "
445+ "的比较运算符来比较 :class:`Decimal`实例 ``x`` 和另一个数字 ``y`` 。 "
446+ "这样可以避免在对不同类型的数字进行相等比较时混淆结果。"
414447
415448#: ../../library/decimal.rst:444
416449msgid ""
417450"Mixed-type comparisons between :class:`Decimal` instances and other numeric "
418451"types are now fully supported."
419- msgstr ""
452+ msgstr "现在完全支持 :class:`Decimal` 实例和其他数字类型之间的混合类型比较。 "
420453
421454#: ../../library/decimal.rst:448
422455msgid ""
423456"In addition to the standard numeric properties, decimal floating point "
424457"objects also have a number of specialized methods:"
425- msgstr ""
458+ msgstr "除了标准的数字属性,十进制浮点对象还有许多专门的方法: "
426459
427460#: ../../library/decimal.rst:454
428461msgid ""
@@ -431,45 +464,52 @@ msgid ""
431464"returns seven. Used for determining the position of the most significant "
432465"digit with respect to the decimal point."
433466msgstr ""
467+ "在移出系数最右边的数字之后返回调整后的指数,直到只剩下前导数字:``Decimal('321e+5').adjusted()`` 返回 7 。 "
468+ "用于确定最高有效位相对于小数点的位置。"
434469
435470#: ../../library/decimal.rst:461
436471msgid ""
437472"Return a pair ``(n, d)`` of integers that represent the given "
438473":class:`Decimal` instance as a fraction, in lowest terms and with a positive"
439474" denominator::"
440- msgstr ""
475+ msgstr "返回一对 ``(n, d)`` 整数,表示给定的 :class:`Decimal` 实例作为分数、最简形式项并带有正分母:: "
441476
442477#: ../../library/decimal.rst:468
443478msgid ""
444479"The conversion is exact. Raise OverflowError on infinities and ValueError "
445480"on NaNs."
446- msgstr ""
481+ msgstr "转换是精确的。 在 Infinity 上引发 OverflowError ,在 NaN 上引起 ValueError 。 "
447482
448483#: ../../library/decimal.rst:475
449484msgid ""
450485"Return a :term:`named tuple` representation of the number: "
451486"``DecimalTuple(sign, digits, exponent)``."
452487msgstr ""
488+ "返回一个 :term:`named tuple` 表示的数字:``DecimalTuple(sign, digits, exponent)``。"
453489
454490#: ../../library/decimal.rst:481
455491msgid ""
456492"Return the canonical encoding of the argument. Currently, the encoding of a"
457493" :class:`Decimal` instance is always canonical, so this operation returns "
458494"its argument unchanged."
459- msgstr ""
495+ msgstr "返回参数的规范编码。 目前,一个 :class:`Decimal` 实例的编码始终是规范的,因此该操作返回其参数不变。 "
460496
461497#: ../../library/decimal.rst:487
462498msgid ""
463499"Compare the values of two Decimal instances. :meth:`compare` returns a "
464500"Decimal instance, and if either operand is a NaN then the result is a NaN::"
465501msgstr ""
502+ "比较两个 Decimal 实例的值。 :meth:`compare` 返回一个 Decimal 实例,如果任一操作数是 NaN ,那么结果是 NaN "
503+ "::"
466504
467505#: ../../library/decimal.rst:498
468506msgid ""
469507"This operation is identical to the :meth:`compare` method, except that all "
470508"NaNs signal. That is, if neither operand is a signaling NaN then any quiet "
471509"NaN operand is treated as though it were a signaling NaN."
472510msgstr ""
511+ "除了所有 NaN 信号之外,此操作与 :meth:`compare` 方法相同。 也就是说,如果两个操作数都不是信令NaN,那么任何静默的 NaN "
512+ "操作数都被视为信令NaN。"
473513
474514#: ../../library/decimal.rst:504
475515msgid ""
@@ -479,6 +519,8 @@ msgid ""
479519"instances with the same numeric value but different representations compare "
480520"unequal in this ordering:"
481521msgstr ""
522+ "使用它们的抽象表示而不是它们的数值来比较两个操作数。 类似于 :meth:`compare` 方法,但结果给出了一个总排序 "
523+ ":class:`Decimal` 实例。 两个 :class:`Decimal` 实例具有相同的数值但不同的表示形式在此排序中比较不相等:"
482524
483525#: ../../library/decimal.rst:513
484526msgid ""
@@ -489,6 +531,10 @@ msgid ""
489531"in the total order than the second operand. See the specification for "
490532"details of the total order."
491533msgstr ""
534+ "静默和发出信号的 NaN 也包括在总排序中。 "
535+ "这个函数的结果是``Decimal('0')``如果两个操作数具有相同的表示,``Decimal('-1')`` "
536+ "如果第一个操作数的总顺序低于第二个操作数,并且 ``Decimal('1')`` ``如果第一个操作数在总顺序中高于第二个操作数。 "
537+ "有关总排序的详细信息,请参阅规范。"
492538
493539#: ../../library/decimal.rst:520 ../../library/decimal.rst:531
494540#: ../../library/decimal.rst:559 ../../library/decimal.rst:834
@@ -497,6 +543,7 @@ msgid ""
497543"and no rounding is performed. As an exception, the C version may raise "
498544"InvalidOperation if the second operand cannot be converted exactly."
499545msgstr ""
546+ "此操作不受上下文影响且静默:不更改任何标志且不执行舍入。 作为例外,如果无法准确转换第二个操作数,则C版本可能会引发InvalidOperation。"
500547
501548#: ../../library/decimal.rst:526
502549msgid ""
@@ -505,18 +552,20 @@ msgid ""
505552"``x.compare_total_mag(y)`` is equivalent to "
506553"``x.copy_abs().compare_total(y.copy_abs())``."
507554msgstr ""
555+ "比较两个操作数使用它们的抽象表示而不是它们的值,如:meth:`compare_total`,但忽略每个操作数的符号。 "
556+ "``x.compare_total_mag(y)`` 相当于``x.copy_abs().compare_total(y.copy_abs())``。"
508557
509558#: ../../library/decimal.rst:537
510559msgid ""
511560"Just returns self, this method is only to comply with the Decimal "
512561"Specification."
513- msgstr ""
562+ msgstr "只返回self,这种方法只符合 Decimal 规范。 "
514563
515564#: ../../library/decimal.rst:542
516565msgid ""
517566"Return the absolute value of the argument. This operation is unaffected by "
518567"the context and is quiet: no flags are changed and no rounding is performed."
519- msgstr ""
568+ msgstr "返回参数的绝对值。 此操作不受上下文影响并且是静默的:没有更改标志且不执行舍入。 "
520569
521570#: ../../library/decimal.rst:548
522571msgid ""
0 commit comments