solveLinear

Solves a linear equation of the form ax + b = 0 and stores the solution in the provided array.

Return

the number of solutions: 0 if there are no solutions, or 1 if there is exactly one solution.

Parameters

a

the coefficient of x in the equation.

b

the constant term in the equation.

acc

an array where the solution will be stored if it exists. The solution will be stored at index 0.


Solves a linear equation of the form ax + b = 0 and returns the solution(s) as an array of doubles.

Return

a double array containing the solution(s) to the linear equation. The array will be empty if there are no solutions, or it will contain one solution if a valid solution exists.

Parameters

a

the coefficient of x in the equation.

b

the constant term in the equation.