Function discriminant

  • Find the discriminant of a quadratic function. If b^2 – 4ac > 0 then the quadratic function has two distinct real roots. If b^2 – 4ac > 0 then the quadratic function has one repeated real root.

    Parameters

    • a: number

      The quadratic coefficient.

    • b: number

      The linear coefficient.

    • c: number

      The constant coefficient.

    Returns number

    Returns the discriminant.

    Since

    0.5.1

    Example

    discriminant(1, 2, -1)
    // => 8
    discriminant(1, -2, 1)
    // => 0