Skip to contents

quadratic formula, root of least magnitude

Usage

sel_root(a, b, c, dsign)

Arguments

a

numeric. Quadratic coefficient (a in ax^2 + bx + c = 0).

b

numeric. Linear coefficient.

c

numeric. Constant term.

dsign

numeric. Sign of the discriminant term to select which root to return (+1 or -1).

Value

The selected root of least magnitude.

Examples

sel_root(a = 1, b = -3, c = 2, dsign = 1)
#> [1] 2