bun install @solocker/safe-bn
By default safe-bn support 3 decimal places to increase add the optional decimal param
const target = 3124.456;
const safeBnRepresentation = safeBN(target);
// reverse to unSafe after performing mathematical operations
const unSafeRepresentation = unSafe(safeRepresentation);
/// This unwrap safeBN, note don't pass unSafe output, convert first to save before this
const backToTarget = unSafeToNumber(safeRepresentation);