Appearance
formatFloat
Formats a number with thousand separators on the integer part while preserving the original decimal digits (no rounding or padding).
ts
import { formatFloat } from '@swapped/connect-sdk/format'
formatFloat(1000)
// "1,000" — no fractional part → none added
formatFloat(1234.56)
// "1,234.56"
formatFloat(1.2345)
// "1.2345" — keeps all original fractional digits
formatFloat(0.001)
// "0.001"
formatFloat(1_234_567.89)
// "1,234,567.89"
formatFloat(-0.5)
// "-0.5" — sign is kept for values between -1 and 0Scientific notation is expanded (1e-7 → 0.0000001). NaN and Infinity return ''.
Built on formatInteger for the integer part.