import type Decimal from "break_infinity.js" ; import { Notation } from "./notation" ; export class BracketsNotation extends Notation { public get name ( ) : string { return "Brackets" ; } public formatDecimal ( value ) { const table = [ ")" , "[" , "{" , "]" , "(" , "}" ] ; const log6 = Math . LN10 / Math . log ( 6 ) * value . log10 ( ) ; let wholePartOfLog = Math . floor ( log6 ) ; const decimalPartOfLog = log6 - wholePartOfLog ; const decimalPartTimes36 = Math . floor ( decimalPartOfLog * 36 ) ; let string = "" ; while ( wholePartOfLog >= 6 ) { const remainder = wholePartOfLog % 6 ; wholePartOfLog -= remainder ; wholePartOfLog /= 6 ; string = table [ remainder ] + string ; } string = `e${ table [ wholePartOfLog ] }${ string }.` ; string += table [ Math . floor ( decimalPartTimes36 / 6 ) ] ; string += table [ decimalPartTimes36 % 6 ] ; return string ; } }