Function circleArea

  • Function calculates area of a circle based on its radius

    Parameters

    • radius: number

      The radius of the circle

    Returns number

    Value of square area of circle

    The formula for the area of a circle is $ A = π * r^2 $, where r is the radius of the circle. We already provide an ellipseArea function, that can take care of computation, but it won't be as efficient for simpler cases such as circles. Furthermore it takes advantage of native exponentiation operator and its calculation speed

    import { circleArea } from 'simple-mathematic';

    circleArea(5); // 78.53981633974483