|
发表于 2004-4-26 12:14:02
|
显示全部楼层
scale是区分不同的情况的,见manual:
Addition, subtraction
The scale of the result is the larger of the scales of the two
operands. There is never any truncation of the result.
Multiplication
The scale of the result is never less than the maximum of the two
scales of the operands, and never more than the sum of the scales
of the operands, and subject to those two restrictions, the scale
of the result is set equal to the contents of the internal
quantity, scale.
Division
The scale of a quotient is the contents of the internal quantity,
scale.
Modulo The scale of a remainder is the sum of the scales of the quotient
and the divisor.
Exponentiation
The result of an exponentiation is scaled as if the implied
multiplications were performed. An exponent must be an integer.
Square Root
The scale of a square root is set to the maximum of the scale of the
argument and the contents of scale.
All of the internal operations are actually carried out in terms of
integers, with digits being discarded when necessary. In every case where
digits are discarded truncation is performed without rounding.
The contents of scale must be no greater than 99 and no less than 0. It is
initially set to 0.
这是一段中文的解释:加法,减法结果的标度(精度)是大的二个操作数的标度(两个操作数中的精度最高者)。 有从未结果的任一截(不会自动截取数位)。
增殖(乘法)结果的标度比操作数的二个标度的最大值比操作数的标度的总和从未是较少(不会比两个操作数的精度小),和从未更多,并且依于那些二个制约,结果的标度被设置相等与内部数量的内容,标度。
分部商数(除法)的标度是内部数量的内容,标度(由scale确定)。
模数剩下的人的(求模)标度是商数和除数的标度的总和(是两个操作数的精度和)。
取幂(幂)取幂的结果被称好象含蓄的增殖执行了(隐含按乘法规则执行)。 方次数必须是整数。
方根一个方根的标度被设置对论据和标度内容的标度的最大值。
所有内部操作实际上被执行根据整数,与数字被放弃如果必要。 数字被放弃的地方截每次执行没有环绕。
标度(精度)内容必须是没有(不)大于99 和没有少于(不小于)0 。 它最初被设置到(初值为)0 。 |
|