Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/@formatjs/ecma402-abstract/lib/NumberFormat/ drwxr-xr-x | |
| Viewing file: Select action/file-type: import { getMagnitude } from '../utils';
import { ComputeExponentForMagnitude } from './ComputeExponentForMagnitude';
import { FormatNumericToString } from './FormatNumericToString';
/**
* The abstract operation ComputeExponent computes an exponent (power of ten) by which to scale x
* according to the number formatting settings. It handles cases such as 999 rounding up to 1000,
* requiring a different exponent.
*
* NOT IN SPEC: it returns [exponent, magnitude].
*/
export function ComputeExponent(numberFormat, x, _a) {
var getInternalSlots = _a.getInternalSlots;
if (x === 0) {
return [0, 0];
}
if (x < 0) {
x = -x;
}
var magnitude = getMagnitude(x);
var exponent = ComputeExponentForMagnitude(numberFormat, magnitude, {
getInternalSlots: getInternalSlots,
});
// Preserve more precision by doing multiplication when exponent is negative.
x = exponent < 0 ? x * Math.pow(10, -exponent) : x / Math.pow(10, exponent);
var formatNumberResult = FormatNumericToString(getInternalSlots(numberFormat), x);
if (formatNumberResult.roundedNumber === 0) {
return [exponent, magnitude];
}
var newMagnitude = getMagnitude(formatNumberResult.roundedNumber);
if (newMagnitude === magnitude - exponent) {
return [exponent, magnitude];
}
return [
ComputeExponentForMagnitude(numberFormat, magnitude + 1, {
getInternalSlots: getInternalSlots,
}),
magnitude + 1,
];
}
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0062 ]-- |