import type Decimal from "break_infinity.js" ; import { Notation } from "../notation" ; import { toFixedLongScale , abbreviate } from "../utils" ; export class LongScaleNotation extends Notation { public readonly name : string = "Long scale" ; public formatDecimal ( value , places ) { const longScale = toFixedLongScale ( value , places ) ; const mantissa = longScale . mantissa . toFixed ( places ) ; const abbreviation = abbreviate ( Math . floor ( longScale . exponent / 6 ) ) ; return `${ mantissa } ${ abbreviation }` . replace ( /[,.]/g , ( x ) => x === "." ? "," : "." ) ; } }