decord/source/13220___exportStarResult21.js
2026-07-27 11:26:19 +00:00

77 lines
3.5 KiB
JavaScript

// Module ID: 13220
// Function ID: 101918
// Name: __exportStarResult21
// Dependencies: [13206, 13204, 13221, 13222, 13223]
// Module 13220 (__exportStarResult21)
const require = arg1;
const dependencyMap = arg6;
arg5.FormatNumericToString = function FormatNumericToString(roundingType, timesResult) {
let formattedString;
let roundedNumber;
if (timesResult.isZero()) {
if (timesResult.isNegative()) {
let ZERO = require(13206) /* TEN */.ZERO;
let str2 = "negative";
}
roundingType = roundingType.roundingType;
const result = require(13221) /* __exportStarResult22 */.GetUnsignedRoundingMode(roundingType.roundingMode, tmp6);
if ("significantDigits" === roundingType) {
let ToRawPrecisionResult = require(13222) /* __exportStarResult29 */.ToRawPrecision(ZERO, roundingType.minimumSignificantDigits, roundingType.maximumSignificantDigits, result);
} else if ("fractionDigits" === roundingType) {
ToRawPrecisionResult = require(13223) /* __exportStarResult28 */.ToRawFixed(ZERO, roundingType.minimumFractionDigits, roundingType.maximumFractionDigits, roundingType.roundingIncrement, result);
} else {
const ToRawPrecisionResult1 = require(13222) /* __exportStarResult29 */.ToRawPrecision(ZERO, roundingType.minimumSignificantDigits, roundingType.maximumSignificantDigits, result);
let ToRawFixedResult = require(13223) /* __exportStarResult28 */.ToRawFixed(ZERO, roundingType.minimumFractionDigits, roundingType.maximumFractionDigits, roundingType.roundingIncrement, result);
if ("morePrecision" === roundingType.roundingType) {
if (ToRawPrecisionResult1.roundingMagnitude <= ToRawFixedResult.roundingMagnitude) {
ToRawFixedResult = ToRawPrecisionResult1;
}
ToRawPrecisionResult = ToRawFixedResult;
} else {
require(13204) /* setInternalSlot */.invariant("lessPrecision" === roundingType.roundingType, "Invalid roundingType");
ToRawPrecisionResult = ToRawPrecisionResult1;
if (ToRawPrecisionResult1.roundingMagnitude <= ToRawFixedResult.roundingMagnitude) {
ToRawPrecisionResult = ToRawFixedResult;
}
}
}
({ roundedNumber, formattedString } = ToRawPrecisionResult);
let substr = formattedString;
if ("stripIfInteger" === roundingType.trailingZeroDisplay) {
substr = formattedString;
if (roundedNumber.isInteger()) {
const index = formattedString.indexOf(".");
substr = formattedString;
if (index > -1) {
substr = formattedString.slice(0, index);
}
}
}
const integerDigitsCount = ToRawPrecisionResult.integerDigitsCount;
const minimumIntegerDigits = roundingType.minimumIntegerDigits;
let sum = substr;
if (integerDigitsCount < minimumIntegerDigits) {
sum = require(13204) /* setInternalSlot */.repeat("0", minimumIntegerDigits - integerDigitsCount) + substr;
}
if ("negative" !== str2) {
const obj = { roundedNumber, formattedString: sum };
return obj;
} else if (roundedNumber.isZero()) {
let NEGATIVE_ZERO = require(13206) /* TEN */.NEGATIVE_ZERO;
} else {
NEGATIVE_ZERO = roundedNumber.negated();
}
}
require(13204) /* setInternalSlot */.invariant(timesResult.isFinite(), "NumberFormatDigitInternalSlots value is not finite");
let str = "positive";
if (timesResult.lessThan(0)) {
str = "negative";
}
str2 = str;
ZERO = timesResult;
if ("negative" === str) {
ZERO = timesResult.negated();
str2 = str;
}
};