Quadratic roots, narrow range

Percentage Accurate: 55.4% → 90.7%
Time: 18.1s
Alternatives: 14
Speedup: 29.0×

Specification

?
\[\left(\left(1.0536712127723509 \cdot 10^{-8} < a \land a < 94906265.62425156\right) \land \left(1.0536712127723509 \cdot 10^{-8} < b \land b < 94906265.62425156\right)\right) \land \left(1.0536712127723509 \cdot 10^{-8} < c \land c < 94906265.62425156\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 14 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 55.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (-b + sqrt(((b * b) - ((4.0d0 * a) * c)))) / (2.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(4.0 * a) * c)))) / Float64(2.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(4.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\end{array}

Alternative 1: 90.7% accurate, 0.1× speedup?

\[\begin{array}{l} \\ \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)}{-b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (+
   c
   (+
    (* 2.0 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 4.0)))
    (+
     (* 5.0 (/ (* (pow a 3.0) (pow c 4.0)) (pow b 6.0)))
     (/ (* a (pow c 2.0)) (pow b 2.0)))))
  (- b)))
double code(double a, double b, double c) {
	return (c + ((2.0 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 4.0))) + ((5.0 * ((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 6.0))) + ((a * pow(c, 2.0)) / pow(b, 2.0))))) / -b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (c + ((2.0d0 * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 4.0d0))) + ((5.0d0 * (((a ** 3.0d0) * (c ** 4.0d0)) / (b ** 6.0d0))) + ((a * (c ** 2.0d0)) / (b ** 2.0d0))))) / -b
end function
public static double code(double a, double b, double c) {
	return (c + ((2.0 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 4.0))) + ((5.0 * ((Math.pow(a, 3.0) * Math.pow(c, 4.0)) / Math.pow(b, 6.0))) + ((a * Math.pow(c, 2.0)) / Math.pow(b, 2.0))))) / -b;
}
def code(a, b, c):
	return (c + ((2.0 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 4.0))) + ((5.0 * ((math.pow(a, 3.0) * math.pow(c, 4.0)) / math.pow(b, 6.0))) + ((a * math.pow(c, 2.0)) / math.pow(b, 2.0))))) / -b
function code(a, b, c)
	return Float64(Float64(c + Float64(Float64(2.0 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + Float64(Float64(5.0 * Float64(Float64((a ^ 3.0) * (c ^ 4.0)) / (b ^ 6.0))) + Float64(Float64(a * (c ^ 2.0)) / (b ^ 2.0))))) / Float64(-b))
end
function tmp = code(a, b, c)
	tmp = (c + ((2.0 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + ((5.0 * (((a ^ 3.0) * (c ^ 4.0)) / (b ^ 6.0))) + ((a * (c ^ 2.0)) / (b ^ 2.0))))) / -b;
end
code[a_, b_, c_] := N[(N[(c + N[(N[(2.0 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(5.0 * N[(N[(N[Power[a, 3.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[Power[c, 2.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-b)), $MachinePrecision]
\begin{array}{l}

\\
\frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)}{-b}
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in c around 0 91.2%

    \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right)\right) - \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. fma-neg91.2%

      \[\leadsto c \cdot \color{blue}{\mathsf{fma}\left(c, -1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right), -\frac{1}{b}\right)} \]
  7. Simplified91.2%

    \[\leadsto \color{blue}{c \cdot \mathsf{fma}\left(c, c \cdot \mathsf{fma}\left(-2, \frac{{a}^{2}}{{b}^{5}}, -0.25 \cdot \left(c \cdot \left(\frac{\frac{{a}^{4}}{{b}^{6}}}{b} \cdot \frac{20}{a}\right)\right)\right) - \frac{a}{{b}^{3}}, \frac{-1}{b}\right)} \]
  8. Taylor expanded in b around -inf 91.3%

    \[\leadsto \color{blue}{-1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)}{b}} \]
  9. Final simplification91.3%

    \[\leadsto \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)}{-b} \]
  10. Add Preprocessing

Alternative 2: 90.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot {\left(\frac{c}{b}\right)}^{2}\right)\right)}{-b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (+
   c
   (+
    (* 2.0 (/ (* (pow a 2.0) (pow c 3.0)) (pow b 4.0)))
    (+
     (* 5.0 (/ (* (pow a 3.0) (pow c 4.0)) (pow b 6.0)))
     (* a (pow (/ c b) 2.0)))))
  (- b)))
double code(double a, double b, double c) {
	return (c + ((2.0 * ((pow(a, 2.0) * pow(c, 3.0)) / pow(b, 4.0))) + ((5.0 * ((pow(a, 3.0) * pow(c, 4.0)) / pow(b, 6.0))) + (a * pow((c / b), 2.0))))) / -b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (c + ((2.0d0 * (((a ** 2.0d0) * (c ** 3.0d0)) / (b ** 4.0d0))) + ((5.0d0 * (((a ** 3.0d0) * (c ** 4.0d0)) / (b ** 6.0d0))) + (a * ((c / b) ** 2.0d0))))) / -b
end function
public static double code(double a, double b, double c) {
	return (c + ((2.0 * ((Math.pow(a, 2.0) * Math.pow(c, 3.0)) / Math.pow(b, 4.0))) + ((5.0 * ((Math.pow(a, 3.0) * Math.pow(c, 4.0)) / Math.pow(b, 6.0))) + (a * Math.pow((c / b), 2.0))))) / -b;
}
def code(a, b, c):
	return (c + ((2.0 * ((math.pow(a, 2.0) * math.pow(c, 3.0)) / math.pow(b, 4.0))) + ((5.0 * ((math.pow(a, 3.0) * math.pow(c, 4.0)) / math.pow(b, 6.0))) + (a * math.pow((c / b), 2.0))))) / -b
function code(a, b, c)
	return Float64(Float64(c + Float64(Float64(2.0 * Float64(Float64((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + Float64(Float64(5.0 * Float64(Float64((a ^ 3.0) * (c ^ 4.0)) / (b ^ 6.0))) + Float64(a * (Float64(c / b) ^ 2.0))))) / Float64(-b))
end
function tmp = code(a, b, c)
	tmp = (c + ((2.0 * (((a ^ 2.0) * (c ^ 3.0)) / (b ^ 4.0))) + ((5.0 * (((a ^ 3.0) * (c ^ 4.0)) / (b ^ 6.0))) + (a * ((c / b) ^ 2.0))))) / -b;
end
code[a_, b_, c_] := N[(N[(c + N[(N[(2.0 * N[(N[(N[Power[a, 2.0], $MachinePrecision] * N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(5.0 * N[(N[(N[Power[a, 3.0], $MachinePrecision] * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 6.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-b)), $MachinePrecision]
\begin{array}{l}

\\
\frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot {\left(\frac{c}{b}\right)}^{2}\right)\right)}{-b}
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in c around 0 91.2%

    \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right)\right) - \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. fma-neg91.2%

      \[\leadsto c \cdot \color{blue}{\mathsf{fma}\left(c, -1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right), -\frac{1}{b}\right)} \]
  7. Simplified91.2%

    \[\leadsto \color{blue}{c \cdot \mathsf{fma}\left(c, c \cdot \mathsf{fma}\left(-2, \frac{{a}^{2}}{{b}^{5}}, -0.25 \cdot \left(c \cdot \left(\frac{\frac{{a}^{4}}{{b}^{6}}}{b} \cdot \frac{20}{a}\right)\right)\right) - \frac{a}{{b}^{3}}, \frac{-1}{b}\right)} \]
  8. Taylor expanded in b around -inf 91.3%

    \[\leadsto \color{blue}{-1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)\right)}{b}} \]
  9. Step-by-step derivation
    1. associate-/l*91.3%

      \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}\right)\right)}{b} \]
  10. Applied egg-rr91.3%

    \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{2}}}\right)\right)}{b} \]
  11. Step-by-step derivation
    1. unpow291.3%

      \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot \frac{\color{blue}{c \cdot c}}{{b}^{2}}\right)\right)}{b} \]
    2. unpow291.3%

      \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot \frac{c \cdot c}{\color{blue}{b \cdot b}}\right)\right)}{b} \]
    3. times-frac91.3%

      \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot \color{blue}{\left(\frac{c}{b} \cdot \frac{c}{b}\right)}\right)\right)}{b} \]
    4. unpow291.3%

      \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot \color{blue}{{\left(\frac{c}{b}\right)}^{2}}\right)\right)}{b} \]
  12. Simplified91.3%

    \[\leadsto -1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + \color{blue}{a \cdot {\left(\frac{c}{b}\right)}^{2}}\right)\right)}{b} \]
  13. Final simplification91.3%

    \[\leadsto \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \left(5 \cdot \frac{{a}^{3} \cdot {c}^{4}}{{b}^{6}} + a \cdot {\left(\frac{c}{b}\right)}^{2}\right)\right)}{-b} \]
  14. Add Preprocessing

Alternative 3: 90.7% accurate, 0.2× speedup?

\[\begin{array}{l} \\ a \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}} + -2 \cdot \frac{{c}^{3}}{{b}^{5}}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (-
  (*
   a
   (-
    (*
     a
     (+
      (* -5.0 (/ (* a (pow c 4.0)) (pow b 7.0)))
      (* -2.0 (/ (pow c 3.0) (pow b 5.0)))))
    (/ (pow c 2.0) (pow b 3.0))))
  (/ c b)))
double code(double a, double b, double c) {
	return (a * ((a * ((-5.0 * ((a * pow(c, 4.0)) / pow(b, 7.0))) + (-2.0 * (pow(c, 3.0) / pow(b, 5.0))))) - (pow(c, 2.0) / pow(b, 3.0)))) - (c / b);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = (a * ((a * (((-5.0d0) * ((a * (c ** 4.0d0)) / (b ** 7.0d0))) + ((-2.0d0) * ((c ** 3.0d0) / (b ** 5.0d0))))) - ((c ** 2.0d0) / (b ** 3.0d0)))) - (c / b)
end function
public static double code(double a, double b, double c) {
	return (a * ((a * ((-5.0 * ((a * Math.pow(c, 4.0)) / Math.pow(b, 7.0))) + (-2.0 * (Math.pow(c, 3.0) / Math.pow(b, 5.0))))) - (Math.pow(c, 2.0) / Math.pow(b, 3.0)))) - (c / b);
}
def code(a, b, c):
	return (a * ((a * ((-5.0 * ((a * math.pow(c, 4.0)) / math.pow(b, 7.0))) + (-2.0 * (math.pow(c, 3.0) / math.pow(b, 5.0))))) - (math.pow(c, 2.0) / math.pow(b, 3.0)))) - (c / b)
function code(a, b, c)
	return Float64(Float64(a * Float64(Float64(a * Float64(Float64(-5.0 * Float64(Float64(a * (c ^ 4.0)) / (b ^ 7.0))) + Float64(-2.0 * Float64((c ^ 3.0) / (b ^ 5.0))))) - Float64((c ^ 2.0) / (b ^ 3.0)))) - Float64(c / b))
end
function tmp = code(a, b, c)
	tmp = (a * ((a * ((-5.0 * ((a * (c ^ 4.0)) / (b ^ 7.0))) + (-2.0 * ((c ^ 3.0) / (b ^ 5.0))))) - ((c ^ 2.0) / (b ^ 3.0)))) - (c / b);
end
code[a_, b_, c_] := N[(N[(a * N[(N[(a * N[(N[(-5.0 * N[(N[(a * N[Power[c, 4.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[Power[c, 3.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[c, 2.0], $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
a \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}} + -2 \cdot \frac{{c}^{3}}{{b}^{5}}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in c around 0 91.2%

    \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right)\right) - \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. fma-neg91.2%

      \[\leadsto c \cdot \color{blue}{\mathsf{fma}\left(c, -1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right), -\frac{1}{b}\right)} \]
  7. Simplified91.2%

    \[\leadsto \color{blue}{c \cdot \mathsf{fma}\left(c, c \cdot \mathsf{fma}\left(-2, \frac{{a}^{2}}{{b}^{5}}, -0.25 \cdot \left(c \cdot \left(\frac{\frac{{a}^{4}}{{b}^{6}}}{b} \cdot \frac{20}{a}\right)\right)\right) - \frac{a}{{b}^{3}}, \frac{-1}{b}\right)} \]
  8. Taylor expanded in a around 0 91.3%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-1 \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(-5 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}} + -2 \cdot \frac{{c}^{3}}{{b}^{5}}\right)\right)} \]
  9. Final simplification91.3%

    \[\leadsto a \cdot \left(a \cdot \left(-5 \cdot \frac{a \cdot {c}^{4}}{{b}^{7}} + -2 \cdot \frac{{c}^{3}}{{b}^{5}}\right) - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b} \]
  10. Add Preprocessing

Alternative 4: 90.5% accurate, 0.2× speedup?

\[\begin{array}{l} \\ c \cdot \left(c \cdot \left(c \cdot \left(-5 \cdot \frac{c \cdot {a}^{3}}{{b}^{7}} + -2 \cdot \frac{{a}^{2}}{{b}^{5}}\right) - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (*
  c
  (+
   (*
    c
    (-
     (*
      c
      (+
       (* -5.0 (/ (* c (pow a 3.0)) (pow b 7.0)))
       (* -2.0 (/ (pow a 2.0) (pow b 5.0)))))
     (/ a (pow b 3.0))))
   (/ -1.0 b))))
double code(double a, double b, double c) {
	return c * ((c * ((c * ((-5.0 * ((c * pow(a, 3.0)) / pow(b, 7.0))) + (-2.0 * (pow(a, 2.0) / pow(b, 5.0))))) - (a / pow(b, 3.0)))) + (-1.0 / b));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c * ((c * ((c * (((-5.0d0) * ((c * (a ** 3.0d0)) / (b ** 7.0d0))) + ((-2.0d0) * ((a ** 2.0d0) / (b ** 5.0d0))))) - (a / (b ** 3.0d0)))) + ((-1.0d0) / b))
end function
public static double code(double a, double b, double c) {
	return c * ((c * ((c * ((-5.0 * ((c * Math.pow(a, 3.0)) / Math.pow(b, 7.0))) + (-2.0 * (Math.pow(a, 2.0) / Math.pow(b, 5.0))))) - (a / Math.pow(b, 3.0)))) + (-1.0 / b));
}
def code(a, b, c):
	return c * ((c * ((c * ((-5.0 * ((c * math.pow(a, 3.0)) / math.pow(b, 7.0))) + (-2.0 * (math.pow(a, 2.0) / math.pow(b, 5.0))))) - (a / math.pow(b, 3.0)))) + (-1.0 / b))
function code(a, b, c)
	return Float64(c * Float64(Float64(c * Float64(Float64(c * Float64(Float64(-5.0 * Float64(Float64(c * (a ^ 3.0)) / (b ^ 7.0))) + Float64(-2.0 * Float64((a ^ 2.0) / (b ^ 5.0))))) - Float64(a / (b ^ 3.0)))) + Float64(-1.0 / b)))
end
function tmp = code(a, b, c)
	tmp = c * ((c * ((c * ((-5.0 * ((c * (a ^ 3.0)) / (b ^ 7.0))) + (-2.0 * ((a ^ 2.0) / (b ^ 5.0))))) - (a / (b ^ 3.0)))) + (-1.0 / b));
end
code[a_, b_, c_] := N[(c * N[(N[(c * N[(N[(c * N[(N[(-5.0 * N[(N[(c * N[Power[a, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[b, 7.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-2.0 * N[(N[Power[a, 2.0], $MachinePrecision] / N[Power[b, 5.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c \cdot \left(c \cdot \left(c \cdot \left(-5 \cdot \frac{c \cdot {a}^{3}}{{b}^{7}} + -2 \cdot \frac{{a}^{2}}{{b}^{5}}\right) - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right)
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in c around 0 91.2%

    \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right)\right) - \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. fma-neg91.2%

      \[\leadsto c \cdot \color{blue}{\mathsf{fma}\left(c, -1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right), -\frac{1}{b}\right)} \]
  7. Simplified91.2%

    \[\leadsto \color{blue}{c \cdot \mathsf{fma}\left(c, c \cdot \mathsf{fma}\left(-2, \frac{{a}^{2}}{{b}^{5}}, -0.25 \cdot \left(c \cdot \left(\frac{\frac{{a}^{4}}{{b}^{6}}}{b} \cdot \frac{20}{a}\right)\right)\right) - \frac{a}{{b}^{3}}, \frac{-1}{b}\right)} \]
  8. Taylor expanded in c around 0 91.2%

    \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-5 \cdot \frac{{a}^{3} \cdot c}{{b}^{7}} + -2 \cdot \frac{{a}^{2}}{{b}^{5}}\right)\right) - \frac{1}{b}\right)} \]
  9. Final simplification91.2%

    \[\leadsto c \cdot \left(c \cdot \left(c \cdot \left(-5 \cdot \frac{c \cdot {a}^{3}}{{b}^{7}} + -2 \cdot \frac{{a}^{2}}{{b}^{5}}\right) - \frac{a}{{b}^{3}}\right) + \frac{-1}{b}\right) \]
  10. Add Preprocessing

Alternative 5: 89.4% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right) + 2 \cdot \left({c}^{3} \cdot \frac{{a}^{2}}{{b}^{4}}\right)}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.0)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* 2.0 a))
   (/
    (+
     (fma a (pow (/ c b) 2.0) c)
     (* 2.0 (* (pow c 3.0) (/ (pow a 2.0) (pow b 4.0)))))
    (- b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.0) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (2.0 * a);
	} else {
		tmp = (fma(a, pow((c / b), 2.0), c) + (2.0 * (pow(c, 3.0) * (pow(a, 2.0) / pow(b, 4.0))))) / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.0)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(fma(a, (Float64(c / b) ^ 2.0), c) + Float64(2.0 * Float64((c ^ 3.0) * Float64((a ^ 2.0) / (b ^ 4.0))))) / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 1.0], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision] + c), $MachinePrecision] + N[(2.0 * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[Power[a, 2.0], $MachinePrecision] / N[Power[b, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-b)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right) + 2 \cdot \left({c}^{3} \cdot \frac{{a}^{2}}{{b}^{4}}\right)}{-b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative82.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
      2. +-commutative82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{a \cdot 2} \]
      3. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{a \cdot 2} \]
      4. unsub-neg82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg83.1%

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}} - b}{a \cdot 2} \]
      7. distribute-lft-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2} \]
      8. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)} - b}{a \cdot 2} \]
      10. distribute-rgt-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)} - b}{a \cdot 2} \]
      11. metadata-eval83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified83.1%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing

    if 1 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative52.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in c around 0 93.4%

      \[\leadsto \color{blue}{c \cdot \left(c \cdot \left(-1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right)\right) - \frac{1}{b}\right)} \]
    6. Step-by-step derivation
      1. fma-neg93.4%

        \[\leadsto c \cdot \color{blue}{\mathsf{fma}\left(c, -1 \cdot \frac{a}{{b}^{3}} + c \cdot \left(-2 \cdot \frac{{a}^{2}}{{b}^{5}} + -0.25 \cdot \frac{c \cdot \left(4 \cdot \frac{{a}^{4}}{{b}^{6}} + 16 \cdot \frac{{a}^{4}}{{b}^{6}}\right)}{a \cdot b}\right), -\frac{1}{b}\right)} \]
    7. Simplified93.4%

      \[\leadsto \color{blue}{c \cdot \mathsf{fma}\left(c, c \cdot \mathsf{fma}\left(-2, \frac{{a}^{2}}{{b}^{5}}, -0.25 \cdot \left(c \cdot \left(\frac{\frac{{a}^{4}}{{b}^{6}}}{b} \cdot \frac{20}{a}\right)\right)\right) - \frac{a}{{b}^{3}}, \frac{-1}{b}\right)} \]
    8. Taylor expanded in b around -inf 90.8%

      \[\leadsto \color{blue}{-1 \cdot \frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)}{b}} \]
    9. Step-by-step derivation
      1. mul-1-neg90.8%

        \[\leadsto \color{blue}{-\frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)}{b}} \]
      2. distribute-neg-frac290.8%

        \[\leadsto \color{blue}{\frac{c + \left(2 \cdot \frac{{a}^{2} \cdot {c}^{3}}{{b}^{4}} + \frac{a \cdot {c}^{2}}{{b}^{2}}\right)}{-b}} \]
    10. Simplified90.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right) + 2 \cdot \left({c}^{3} \cdot \frac{{a}^{2}}{{b}^{4}}\right)}{-b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right) + 2 \cdot \left({c}^{3} \cdot \frac{{a}^{2}}{{b}^{4}}\right)}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 89.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left({c}^{3} \cdot \left(\left(a \cdot -2\right) \cdot {b}^{-5} - \frac{{b}^{-3}}{c}\right)\right) - \frac{c}{b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.0)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* 2.0 a))
   (-
    (* a (* (pow c 3.0) (- (* (* a -2.0) (pow b -5.0)) (/ (pow b -3.0) c))))
    (/ c b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.0) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (2.0 * a);
	} else {
		tmp = (a * (pow(c, 3.0) * (((a * -2.0) * pow(b, -5.0)) - (pow(b, -3.0) / c)))) - (c / b);
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.0)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(Float64(a * Float64((c ^ 3.0) * Float64(Float64(Float64(a * -2.0) * (b ^ -5.0)) - Float64((b ^ -3.0) / c)))) - Float64(c / b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 1.0], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(N[Power[c, 3.0], $MachinePrecision] * N[(N[(N[(a * -2.0), $MachinePrecision] * N[Power[b, -5.0], $MachinePrecision]), $MachinePrecision] - N[(N[Power[b, -3.0], $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(c / b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;a \cdot \left({c}^{3} \cdot \left(\left(a \cdot -2\right) \cdot {b}^{-5} - \frac{{b}^{-3}}{c}\right)\right) - \frac{c}{b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative82.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
      2. +-commutative82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{a \cdot 2} \]
      3. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{a \cdot 2} \]
      4. unsub-neg82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg83.1%

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}} - b}{a \cdot 2} \]
      7. distribute-lft-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2} \]
      8. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)} - b}{a \cdot 2} \]
      10. distribute-rgt-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)} - b}{a \cdot 2} \]
      11. metadata-eval83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified83.1%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing

    if 1 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. +-commutative52.8%

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{2 \cdot a} \]
      2. sqr-neg52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \]
      3. unsub-neg52.8%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{2 \cdot a} \]
      4. sqr-neg52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a} \]
      5. sub-neg52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b + \left(-\left(4 \cdot a\right) \cdot c\right)}} - b}{2 \cdot a} \]
      6. +-commutative52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-\left(4 \cdot a\right) \cdot c\right) + b \cdot b}} - b}{2 \cdot a} \]
      7. *-commutative52.8%

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{\left(a \cdot 4\right)} \cdot c\right) + b \cdot b} - b}{2 \cdot a} \]
      8. associate-*r*52.8%

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{a \cdot \left(4 \cdot c\right)}\right) + b \cdot b} - b}{2 \cdot a} \]
      9. distribute-rgt-neg-in52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{a \cdot \left(-4 \cdot c\right)} + b \cdot b} - b}{2 \cdot a} \]
      10. fma-define52.8%

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right)}} - b}{2 \cdot a} \]
      11. *-commutative52.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, -\color{blue}{c \cdot 4}, b \cdot b\right)} - b}{2 \cdot a} \]
      12. distribute-rgt-neg-in52.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, \color{blue}{c \cdot \left(-4\right)}, b \cdot b\right)} - b}{2 \cdot a} \]
      13. metadata-eval52.8%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, c \cdot \color{blue}{-4}, b \cdot b\right)} - b}{2 \cdot a} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. div-sub52.4%

        \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a \cdot 2} - \frac{b}{a \cdot 2}} \]
      2. *-un-lft-identity52.4%

        \[\leadsto \frac{\color{blue}{1 \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}}{a \cdot 2} - \frac{b}{a \cdot 2} \]
      3. *-commutative52.4%

        \[\leadsto \frac{1 \cdot \sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{\color{blue}{2 \cdot a}} - \frac{b}{a \cdot 2} \]
      4. times-frac52.4%

        \[\leadsto \color{blue}{\frac{1}{2} \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a}} - \frac{b}{a \cdot 2} \]
      5. metadata-eval52.4%

        \[\leadsto \color{blue}{0.5} \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)}}{a} - \frac{b}{a \cdot 2} \]
      6. pow252.4%

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, \color{blue}{{b}^{2}}\right)}}{a} - \frac{b}{a \cdot 2} \]
      7. *-un-lft-identity52.4%

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{\color{blue}{1 \cdot b}}{a \cdot 2} \]
      8. *-commutative52.4%

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \frac{1 \cdot b}{\color{blue}{2 \cdot a}} \]
      9. times-frac52.4%

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \color{blue}{\frac{1}{2} \cdot \frac{b}{a}} \]
      10. metadata-eval52.4%

        \[\leadsto 0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - \color{blue}{0.5} \cdot \frac{b}{a} \]
    6. Applied egg-rr52.4%

      \[\leadsto \color{blue}{0.5 \cdot \frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, {b}^{2}\right)}}{a} - 0.5 \cdot \frac{b}{a}} \]
    7. Taylor expanded in a around 0 90.7%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + a \cdot \left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + -1 \cdot \frac{{c}^{2}}{{b}^{3}}\right)} \]
    8. Step-by-step derivation
      1. neg-mul-190.7%

        \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} + a \cdot \left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + -1 \cdot \frac{{c}^{2}}{{b}^{3}}\right) \]
      2. +-commutative90.7%

        \[\leadsto \color{blue}{a \cdot \left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + -1 \cdot \frac{{c}^{2}}{{b}^{3}}\right) + \left(-\frac{c}{b}\right)} \]
      3. unsub-neg90.7%

        \[\leadsto \color{blue}{a \cdot \left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + -1 \cdot \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
      4. mul-1-neg90.7%

        \[\leadsto a \cdot \left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} + \color{blue}{\left(-\frac{{c}^{2}}{{b}^{3}}\right)}\right) - \frac{c}{b} \]
      5. unsub-neg90.7%

        \[\leadsto a \cdot \color{blue}{\left(-2 \cdot \frac{a \cdot {c}^{3}}{{b}^{5}} - \frac{{c}^{2}}{{b}^{3}}\right)} - \frac{c}{b} \]
      6. associate-*r/90.7%

        \[\leadsto a \cdot \left(\color{blue}{\frac{-2 \cdot \left(a \cdot {c}^{3}\right)}{{b}^{5}}} - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b} \]
    9. Simplified90.7%

      \[\leadsto \color{blue}{a \cdot \left(\frac{-2 \cdot \left(a \cdot {c}^{3}\right)}{{b}^{5}} - \frac{{c}^{2}}{{b}^{3}}\right) - \frac{c}{b}} \]
    10. Taylor expanded in c around inf 90.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{3} \cdot \left(-2 \cdot \frac{a}{{b}^{5}} - \frac{1}{{b}^{3} \cdot c}\right)\right)} - \frac{c}{b} \]
    11. Step-by-step derivation
      1. pow190.7%

        \[\leadsto a \cdot \color{blue}{{\left({c}^{3} \cdot \left(-2 \cdot \frac{a}{{b}^{5}} - \frac{1}{{b}^{3} \cdot c}\right)\right)}^{1}} - \frac{c}{b} \]
      2. fma-neg90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \color{blue}{\mathsf{fma}\left(-2, \frac{a}{{b}^{5}}, -\frac{1}{{b}^{3} \cdot c}\right)}\right)}^{1} - \frac{c}{b} \]
      3. div-inv90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, \color{blue}{a \cdot \frac{1}{{b}^{5}}}, -\frac{1}{{b}^{3} \cdot c}\right)\right)}^{1} - \frac{c}{b} \]
      4. pow-flip90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot \color{blue}{{b}^{\left(-5\right)}}, -\frac{1}{{b}^{3} \cdot c}\right)\right)}^{1} - \frac{c}{b} \]
      5. metadata-eval90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{\color{blue}{-5}}, -\frac{1}{{b}^{3} \cdot c}\right)\right)}^{1} - \frac{c}{b} \]
      6. associate-/r*90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{-5}, -\color{blue}{\frac{\frac{1}{{b}^{3}}}{c}}\right)\right)}^{1} - \frac{c}{b} \]
      7. pow-flip90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{-5}, -\frac{\color{blue}{{b}^{\left(-3\right)}}}{c}\right)\right)}^{1} - \frac{c}{b} \]
      8. metadata-eval90.7%

        \[\leadsto a \cdot {\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{-5}, -\frac{{b}^{\color{blue}{-3}}}{c}\right)\right)}^{1} - \frac{c}{b} \]
    12. Applied egg-rr90.7%

      \[\leadsto a \cdot \color{blue}{{\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{-5}, -\frac{{b}^{-3}}{c}\right)\right)}^{1}} - \frac{c}{b} \]
    13. Step-by-step derivation
      1. unpow190.7%

        \[\leadsto a \cdot \color{blue}{\left({c}^{3} \cdot \mathsf{fma}\left(-2, a \cdot {b}^{-5}, -\frac{{b}^{-3}}{c}\right)\right)} - \frac{c}{b} \]
      2. fma-neg90.7%

        \[\leadsto a \cdot \left({c}^{3} \cdot \color{blue}{\left(-2 \cdot \left(a \cdot {b}^{-5}\right) - \frac{{b}^{-3}}{c}\right)}\right) - \frac{c}{b} \]
      3. associate-*r*90.7%

        \[\leadsto a \cdot \left({c}^{3} \cdot \left(\color{blue}{\left(-2 \cdot a\right) \cdot {b}^{-5}} - \frac{{b}^{-3}}{c}\right)\right) - \frac{c}{b} \]
      4. *-commutative90.7%

        \[\leadsto a \cdot \left({c}^{3} \cdot \left(\color{blue}{\left(a \cdot -2\right)} \cdot {b}^{-5} - \frac{{b}^{-3}}{c}\right)\right) - \frac{c}{b} \]
    14. Simplified90.7%

      \[\leadsto a \cdot \color{blue}{\left({c}^{3} \cdot \left(\left(a \cdot -2\right) \cdot {b}^{-5} - \frac{{b}^{-3}}{c}\right)\right)} - \frac{c}{b} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification89.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;a \cdot \left({c}^{3} \cdot \left(\left(a \cdot -2\right) \cdot {b}^{-5} - \frac{{b}^{-3}}{c}\right)\right) - \frac{c}{b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 84.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.0)
   (/ (- (sqrt (fma a (* c -4.0) (* b b))) b) (* 2.0 a))
   (/ (fma a (pow (/ c b) 2.0) c) (- b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.0) {
		tmp = (sqrt(fma(a, (c * -4.0), (b * b))) - b) / (2.0 * a);
	} else {
		tmp = fma(a, pow((c / b), 2.0), c) / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.0)
		tmp = Float64(Float64(sqrt(fma(a, Float64(c * -4.0), Float64(b * b))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(fma(a, (Float64(c / b) ^ 2.0), c) / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 1.0], N[(N[(N[Sqrt[N[(a * N[(c * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision] + c), $MachinePrecision] / (-b)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. +-commutative82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{2 \cdot a} \]
      2. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{2 \cdot a} \]
      3. unsub-neg82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{2 \cdot a} \]
      4. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{2 \cdot a} \]
      5. sub-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b + \left(-\left(4 \cdot a\right) \cdot c\right)}} - b}{2 \cdot a} \]
      6. +-commutative82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-\left(4 \cdot a\right) \cdot c\right) + b \cdot b}} - b}{2 \cdot a} \]
      7. *-commutative82.9%

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{\left(a \cdot 4\right)} \cdot c\right) + b \cdot b} - b}{2 \cdot a} \]
      8. associate-*r*82.9%

        \[\leadsto \frac{\sqrt{\left(-\color{blue}{a \cdot \left(4 \cdot c\right)}\right) + b \cdot b} - b}{2 \cdot a} \]
      9. distribute-rgt-neg-in82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{a \cdot \left(-4 \cdot c\right)} + b \cdot b} - b}{2 \cdot a} \]
      10. fma-define82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{fma}\left(a, -4 \cdot c, b \cdot b\right)}} - b}{2 \cdot a} \]
      11. *-commutative82.9%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, -\color{blue}{c \cdot 4}, b \cdot b\right)} - b}{2 \cdot a} \]
      12. distribute-rgt-neg-in82.9%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, \color{blue}{c \cdot \left(-4\right)}, b \cdot b\right)} - b}{2 \cdot a} \]
      13. metadata-eval82.9%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(a, c \cdot \color{blue}{-4}, b \cdot b\right)} - b}{2 \cdot a} \]
    3. Simplified82.9%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing

    if 1 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative52.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 85.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    6. Step-by-step derivation
      1. mul-1-neg85.2%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
      2. unsub-neg85.2%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
      3. mul-1-neg85.2%

        \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      4. distribute-neg-frac285.2%

        \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      5. associate-/l*85.2%

        \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    7. Simplified85.2%

      \[\leadsto \color{blue}{\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u77.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right)} \]
      2. distribute-frac-neg277.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(-\frac{c}{b}\right)} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right) \]
      3. *-commutative77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a}\right)\right) \]
      4. div-inv77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\left({c}^{2} \cdot \frac{1}{{b}^{3}}\right)} \cdot a\right)\right) \]
      5. pow-flip77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot \color{blue}{{b}^{\left(-3\right)}}\right) \cdot a\right)\right) \]
      6. metadata-eval77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{\color{blue}{-3}}\right) \cdot a\right)\right) \]
    9. Applied egg-rr77.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} \]
    10. Step-by-step derivation
      1. expm1-undefine58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} - 1} \]
      2. sub-neg58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} + \left(-1\right)} \]
      3. log1p-undefine58.1%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}} + \left(-1\right) \]
      4. rem-exp-log65.4%

        \[\leadsto \color{blue}{\left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      5. sub-neg65.4%

        \[\leadsto \left(1 + \color{blue}{\left(\left(-\frac{c}{b}\right) + \left(-\left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      6. distribute-neg-out65.4%

        \[\leadsto \left(1 + \color{blue}{\left(-\left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      7. unsub-neg65.4%

        \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      8. *-commutative65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + \color{blue}{a \cdot \left({c}^{2} \cdot {b}^{-3}\right)}\right)\right) + \left(-1\right) \]
      9. metadata-eval65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + \color{blue}{-1} \]
    11. Simplified65.4%

      \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + -1} \]
    12. Taylor expanded in c around 0 85.1%

      \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
    13. Simplified85.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(a, c \cdot -4, b \cdot b\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.02)
   (/ (- (sqrt (fma b b (* c (* a -4.0)))) b) (* 2.0 a))
   (/ (fma a (pow (/ c b) 2.0) c) (- b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.02) {
		tmp = (sqrt(fma(b, b, (c * (a * -4.0)))) - b) / (2.0 * a);
	} else {
		tmp = fma(a, pow((c / b), 2.0), c) / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.02)
		tmp = Float64(Float64(sqrt(fma(b, b, Float64(c * Float64(a * -4.0)))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(fma(a, (Float64(c / b) ^ 2.0), c) / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 1.02], N[(N[(N[Sqrt[N[(b * b + N[(c * N[(a * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision] + c), $MachinePrecision] / (-b)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.02:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.02

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative82.9%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
      2. +-commutative82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}}{a \cdot 2} \]
      3. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{\left(-b\right) \cdot \left(-b\right)} - \left(4 \cdot a\right) \cdot c} + \left(-b\right)}{a \cdot 2} \]
      4. unsub-neg82.9%

        \[\leadsto \frac{\color{blue}{\sqrt{\left(-b\right) \cdot \left(-b\right) - \left(4 \cdot a\right) \cdot c} - b}}{a \cdot 2} \]
      5. sqr-neg82.9%

        \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - \left(4 \cdot a\right) \cdot c} - b}{a \cdot 2} \]
      6. fma-neg83.1%

        \[\leadsto \frac{\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(4 \cdot a\right) \cdot c\right)}} - b}{a \cdot 2} \]
      7. distribute-lft-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{\left(-4 \cdot a\right) \cdot c}\right)} - b}{a \cdot 2} \]
      8. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, \color{blue}{c \cdot \left(-4 \cdot a\right)}\right)} - b}{a \cdot 2} \]
      9. *-commutative83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(-\color{blue}{a \cdot 4}\right)\right)} - b}{a \cdot 2} \]
      10. distribute-rgt-neg-in83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \color{blue}{\left(a \cdot \left(-4\right)\right)}\right)} - b}{a \cdot 2} \]
      11. metadata-eval83.1%

        \[\leadsto \frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot \color{blue}{-4}\right)\right)} - b}{a \cdot 2} \]
    3. Simplified83.1%

      \[\leadsto \color{blue}{\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{a \cdot 2}} \]
    4. Add Preprocessing

    if 1.02 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative52.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 85.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    6. Step-by-step derivation
      1. mul-1-neg85.2%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
      2. unsub-neg85.2%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
      3. mul-1-neg85.2%

        \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      4. distribute-neg-frac285.2%

        \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      5. associate-/l*85.2%

        \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    7. Simplified85.2%

      \[\leadsto \color{blue}{\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u77.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right)} \]
      2. distribute-frac-neg277.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(-\frac{c}{b}\right)} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right) \]
      3. *-commutative77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a}\right)\right) \]
      4. div-inv77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\left({c}^{2} \cdot \frac{1}{{b}^{3}}\right)} \cdot a\right)\right) \]
      5. pow-flip77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot \color{blue}{{b}^{\left(-3\right)}}\right) \cdot a\right)\right) \]
      6. metadata-eval77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{\color{blue}{-3}}\right) \cdot a\right)\right) \]
    9. Applied egg-rr77.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} \]
    10. Step-by-step derivation
      1. expm1-undefine58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} - 1} \]
      2. sub-neg58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} + \left(-1\right)} \]
      3. log1p-undefine58.1%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}} + \left(-1\right) \]
      4. rem-exp-log65.4%

        \[\leadsto \color{blue}{\left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      5. sub-neg65.4%

        \[\leadsto \left(1 + \color{blue}{\left(\left(-\frac{c}{b}\right) + \left(-\left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      6. distribute-neg-out65.4%

        \[\leadsto \left(1 + \color{blue}{\left(-\left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      7. unsub-neg65.4%

        \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      8. *-commutative65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + \color{blue}{a \cdot \left({c}^{2} \cdot {b}^{-3}\right)}\right)\right) + \left(-1\right) \]
      9. metadata-eval65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + \color{blue}{-1} \]
    11. Simplified65.4%

      \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + -1} \]
    12. Taylor expanded in c around 0 85.1%

      \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
    13. Simplified85.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{\mathsf{fma}\left(b, b, c \cdot \left(a \cdot -4\right)\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 84.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.02)
   (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a))
   (/ (fma a (pow (/ c b) 2.0) c) (- b))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.02) {
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
	} else {
		tmp = fma(a, pow((c / b), 2.0), c) / -b;
	}
	return tmp;
}
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.02)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(fma(a, (Float64(c / b) ^ 2.0), c) / Float64(-b));
	end
	return tmp
end
code[a_, b_, c_] := If[LessEqual[b, 1.02], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision] + c), $MachinePrecision] / (-b)), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.02:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.02

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing

    if 1.02 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative52.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in a around 0 85.2%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    6. Step-by-step derivation
      1. mul-1-neg85.2%

        \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
      2. unsub-neg85.2%

        \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
      3. mul-1-neg85.2%

        \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      4. distribute-neg-frac285.2%

        \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
      5. associate-/l*85.2%

        \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    7. Simplified85.2%

      \[\leadsto \color{blue}{\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
    8. Step-by-step derivation
      1. expm1-log1p-u77.8%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right)} \]
      2. distribute-frac-neg277.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(-\frac{c}{b}\right)} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right) \]
      3. *-commutative77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a}\right)\right) \]
      4. div-inv77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\left({c}^{2} \cdot \frac{1}{{b}^{3}}\right)} \cdot a\right)\right) \]
      5. pow-flip77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot \color{blue}{{b}^{\left(-3\right)}}\right) \cdot a\right)\right) \]
      6. metadata-eval77.8%

        \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{\color{blue}{-3}}\right) \cdot a\right)\right) \]
    9. Applied egg-rr77.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} \]
    10. Step-by-step derivation
      1. expm1-undefine58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} - 1} \]
      2. sub-neg58.1%

        \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} + \left(-1\right)} \]
      3. log1p-undefine58.1%

        \[\leadsto e^{\color{blue}{\log \left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}} + \left(-1\right) \]
      4. rem-exp-log65.4%

        \[\leadsto \color{blue}{\left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      5. sub-neg65.4%

        \[\leadsto \left(1 + \color{blue}{\left(\left(-\frac{c}{b}\right) + \left(-\left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      6. distribute-neg-out65.4%

        \[\leadsto \left(1 + \color{blue}{\left(-\left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
      7. unsub-neg65.4%

        \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
      8. *-commutative65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + \color{blue}{a \cdot \left({c}^{2} \cdot {b}^{-3}\right)}\right)\right) + \left(-1\right) \]
      9. metadata-eval65.4%

        \[\leadsto \left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + \color{blue}{-1} \]
    11. Simplified65.4%

      \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + -1} \]
    12. Taylor expanded in c around 0 85.1%

      \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
    13. Simplified85.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, {\left(\frac{c}{b}\right)}^{2}, c\right)}{-b}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 84.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right)\\ \end{array} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (if (<= b 1.02)
   (/ (- (sqrt (- (* b b) (* c (* a 4.0)))) b) (* 2.0 a))
   (* c (- (/ -1.0 b) (/ (* c a) (pow b 3.0))))))
double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.02) {
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
	} else {
		tmp = c * ((-1.0 / b) - ((c * a) / pow(b, 3.0)));
	}
	return tmp;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8) :: tmp
    if (b <= 1.02d0) then
        tmp = (sqrt(((b * b) - (c * (a * 4.0d0)))) - b) / (2.0d0 * a)
    else
        tmp = c * (((-1.0d0) / b) - ((c * a) / (b ** 3.0d0)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c) {
	double tmp;
	if (b <= 1.02) {
		tmp = (Math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
	} else {
		tmp = c * ((-1.0 / b) - ((c * a) / Math.pow(b, 3.0)));
	}
	return tmp;
}
def code(a, b, c):
	tmp = 0
	if b <= 1.02:
		tmp = (math.sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a)
	else:
		tmp = c * ((-1.0 / b) - ((c * a) / math.pow(b, 3.0)))
	return tmp
function code(a, b, c)
	tmp = 0.0
	if (b <= 1.02)
		tmp = Float64(Float64(sqrt(Float64(Float64(b * b) - Float64(c * Float64(a * 4.0)))) - b) / Float64(2.0 * a));
	else
		tmp = Float64(c * Float64(Float64(-1.0 / b) - Float64(Float64(c * a) / (b ^ 3.0))));
	end
	return tmp
end
function tmp_2 = code(a, b, c)
	tmp = 0.0;
	if (b <= 1.02)
		tmp = (sqrt(((b * b) - (c * (a * 4.0)))) - b) / (2.0 * a);
	else
		tmp = c * ((-1.0 / b) - ((c * a) / (b ^ 3.0)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_] := If[LessEqual[b, 1.02], N[(N[(N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(c * N[(a * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - b), $MachinePrecision] / N[(2.0 * a), $MachinePrecision]), $MachinePrecision], N[(c * N[(N[(-1.0 / b), $MachinePrecision] - N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;b \leq 1.02:\\
\;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\

\mathbf{else}:\\
\;\;\;\;c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if b < 1.02

    1. Initial program 82.9%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Add Preprocessing

    if 1.02 < b

    1. Initial program 52.8%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
    2. Step-by-step derivation
      1. *-commutative52.8%

        \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
    3. Simplified52.8%

      \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
    4. Add Preprocessing
    5. Taylor expanded in c around 0 85.1%

      \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
    6. Step-by-step derivation
      1. associate-*r/85.1%

        \[\leadsto c \cdot \left(\color{blue}{\frac{-1 \cdot \left(a \cdot c\right)}{{b}^{3}}} - \frac{1}{b}\right) \]
      2. neg-mul-185.1%

        \[\leadsto c \cdot \left(\frac{\color{blue}{-a \cdot c}}{{b}^{3}} - \frac{1}{b}\right) \]
      3. distribute-rgt-neg-in85.1%

        \[\leadsto c \cdot \left(\frac{\color{blue}{a \cdot \left(-c\right)}}{{b}^{3}} - \frac{1}{b}\right) \]
    7. Simplified85.1%

      \[\leadsto \color{blue}{c \cdot \left(\frac{a \cdot \left(-c\right)}{{b}^{3}} - \frac{1}{b}\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;b \leq 1.02:\\ \;\;\;\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{2 \cdot a}\\ \mathbf{else}:\\ \;\;\;\;c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 81.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ a \cdot \frac{\frac{c}{-a} - {\left(\frac{c}{b}\right)}^{2}}{b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (* a (/ (- (/ c (- a)) (pow (/ c b) 2.0)) b)))
double code(double a, double b, double c) {
	return a * (((c / -a) - pow((c / b), 2.0)) / b);
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = a * (((c / -a) - ((c / b) ** 2.0d0)) / b)
end function
public static double code(double a, double b, double c) {
	return a * (((c / -a) - Math.pow((c / b), 2.0)) / b);
}
def code(a, b, c):
	return a * (((c / -a) - math.pow((c / b), 2.0)) / b)
function code(a, b, c)
	return Float64(a * Float64(Float64(Float64(c / Float64(-a)) - (Float64(c / b) ^ 2.0)) / b))
end
function tmp = code(a, b, c)
	tmp = a * (((c / -a) - ((c / b) ^ 2.0)) / b);
end
code[a_, b_, c_] := N[(a * N[(N[(N[(c / (-a)), $MachinePrecision] - N[Power[N[(c / b), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
a \cdot \frac{\frac{c}{-a} - {\left(\frac{c}{b}\right)}^{2}}{b}
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in a around 0 81.5%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
  6. Step-by-step derivation
    1. mul-1-neg81.5%

      \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
    2. unsub-neg81.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    3. mul-1-neg81.5%

      \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
    4. distribute-neg-frac281.5%

      \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
    5. associate-/l*81.5%

      \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
  7. Simplified81.5%

    \[\leadsto \color{blue}{\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
  8. Taylor expanded in a around inf 81.3%

    \[\leadsto \color{blue}{a \cdot \left(-1 \cdot \frac{c}{a \cdot b} - \frac{{c}^{2}}{{b}^{3}}\right)} \]
  9. Step-by-step derivation
    1. associate-*r/81.3%

      \[\leadsto a \cdot \left(\color{blue}{\frac{-1 \cdot c}{a \cdot b}} - \frac{{c}^{2}}{{b}^{3}}\right) \]
    2. *-commutative81.3%

      \[\leadsto a \cdot \left(\frac{-1 \cdot c}{\color{blue}{b \cdot a}} - \frac{{c}^{2}}{{b}^{3}}\right) \]
    3. associate-/r*81.3%

      \[\leadsto a \cdot \left(\color{blue}{\frac{\frac{-1 \cdot c}{b}}{a}} - \frac{{c}^{2}}{{b}^{3}}\right) \]
    4. mul-1-neg81.3%

      \[\leadsto a \cdot \left(\frac{\frac{\color{blue}{-c}}{b}}{a} - \frac{{c}^{2}}{{b}^{3}}\right) \]
  10. Simplified81.3%

    \[\leadsto \color{blue}{a \cdot \left(\frac{\frac{-c}{b}}{a} - \frac{{c}^{2}}{{b}^{3}}\right)} \]
  11. Taylor expanded in b around inf 81.3%

    \[\leadsto a \cdot \color{blue}{\frac{-1 \cdot \frac{c}{a} + -1 \cdot \frac{{c}^{2}}{{b}^{2}}}{b}} \]
  12. Step-by-step derivation
    1. mul-1-neg81.3%

      \[\leadsto a \cdot \frac{-1 \cdot \frac{c}{a} + \color{blue}{\left(-\frac{{c}^{2}}{{b}^{2}}\right)}}{b} \]
    2. unsub-neg81.3%

      \[\leadsto a \cdot \frac{\color{blue}{-1 \cdot \frac{c}{a} - \frac{{c}^{2}}{{b}^{2}}}}{b} \]
    3. associate-*r/81.3%

      \[\leadsto a \cdot \frac{\color{blue}{\frac{-1 \cdot c}{a}} - \frac{{c}^{2}}{{b}^{2}}}{b} \]
    4. neg-mul-181.3%

      \[\leadsto a \cdot \frac{\frac{\color{blue}{-c}}{a} - \frac{{c}^{2}}{{b}^{2}}}{b} \]
    5. unpow281.3%

      \[\leadsto a \cdot \frac{\frac{-c}{a} - \frac{\color{blue}{c \cdot c}}{{b}^{2}}}{b} \]
    6. unpow281.3%

      \[\leadsto a \cdot \frac{\frac{-c}{a} - \frac{c \cdot c}{\color{blue}{b \cdot b}}}{b} \]
    7. times-frac81.3%

      \[\leadsto a \cdot \frac{\frac{-c}{a} - \color{blue}{\frac{c}{b} \cdot \frac{c}{b}}}{b} \]
    8. unpow281.3%

      \[\leadsto a \cdot \frac{\frac{-c}{a} - \color{blue}{{\left(\frac{c}{b}\right)}^{2}}}{b} \]
  13. Simplified81.3%

    \[\leadsto a \cdot \color{blue}{\frac{\frac{-c}{a} - {\left(\frac{c}{b}\right)}^{2}}{b}} \]
  14. Final simplification81.3%

    \[\leadsto a \cdot \frac{\frac{c}{-a} - {\left(\frac{c}{b}\right)}^{2}}{b} \]
  15. Add Preprocessing

Alternative 12: 81.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (* c (- (/ -1.0 b) (/ (* c a) (pow b 3.0)))))
double code(double a, double b, double c) {
	return c * ((-1.0 / b) - ((c * a) / pow(b, 3.0)));
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c * (((-1.0d0) / b) - ((c * a) / (b ** 3.0d0)))
end function
public static double code(double a, double b, double c) {
	return c * ((-1.0 / b) - ((c * a) / Math.pow(b, 3.0)));
}
def code(a, b, c):
	return c * ((-1.0 / b) - ((c * a) / math.pow(b, 3.0)))
function code(a, b, c)
	return Float64(c * Float64(Float64(-1.0 / b) - Float64(Float64(c * a) / (b ^ 3.0))))
end
function tmp = code(a, b, c)
	tmp = c * ((-1.0 / b) - ((c * a) / (b ^ 3.0)));
end
code[a_, b_, c_] := N[(c * N[(N[(-1.0 / b), $MachinePrecision] - N[(N[(c * a), $MachinePrecision] / N[Power[b, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right)
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in c around 0 81.4%

    \[\leadsto \color{blue}{c \cdot \left(-1 \cdot \frac{a \cdot c}{{b}^{3}} - \frac{1}{b}\right)} \]
  6. Step-by-step derivation
    1. associate-*r/81.4%

      \[\leadsto c \cdot \left(\color{blue}{\frac{-1 \cdot \left(a \cdot c\right)}{{b}^{3}}} - \frac{1}{b}\right) \]
    2. neg-mul-181.4%

      \[\leadsto c \cdot \left(\frac{\color{blue}{-a \cdot c}}{{b}^{3}} - \frac{1}{b}\right) \]
    3. distribute-rgt-neg-in81.4%

      \[\leadsto c \cdot \left(\frac{\color{blue}{a \cdot \left(-c\right)}}{{b}^{3}} - \frac{1}{b}\right) \]
  7. Simplified81.4%

    \[\leadsto \color{blue}{c \cdot \left(\frac{a \cdot \left(-c\right)}{{b}^{3}} - \frac{1}{b}\right)} \]
  8. Final simplification81.4%

    \[\leadsto c \cdot \left(\frac{-1}{b} - \frac{c \cdot a}{{b}^{3}}\right) \]
  9. Add Preprocessing

Alternative 13: 64.5% accurate, 29.0× speedup?

\[\begin{array}{l} \\ \frac{c}{-b} \end{array} \]
(FPCore (a b c) :precision binary64 (/ c (- b)))
double code(double a, double b, double c) {
	return c / -b;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = c / -b
end function
public static double code(double a, double b, double c) {
	return c / -b;
}
def code(a, b, c):
	return c / -b
function code(a, b, c)
	return Float64(c / Float64(-b))
end
function tmp = code(a, b, c)
	tmp = c / -b;
end
code[a_, b_, c_] := N[(c / (-b)), $MachinePrecision]
\begin{array}{l}

\\
\frac{c}{-b}
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in b around inf 62.6%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b}} \]
  6. Step-by-step derivation
    1. associate-*r/62.6%

      \[\leadsto \color{blue}{\frac{-1 \cdot c}{b}} \]
    2. mul-1-neg62.6%

      \[\leadsto \frac{\color{blue}{-c}}{b} \]
  7. Simplified62.6%

    \[\leadsto \color{blue}{\frac{-c}{b}} \]
  8. Final simplification62.6%

    \[\leadsto \frac{c}{-b} \]
  9. Add Preprocessing

Alternative 14: 3.2% accurate, 116.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (a b c) :precision binary64 0.0)
double code(double a, double b, double c) {
	return 0.0;
}
real(8) function code(a, b, c)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    code = 0.0d0
end function
public static double code(double a, double b, double c) {
	return 0.0;
}
def code(a, b, c):
	return 0.0
function code(a, b, c)
	return 0.0
end
function tmp = code(a, b, c)
	tmp = 0.0;
end
code[a_, b_, c_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 57.2%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
  2. Step-by-step derivation
    1. *-commutative57.2%

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{a \cdot 2}} \]
  3. Simplified57.2%

    \[\leadsto \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{a \cdot 2}} \]
  4. Add Preprocessing
  5. Taylor expanded in a around 0 81.5%

    \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} + -1 \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
  6. Step-by-step derivation
    1. mul-1-neg81.5%

      \[\leadsto -1 \cdot \frac{c}{b} + \color{blue}{\left(-\frac{a \cdot {c}^{2}}{{b}^{3}}\right)} \]
    2. unsub-neg81.5%

      \[\leadsto \color{blue}{-1 \cdot \frac{c}{b} - \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    3. mul-1-neg81.5%

      \[\leadsto \color{blue}{\left(-\frac{c}{b}\right)} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
    4. distribute-neg-frac281.5%

      \[\leadsto \color{blue}{\frac{c}{-b}} - \frac{a \cdot {c}^{2}}{{b}^{3}} \]
    5. associate-/l*81.5%

      \[\leadsto \frac{c}{-b} - \color{blue}{a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
  7. Simplified81.5%

    \[\leadsto \color{blue}{\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}} \]
  8. Step-by-step derivation
    1. expm1-log1p-u74.8%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{c}{-b} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right)} \]
    2. distribute-frac-neg274.8%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\color{blue}{\left(-\frac{c}{b}\right)} - a \cdot \frac{{c}^{2}}{{b}^{3}}\right)\right) \]
    3. *-commutative74.8%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\frac{{c}^{2}}{{b}^{3}} \cdot a}\right)\right) \]
    4. div-inv74.8%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \color{blue}{\left({c}^{2} \cdot \frac{1}{{b}^{3}}\right)} \cdot a\right)\right) \]
    5. pow-flip74.8%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot \color{blue}{{b}^{\left(-3\right)}}\right) \cdot a\right)\right) \]
    6. metadata-eval74.8%

      \[\leadsto \mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{\color{blue}{-3}}\right) \cdot a\right)\right) \]
  9. Applied egg-rr74.8%

    \[\leadsto \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} \]
  10. Step-by-step derivation
    1. expm1-undefine57.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} - 1} \]
    2. sub-neg57.7%

      \[\leadsto \color{blue}{e^{\mathsf{log1p}\left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)} + \left(-1\right)} \]
    3. log1p-undefine57.7%

      \[\leadsto e^{\color{blue}{\log \left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}} + \left(-1\right) \]
    4. rem-exp-log64.3%

      \[\leadsto \color{blue}{\left(1 + \left(\left(-\frac{c}{b}\right) - \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
    5. sub-neg64.3%

      \[\leadsto \left(1 + \color{blue}{\left(\left(-\frac{c}{b}\right) + \left(-\left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
    6. distribute-neg-out64.3%

      \[\leadsto \left(1 + \color{blue}{\left(-\left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)}\right) + \left(-1\right) \]
    7. unsub-neg64.3%

      \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + \left({c}^{2} \cdot {b}^{-3}\right) \cdot a\right)\right)} + \left(-1\right) \]
    8. *-commutative64.3%

      \[\leadsto \left(1 - \left(\frac{c}{b} + \color{blue}{a \cdot \left({c}^{2} \cdot {b}^{-3}\right)}\right)\right) + \left(-1\right) \]
    9. metadata-eval64.3%

      \[\leadsto \left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + \color{blue}{-1} \]
  11. Simplified64.3%

    \[\leadsto \color{blue}{\left(1 - \left(\frac{c}{b} + a \cdot \left({c}^{2} \cdot {b}^{-3}\right)\right)\right) + -1} \]
  12. Taylor expanded in c around 0 52.4%

    \[\leadsto \left(1 - \color{blue}{\frac{c}{b}}\right) + -1 \]
  13. Taylor expanded in c around 0 3.2%

    \[\leadsto \color{blue}{1} + -1 \]
  14. Final simplification3.2%

    \[\leadsto 0 \]
  15. Add Preprocessing

Reproduce

?
herbie shell --seed 2024067 
(FPCore (a b c)
  :name "Quadratic roots, narrow range"
  :precision binary64
  :pre (and (and (and (< 1.0536712127723509e-8 a) (< a 94906265.62425156)) (and (< 1.0536712127723509e-8 b) (< b 94906265.62425156))) (and (< 1.0536712127723509e-8 c) (< c 94906265.62425156)))
  (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))