?
u
/
p
1-9
This is the spec text of the Decimal proposal in ECMAScript.
The abstract operation ToString takes argument argument (an
Decimal128 values, as specified here, are intended represent base-10 (decimal) numbers. ECMAScript, and many other languages, default to representing numbers in base-2 (binary). The conversion of a decimal
An IEEE 754 Decimal128 value is an element of the universe of values specified by
Decimal128 values defined in this section are ECMAScript analogues of
Essentially all of the entities defined by the IEEE 754 Decimal128 standard exist as Decimal128 objects, with one class of exceptions: NaN. Decimal128 supports NaN. All Decimal128-NaN values in IEEE 754 Decimal128 are mapped to a NaN Decimal128 value. There may be distinct NaN Decimal128 values in the sense of object identity, but they are all supposed to behave identically. Thus, when we refer to a Decimal128 NaN, we mean any Decimal128 object whose
Thus, we grant ourselves a mapping A from the set of
The default rounding mode is the String value
An exponential string is a string whose syntax is a
The mathematical value of a Decimal128 object
The abstract operation IsIntegralDecimal128 takes argument argument (an
The
If
Multiple leading zeros will be reduced to a single zero.
Computes the absolute value of
Computes the negation of
Adds
Subtracts
Multiplies
Divides
Computes the remainder of dividing
The remainder operation specified here deviates from the IEEE 754 remainder operation. We follow the
Compares the
Compares the
Compares compare_total
operation. Returns -1, 0, or 1 according as compare_total
operation.
This operation compares Decimal128 values as
Rounds
If mode is neither
If mode is not a
Renders
Throw
This function performs the following steps when called:
This function performs the following steps when called:
The abstract operation Decimal128ToBigInt takes argument number (a Decimal128 object) and returns either a
© 2024 Jesse Alama
All Software contained in this document ("Software") is protected by copyright and is being made available under the "BSD License", included below. This Software may be subject to third party rights (rights from parties other than Ecma International), including patent rights, and no licenses under such third party rights are granted under this license even if the third party concerned is a member of Ecma International. SEE THE ECMA CODE OF CONDUCT IN PATENT MATTERS AVAILABLE AT https://ecma-international.org/memento/codeofconduct.htm FOR INFORMATION REGARDING THE LICENSING OF PATENT CLAIMS THAT ARE REQUIRED TO IMPLEMENT ECMA INTERNATIONAL STANDARDS.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
THIS SOFTWARE IS PROVIDED BY THE ECMA INTERNATIONAL "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR