ChemPal Documentation - v1.18.0
    Preparing search index...
    • Round an amount to 2 decimals so equality checks (dedup) aren't defeated by floating-point noise.

      Parameters

      • amount: number

        The amount to round.

      Returns number

      The amount rounded to 2 decimal places.

      round2(19.990000001); // 19.99
      
      export function round2(amount: number): number {
      return Number(amount.toFixed(2));
      }