matician - v2.0.0
    Preparing search index...

    Function percentageChange

    • Calculates the percentage change between an initial and a final value, returned as a decimal.

      Parameters

      • initial: number

        The starting value.

      • final: number

        The ending value.

      Returns number

      The percentage change as a decimal (e.g., 0.2 for 20%, -0.25 for -25%).

      If the initial value is zero (to avoid division by zero).

      percentageChange(100, 120); // returns 0.2
      percentageChange(200, 150); // returns -0.25