• Calculates the difference between maximum and minimum values in an array of Big numbers

    Parameters

    • data: Big[]

      Array of Big numbers to calculate range from

    Returns Big

    The range (max - min) of the values

    If array is empty

    const numbers = [
    new Big('10.5'),
    new Big('2.3'),
    new Big('15.7')
    ];

    const range = variance(numbers); // Returns Big('13.4') (15.7 - 2.3)
    • Accepts a standard array for better ergonomics, with runtime validation ensuring non-emptiness
    • Uses max() and min() functions for efficient calculation
    • Performs two passes through the array for better readability and maintainability