This brief guide demonstrates how to solve quadratic equations in RhinoScript.

## Problem

If you are trying to solve quadratic equations like:

the results may seem incorrect at times.

## Solution

Most likely, the problem that is that there are floating point rounding errors. Being that you only get 15 decimal places of accuracy, you can use them all up if you are dealing with small numbers.

The following algorithm should produce more accurate results:

Function QuadraticSolver(a, b, c)
Dim d, s0, s1
d = b * b - 4 * a * c
If d < 0 Then
' No real solution