Rocky_Mountain_Vending/.pnpm-store/v10/files/60/7d7b9726c17cd9887cb48dd4e795a0c16c9824cfa32fccf741f12369b6757d75792d296709c1aad88d05a1b7f45d569c32d5c54a0569dbb9dbdfe06bb1f007
DMleadgen 46d973904b
Initial commit: Rocky Mountain Vending website
Next.js website for Rocky Mountain Vending company featuring:
- Product catalog with Stripe integration
- Service areas and parts pages
- Admin dashboard with Clerk authentication
- SEO optimized pages with JSON-LD structured data

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-12 16:22:15 -07:00

38 lines
1.6 KiB
Text

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ComputeExponent = ComputeExponent;
var tslib_1 = require("tslib");
var decimal_js_1 = tslib_1.__importDefault(require("decimal.js"));
var ComputeExponentForMagnitude_1 = require("./ComputeExponentForMagnitude");
var FormatNumericToString_1 = require("./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].
*/
function ComputeExponent(internalSlots, x) {
if (x.isZero()) {
return [0, 0];
}
if (x.isNegative()) {
x = x.negated();
}
var magnitude = x.log(10).floor();
var exponent = (0, ComputeExponentForMagnitude_1.ComputeExponentForMagnitude)(internalSlots, magnitude);
// Preserve more precision by doing multiplication when exponent is negative.
x = x.times(decimal_js_1.default.pow(10, -exponent));
var formatNumberResult = (0, FormatNumericToString_1.FormatNumericToString)(internalSlots, x);
if (formatNumberResult.roundedNumber.isZero()) {
return [exponent, magnitude.toNumber()];
}
var newMagnitude = formatNumberResult.roundedNumber.log(10).floor();
if (newMagnitude.eq(magnitude.minus(exponent))) {
return [exponent, magnitude.toNumber()];
}
return [
(0, ComputeExponentForMagnitude_1.ComputeExponentForMagnitude)(internalSlots, magnitude.plus(1)),
magnitude.plus(1).toNumber(),
];
}