Cubic critical, wide range

Percentage Accurate: 17.9% → 99.4%
Time: 8.0s
Alternatives: 7
Speedup: 2.9×

Specification

?
\[\left(\left(4.930380657631324 \cdot 10^{-32} < a \land a < 2.028240960365167 \cdot 10^{+31}\right) \land \left(4.930380657631324 \cdot 10^{-32} < b \land b < 2.028240960365167 \cdot 10^{+31}\right)\right) \land \left(4.930380657631324 \cdot 10^{-32} < c \land c < 2.028240960365167 \cdot 10^{+31}\right)\]
\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \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 7 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: 17.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.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) - ((3.0d0 * a) * c)))) / (3.0d0 * a)
end function
public static double code(double a, double b, double c) {
	return (-b + Math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
}
def code(a, b, c):
	return (-b + math.sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a)
function code(a, b, c)
	return Float64(Float64(Float64(-b) + sqrt(Float64(Float64(b * b) - Float64(Float64(3.0 * a) * c)))) / Float64(3.0 * a))
end
function tmp = code(a, b, c)
	tmp = (-b + sqrt(((b * b) - ((3.0 * a) * c)))) / (3.0 * a);
end
code[a_, b_, c_] := N[(N[((-b) + N[Sqrt[N[(N[(b * b), $MachinePrecision] - N[(N[(3.0 * a), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.4% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \frac{\frac{\mathsf{fma}\left(-3 \cdot a, c, 0\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + b}}{3 \cdot a} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (/ (fma (* -3.0 a) c 0.0) (+ (sqrt (fma (* c a) -3.0 (* b b))) b))
  (* 3.0 a)))
double code(double a, double b, double c) {
	return (fma((-3.0 * a), c, 0.0) / (sqrt(fma((c * a), -3.0, (b * b))) + b)) / (3.0 * a);
}
function code(a, b, c)
	return Float64(Float64(fma(Float64(-3.0 * a), c, 0.0) / Float64(sqrt(fma(Float64(c * a), -3.0, Float64(b * b))) + b)) / Float64(3.0 * a))
end
code[a_, b_, c_] := N[(N[(N[(N[(-3.0 * a), $MachinePrecision] * c + 0.0), $MachinePrecision] / N[(N[Sqrt[N[(N[(c * a), $MachinePrecision] * -3.0 + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision]), $MachinePrecision] / N[(3.0 * a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\frac{\mathsf{fma}\left(-3 \cdot a, c, 0\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + b}}{3 \cdot a}
\end{array}
Derivation
  1. Initial program 20.3%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
    3. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(3 \cdot a\right)\right) \cdot c}}}{3 \cdot a} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(3 \cdot a\right)\right) \cdot c + b \cdot b}}}{3 \cdot a} \]
    5. *-commutativeN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{c \cdot \left(\mathsf{neg}\left(3 \cdot a\right)\right)} + b \cdot b}}{3 \cdot a} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{c \cdot \left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right)\right) + b \cdot b}}{3 \cdot a} \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{c \cdot \color{blue}{\left(\left(\mathsf{neg}\left(3\right)\right) \cdot a\right)} + b \cdot b}}{3 \cdot a} \]
    8. associate-*r*N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(c \cdot \left(\mathsf{neg}\left(3\right)\right)\right) \cdot a} + b \cdot b}}{3 \cdot a} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c \cdot \left(\mathsf{neg}\left(3\right)\right), a, b \cdot b\right)}}}{3 \cdot a} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(\color{blue}{c \cdot \left(\mathsf{neg}\left(3\right)\right)}, a, b \cdot b\right)}}{3 \cdot a} \]
    11. metadata-eval20.3

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}}}{3 \cdot a} \]
    2. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} + \left(-b\right)}}{3 \cdot a} \]
    3. lift-sqrt.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    4. lift-fma.f64N/A

      \[\leadsto \frac{\sqrt{\color{blue}{\left(c \cdot -3\right) \cdot a + b \cdot b}} + \left(-b\right)}{3 \cdot a} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b + \left(c \cdot -3\right) \cdot a}} + \left(-b\right)}{3 \cdot a} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(c \cdot -3\right)} \cdot a} + \left(-b\right)}{3 \cdot a} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(-3 \cdot c\right)} \cdot a} + \left(-b\right)}{3 \cdot a} \]
    8. associate-*l*N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{-3 \cdot \left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    9. metadata-evalN/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(\mathsf{neg}\left(3\right)\right)} \cdot \left(c \cdot a\right)} + \left(-b\right)}{3 \cdot a} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \left(\mathsf{neg}\left(3\right)\right) \cdot \color{blue}{\left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    11. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - 3 \cdot \left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    12. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - 3 \cdot \left(c \cdot a\right)} + \left(-b\right)}{3 \cdot a} \]
    13. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b - 3 \cdot \color{blue}{\left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    14. *-commutativeN/A

      \[\leadsto \frac{\sqrt{b \cdot b - 3 \cdot \color{blue}{\left(a \cdot c\right)}} + \left(-b\right)}{3 \cdot a} \]
    15. associate-*l*N/A

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

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}, -b\right)}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}}{3 \cdot a} \]
    2. lift-sqrt.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    3. lift-sqrt.f64N/A

      \[\leadsto \frac{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} \cdot \color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}} + \left(-b\right)}{3 \cdot a} \]
    4. rem-square-sqrtN/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    5. flip-+N/A

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - \left(-b\right) \cdot \left(-b\right)}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - \left(-b\right)}}}{3 \cdot a} \]
    6. lower-/.f64N/A

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

    \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}}{3 \cdot a} \]
  9. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    2. lift-fma.f64N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(\left(c \cdot a\right) \cdot -3 + b \cdot b\right)} - b \cdot b}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    3. associate--l+N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(c \cdot a\right) \cdot -3 + \left(b \cdot b - b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    4. *-commutativeN/A

      \[\leadsto \frac{\frac{\color{blue}{-3 \cdot \left(c \cdot a\right)} + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\frac{-3 \cdot \color{blue}{\left(c \cdot a\right)} + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    6. *-commutativeN/A

      \[\leadsto \frac{\frac{-3 \cdot \color{blue}{\left(a \cdot c\right)} + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    7. associate-*r*N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(-3 \cdot a\right) \cdot c} + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    8. metadata-evalN/A

      \[\leadsto \frac{\frac{\left(\color{blue}{\left(\mathsf{neg}\left(3\right)\right)} \cdot a\right) \cdot c + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    9. distribute-lft-neg-inN/A

      \[\leadsto \frac{\frac{\color{blue}{\left(\mathsf{neg}\left(3 \cdot a\right)\right)} \cdot c + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right)\right) \cdot c + \left(b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    11. lower-fma.f64N/A

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(3 \cdot a\right), c, b \cdot b - b \cdot b\right)}}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    12. lift-*.f64N/A

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right), c, b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    13. distribute-lft-neg-inN/A

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(3\right)\right) \cdot a}, c, b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    14. metadata-evalN/A

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\color{blue}{-3} \cdot a, c, b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    15. lower-*.f64N/A

      \[\leadsto \frac{\frac{\mathsf{fma}\left(\color{blue}{-3 \cdot a}, c, b \cdot b - b \cdot b\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
    16. +-inverses99.4

      \[\leadsto \frac{\frac{\mathsf{fma}\left(-3 \cdot a, c, \color{blue}{0}\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
  10. Applied rewrites99.4%

    \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(-3 \cdot a, c, 0\right)}}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a} \]
  11. Final simplification99.4%

    \[\leadsto \frac{\frac{\mathsf{fma}\left(-3 \cdot a, c, 0\right)}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} + b}}{3 \cdot a} \]
  12. Add Preprocessing

Alternative 2: 99.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(-3, c \cdot a, 0\right)}{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + b\right) \cdot \left(a \cdot 3\right)} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/
  (fma -3.0 (* c a) 0.0)
  (* (+ (sqrt (fma -3.0 (* c a) (* b b))) b) (* a 3.0))))
double code(double a, double b, double c) {
	return fma(-3.0, (c * a), 0.0) / ((sqrt(fma(-3.0, (c * a), (b * b))) + b) * (a * 3.0));
}
function code(a, b, c)
	return Float64(fma(-3.0, Float64(c * a), 0.0) / Float64(Float64(sqrt(fma(-3.0, Float64(c * a), Float64(b * b))) + b) * Float64(a * 3.0)))
end
code[a_, b_, c_] := N[(N[(-3.0 * N[(c * a), $MachinePrecision] + 0.0), $MachinePrecision] / N[(N[(N[Sqrt[N[(-3.0 * N[(c * a), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + b), $MachinePrecision] * N[(a * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(-3, c \cdot a, 0\right)}{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + b\right) \cdot \left(a \cdot 3\right)}
\end{array}
Derivation
  1. Initial program 20.3%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. lift--.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b - \left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
    2. lift-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{b \cdot b - \color{blue}{\left(3 \cdot a\right) \cdot c}}}{3 \cdot a} \]
    3. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{b \cdot b + \left(\mathsf{neg}\left(3 \cdot a\right)\right) \cdot c}}}{3 \cdot a} \]
    4. +-commutativeN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(\mathsf{neg}\left(3 \cdot a\right)\right) \cdot c + b \cdot b}}}{3 \cdot a} \]
    5. *-commutativeN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{c \cdot \left(\mathsf{neg}\left(3 \cdot a\right)\right)} + b \cdot b}}{3 \cdot a} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{c \cdot \left(\mathsf{neg}\left(\color{blue}{3 \cdot a}\right)\right) + b \cdot b}}{3 \cdot a} \]
    7. distribute-lft-neg-inN/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{c \cdot \color{blue}{\left(\left(\mathsf{neg}\left(3\right)\right) \cdot a\right)} + b \cdot b}}{3 \cdot a} \]
    8. associate-*r*N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\left(c \cdot \left(\mathsf{neg}\left(3\right)\right)\right) \cdot a} + b \cdot b}}{3 \cdot a} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c \cdot \left(\mathsf{neg}\left(3\right)\right), a, b \cdot b\right)}}}{3 \cdot a} \]
    10. lower-*.f64N/A

      \[\leadsto \frac{\left(-b\right) + \sqrt{\mathsf{fma}\left(\color{blue}{c \cdot \left(\mathsf{neg}\left(3\right)\right)}, a, b \cdot b\right)}}{3 \cdot a} \]
    11. metadata-eval20.3

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

    \[\leadsto \frac{\left(-b\right) + \sqrt{\color{blue}{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}}}{3 \cdot a} \]
  5. Step-by-step derivation
    1. lift-+.f64N/A

      \[\leadsto \frac{\color{blue}{\left(-b\right) + \sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}}}{3 \cdot a} \]
    2. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)} + \left(-b\right)}}{3 \cdot a} \]
    3. lift-sqrt.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(c \cdot -3, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    4. lift-fma.f64N/A

      \[\leadsto \frac{\sqrt{\color{blue}{\left(c \cdot -3\right) \cdot a + b \cdot b}} + \left(-b\right)}{3 \cdot a} \]
    5. +-commutativeN/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b + \left(c \cdot -3\right) \cdot a}} + \left(-b\right)}{3 \cdot a} \]
    6. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(c \cdot -3\right)} \cdot a} + \left(-b\right)}{3 \cdot a} \]
    7. *-commutativeN/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(-3 \cdot c\right)} \cdot a} + \left(-b\right)}{3 \cdot a} \]
    8. associate-*l*N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{-3 \cdot \left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    9. metadata-evalN/A

      \[\leadsto \frac{\sqrt{b \cdot b + \color{blue}{\left(\mathsf{neg}\left(3\right)\right)} \cdot \left(c \cdot a\right)} + \left(-b\right)}{3 \cdot a} \]
    10. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b + \left(\mathsf{neg}\left(3\right)\right) \cdot \color{blue}{\left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    11. fp-cancel-sub-sign-invN/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b - 3 \cdot \left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    12. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{\color{blue}{b \cdot b} - 3 \cdot \left(c \cdot a\right)} + \left(-b\right)}{3 \cdot a} \]
    13. lift-*.f64N/A

      \[\leadsto \frac{\sqrt{b \cdot b - 3 \cdot \color{blue}{\left(c \cdot a\right)}} + \left(-b\right)}{3 \cdot a} \]
    14. *-commutativeN/A

      \[\leadsto \frac{\sqrt{b \cdot b - 3 \cdot \color{blue}{\left(a \cdot c\right)}} + \left(-b\right)}{3 \cdot a} \]
    15. associate-*l*N/A

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

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}, \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}, -b\right)}}{3 \cdot a} \]
  7. Step-by-step derivation
    1. lift-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}}{3 \cdot a} \]
    2. lift-sqrt.f64N/A

      \[\leadsto \frac{\color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}} \cdot \sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    3. lift-sqrt.f64N/A

      \[\leadsto \frac{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} \cdot \color{blue}{\sqrt{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}}} + \left(-b\right)}{3 \cdot a} \]
    4. rem-square-sqrtN/A

      \[\leadsto \frac{\color{blue}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}} + \left(-b\right)}{3 \cdot a} \]
    5. flip-+N/A

      \[\leadsto \frac{\color{blue}{\frac{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} \cdot \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - \left(-b\right) \cdot \left(-b\right)}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - \left(-b\right)}}}{3 \cdot a} \]
    6. lower-/.f64N/A

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

    \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}}{3 \cdot a} \]
  9. Step-by-step derivation
    1. lift-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}{3 \cdot a}} \]
    2. lift-/.f64N/A

      \[\leadsto \frac{\color{blue}{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)}}}{3 \cdot a} \]
    3. associate-/l/N/A

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)}} \]
    4. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)}} \]
    5. lift--.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right) - b \cdot b}}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    6. lift-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\left(\left(c \cdot a\right) \cdot -3 + b \cdot b\right)} - b \cdot b}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    7. associate--l+N/A

      \[\leadsto \frac{\color{blue}{\left(c \cdot a\right) \cdot -3 + \left(b \cdot b - b \cdot b\right)}}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\color{blue}{-3 \cdot \left(c \cdot a\right)} + \left(b \cdot b - b \cdot b\right)}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    9. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-3, c \cdot a, b \cdot b - b \cdot b\right)}}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    10. +-inversesN/A

      \[\leadsto \frac{\mathsf{fma}\left(-3, c \cdot a, \color{blue}{0}\right)}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)} \]
    11. lower-*.f6499.1

      \[\leadsto \frac{\mathsf{fma}\left(-3, c \cdot a, 0\right)}{\color{blue}{\left(\sqrt{\mathsf{fma}\left(c \cdot a, -3, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(3 \cdot a\right)}} \]
  10. Applied rewrites99.1%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-3, c \cdot a, 0\right)}{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} - \left(-b\right)\right) \cdot \left(a \cdot 3\right)}} \]
  11. Final simplification99.1%

    \[\leadsto \frac{\mathsf{fma}\left(-3, c \cdot a, 0\right)}{\left(\sqrt{\mathsf{fma}\left(-3, c \cdot a, b \cdot b\right)} + b\right) \cdot \left(a \cdot 3\right)} \]
  12. Add Preprocessing

Alternative 3: 95.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \frac{\mathsf{fma}\left(\frac{-0.375 \cdot a}{b}, \frac{c \cdot c}{b}, -0.5 \cdot c\right)}{b} \end{array} \]
(FPCore (a b c)
 :precision binary64
 (/ (fma (/ (* -0.375 a) b) (/ (* c c) b) (* -0.5 c)) b))
double code(double a, double b, double c) {
	return fma(((-0.375 * a) / b), ((c * c) / b), (-0.5 * c)) / b;
}
function code(a, b, c)
	return Float64(fma(Float64(Float64(-0.375 * a) / b), Float64(Float64(c * c) / b), Float64(-0.5 * c)) / b)
end
code[a_, b_, c_] := N[(N[(N[(N[(-0.375 * a), $MachinePrecision] / b), $MachinePrecision] * N[(N[(c * c), $MachinePrecision] / b), $MachinePrecision] + N[(-0.5 * c), $MachinePrecision]), $MachinePrecision] / b), $MachinePrecision]
\begin{array}{l}

\\
\frac{\mathsf{fma}\left(\frac{-0.375 \cdot a}{b}, \frac{c \cdot c}{b}, -0.5 \cdot c\right)}{b}
\end{array}
Derivation
  1. Initial program 20.3%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in a around 0

    \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b} + a \cdot \left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(\frac{-9}{16} \cdot \frac{{c}^{3}}{{b}^{5}} + \frac{-1}{6} \cdot \frac{a \cdot \left(\frac{81}{64} \cdot \frac{{c}^{4}}{{b}^{6}} + \frac{81}{16} \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right)} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{a \cdot \left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(\frac{-9}{16} \cdot \frac{{c}^{3}}{{b}^{5}} + \frac{-1}{6} \cdot \frac{a \cdot \left(\frac{81}{64} \cdot \frac{{c}^{4}}{{b}^{6}} + \frac{81}{16} \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) + \frac{-1}{2} \cdot \frac{c}{b}} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(\frac{-9}{16} \cdot \frac{{c}^{3}}{{b}^{5}} + \frac{-1}{6} \cdot \frac{a \cdot \left(\frac{81}{64} \cdot \frac{{c}^{4}}{{b}^{6}} + \frac{81}{16} \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right)\right) \cdot a} + \frac{-1}{2} \cdot \frac{c}{b} \]
    3. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}} + a \cdot \left(\frac{-9}{16} \cdot \frac{{c}^{3}}{{b}^{5}} + \frac{-1}{6} \cdot \frac{a \cdot \left(\frac{81}{64} \cdot \frac{{c}^{4}}{{b}^{6}} + \frac{81}{16} \cdot \frac{{c}^{4}}{{b}^{6}}\right)}{b}\right), a, \frac{-1}{2} \cdot \frac{c}{b}\right)} \]
  5. Applied rewrites96.9%

    \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666 \cdot a, \frac{{c}^{4}}{{b}^{6}} \cdot \frac{6.328125}{b}, \frac{{c}^{3} \cdot -0.5625}{{b}^{5}}\right), a, \frac{\left(c \cdot c\right) \cdot -0.375}{{b}^{3}}\right), a, \frac{c}{b} \cdot -0.5\right)} \]
  6. Taylor expanded in b around inf

    \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
  7. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \color{blue}{\frac{\frac{-1}{2} \cdot c + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}}}{b}} \]
    2. +-commutativeN/A

      \[\leadsto \frac{\color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{2}} + \frac{-1}{2} \cdot c}}{b} \]
    3. associate-*r/N/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{-3}{8} \cdot \left(a \cdot {c}^{2}\right)}{{b}^{2}}} + \frac{-1}{2} \cdot c}{b} \]
    4. associate-*r*N/A

      \[\leadsto \frac{\frac{\color{blue}{\left(\frac{-3}{8} \cdot a\right) \cdot {c}^{2}}}{{b}^{2}} + \frac{-1}{2} \cdot c}{b} \]
    5. unpow2N/A

      \[\leadsto \frac{\frac{\left(\frac{-3}{8} \cdot a\right) \cdot {c}^{2}}{\color{blue}{b \cdot b}} + \frac{-1}{2} \cdot c}{b} \]
    6. times-fracN/A

      \[\leadsto \frac{\color{blue}{\frac{\frac{-3}{8} \cdot a}{b} \cdot \frac{{c}^{2}}{b}} + \frac{-1}{2} \cdot c}{b} \]
    7. lower-fma.f64N/A

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{\frac{-3}{8} \cdot a}{b}, \frac{{c}^{2}}{b}, \frac{-1}{2} \cdot c\right)}}{b} \]
    8. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{\frac{-3}{8} \cdot a}{b}}, \frac{{c}^{2}}{b}, \frac{-1}{2} \cdot c\right)}{b} \]
    9. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\color{blue}{\frac{-3}{8} \cdot a}}{b}, \frac{{c}^{2}}{b}, \frac{-1}{2} \cdot c\right)}{b} \]
    10. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{-3}{8} \cdot a}{b}, \color{blue}{\frac{{c}^{2}}{b}}, \frac{-1}{2} \cdot c\right)}{b} \]
    11. unpow2N/A

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{-3}{8} \cdot a}{b}, \frac{\color{blue}{c \cdot c}}{b}, \frac{-1}{2} \cdot c\right)}{b} \]
    12. lower-*.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(\frac{\frac{-3}{8} \cdot a}{b}, \frac{\color{blue}{c \cdot c}}{b}, \frac{-1}{2} \cdot c\right)}{b} \]
    13. lower-*.f6494.8

      \[\leadsto \frac{\mathsf{fma}\left(\frac{-0.375 \cdot a}{b}, \frac{c \cdot c}{b}, \color{blue}{-0.5 \cdot c}\right)}{b} \]
  8. Applied rewrites94.8%

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

Alternative 4: 95.4% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot b}, \frac{c}{b} \cdot -0.5\right) \end{array} \]
(FPCore (a b c)
 :precision binary64
 (fma (* a -0.375) (* c (/ c (* (* b b) b))) (* (/ c b) -0.5)))
double code(double a, double b, double c) {
	return fma((a * -0.375), (c * (c / ((b * b) * b))), ((c / b) * -0.5));
}
function code(a, b, c)
	return fma(Float64(a * -0.375), Float64(c * Float64(c / Float64(Float64(b * b) * b))), Float64(Float64(c / b) * -0.5))
end
code[a_, b_, c_] := N[(N[(a * -0.375), $MachinePrecision] * N[(c * N[(c / N[(N[(b * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot b}, \frac{c}{b} \cdot -0.5\right)
\end{array}
Derivation
  1. Initial program 20.3%

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Taylor expanded in a around 0

    \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b} + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
  4. Step-by-step derivation
    1. +-commutativeN/A

      \[\leadsto \color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \frac{-1}{2} \cdot \frac{c}{b}} \]
    2. *-commutativeN/A

      \[\leadsto \color{blue}{\frac{a \cdot {c}^{2}}{{b}^{3}} \cdot \frac{-3}{8}} + \frac{-1}{2} \cdot \frac{c}{b} \]
    3. associate-/l*N/A

      \[\leadsto \color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{3}}\right)} \cdot \frac{-3}{8} + \frac{-1}{2} \cdot \frac{c}{b} \]
    4. associate-*r*N/A

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

      \[\leadsto a \cdot \color{blue}{\left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}}\right)} + \frac{-1}{2} \cdot \frac{c}{b} \]
    6. associate-*r*N/A

      \[\leadsto \color{blue}{\left(a \cdot \frac{-3}{8}\right) \cdot \frac{{c}^{2}}{{b}^{3}}} + \frac{-1}{2} \cdot \frac{c}{b} \]
    7. lower-fma.f64N/A

      \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \frac{-3}{8}, \frac{{c}^{2}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right)} \]
    8. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(\color{blue}{a \cdot \frac{-3}{8}}, \frac{{c}^{2}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    9. unpow2N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \frac{\color{blue}{c \cdot c}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    10. associate-/l*N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \color{blue}{c \cdot \frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    11. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \color{blue}{c \cdot \frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    12. lower-/.f64N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \color{blue}{\frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    13. lower-pow.f64N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{\color{blue}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
    14. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}}\right) \]
    15. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}}\right) \]
    16. lower-/.f6494.8

      \[\leadsto \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b}} \cdot -0.5\right) \]
  5. Applied rewrites94.8%

    \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{{b}^{3}}, \frac{c}{b} \cdot -0.5\right)} \]
  6. Step-by-step derivation
    1. Applied rewrites94.8%

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

    Alternative 5: 95.0% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot b}, \frac{-0.5}{b} \cdot c\right) \end{array} \]
    (FPCore (a b c)
     :precision binary64
     (fma (* a -0.375) (* c (/ c (* (* b b) b))) (* (/ -0.5 b) c)))
    double code(double a, double b, double c) {
    	return fma((a * -0.375), (c * (c / ((b * b) * b))), ((-0.5 / b) * c));
    }
    
    function code(a, b, c)
    	return fma(Float64(a * -0.375), Float64(c * Float64(c / Float64(Float64(b * b) * b))), Float64(Float64(-0.5 / b) * c))
    end
    
    code[a_, b_, c_] := N[(N[(a * -0.375), $MachinePrecision] * N[(c * N[(c / N[(N[(b * b), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(-0.5 / b), $MachinePrecision] * c), $MachinePrecision]), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot b}, \frac{-0.5}{b} \cdot c\right)
    \end{array}
    
    Derivation
    1. Initial program 20.3%

      \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
    2. Add Preprocessing
    3. Taylor expanded in a around 0

      \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b} + \frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\frac{-3}{8} \cdot \frac{a \cdot {c}^{2}}{{b}^{3}} + \frac{-1}{2} \cdot \frac{c}{b}} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot {c}^{2}}{{b}^{3}} \cdot \frac{-3}{8}} + \frac{-1}{2} \cdot \frac{c}{b} \]
      3. associate-/l*N/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{{c}^{2}}{{b}^{3}}\right)} \cdot \frac{-3}{8} + \frac{-1}{2} \cdot \frac{c}{b} \]
      4. associate-*r*N/A

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

        \[\leadsto a \cdot \color{blue}{\left(\frac{-3}{8} \cdot \frac{{c}^{2}}{{b}^{3}}\right)} + \frac{-1}{2} \cdot \frac{c}{b} \]
      6. associate-*r*N/A

        \[\leadsto \color{blue}{\left(a \cdot \frac{-3}{8}\right) \cdot \frac{{c}^{2}}{{b}^{3}}} + \frac{-1}{2} \cdot \frac{c}{b} \]
      7. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \frac{-3}{8}, \frac{{c}^{2}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right)} \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{a \cdot \frac{-3}{8}}, \frac{{c}^{2}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \frac{\color{blue}{c \cdot c}}{{b}^{3}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      10. associate-/l*N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \color{blue}{c \cdot \frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      11. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, \color{blue}{c \cdot \frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      12. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \color{blue}{\frac{c}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      13. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{\color{blue}{{b}^{3}}}, \frac{-1}{2} \cdot \frac{c}{b}\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}}\right) \]
      15. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(a \cdot \frac{-3}{8}, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}}\right) \]
      16. lower-/.f6494.8

        \[\leadsto \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{{b}^{3}}, \color{blue}{\frac{c}{b}} \cdot -0.5\right) \]
    5. Applied rewrites94.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{{b}^{3}}, \frac{c}{b} \cdot -0.5\right)} \]
    6. Step-by-step derivation
      1. Applied rewrites94.8%

        \[\leadsto \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot \color{blue}{b}}, \frac{c}{b} \cdot -0.5\right) \]
      2. Step-by-step derivation
        1. Applied rewrites94.4%

          \[\leadsto \mathsf{fma}\left(a \cdot -0.375, c \cdot \frac{c}{\left(b \cdot b\right) \cdot b}, \frac{-0.5}{b} \cdot c\right) \]
        2. Add Preprocessing

        Alternative 6: 90.4% accurate, 2.9× speedup?

        \[\begin{array}{l} \\ \frac{c}{b} \cdot -0.5 \end{array} \]
        (FPCore (a b c) :precision binary64 (* (/ c b) -0.5))
        double code(double a, double b, double c) {
        	return (c / b) * -0.5;
        }
        
        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) * (-0.5d0)
        end function
        
        public static double code(double a, double b, double c) {
        	return (c / b) * -0.5;
        }
        
        def code(a, b, c):
        	return (c / b) * -0.5
        
        function code(a, b, c)
        	return Float64(Float64(c / b) * -0.5)
        end
        
        function tmp = code(a, b, c)
        	tmp = (c / b) * -0.5;
        end
        
        code[a_, b_, c_] := N[(N[(c / b), $MachinePrecision] * -0.5), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \frac{c}{b} \cdot -0.5
        \end{array}
        
        Derivation
        1. Initial program 20.3%

          \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}} \]
          3. lower-/.f6489.1

            \[\leadsto \color{blue}{\frac{c}{b}} \cdot -0.5 \]
        5. Applied rewrites89.1%

          \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
        6. Add Preprocessing

        Alternative 7: 90.0% accurate, 2.9× speedup?

        \[\begin{array}{l} \\ c \cdot \frac{-0.5}{b} \end{array} \]
        (FPCore (a b c) :precision binary64 (* c (/ -0.5 b)))
        double code(double a, double b, double c) {
        	return c * (-0.5 / 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 * ((-0.5d0) / b)
        end function
        
        public static double code(double a, double b, double c) {
        	return c * (-0.5 / b);
        }
        
        def code(a, b, c):
        	return c * (-0.5 / b)
        
        function code(a, b, c)
        	return Float64(c * Float64(-0.5 / b))
        end
        
        function tmp = code(a, b, c)
        	tmp = c * (-0.5 / b);
        end
        
        code[a_, b_, c_] := N[(c * N[(-0.5 / b), $MachinePrecision]), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        c \cdot \frac{-0.5}{b}
        \end{array}
        
        Derivation
        1. Initial program 20.3%

          \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
        2. Add Preprocessing
        3. Taylor expanded in a around 0

          \[\leadsto \color{blue}{\frac{-1}{2} \cdot \frac{c}{b}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}} \]
          2. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{c}{b} \cdot \frac{-1}{2}} \]
          3. lower-/.f6489.1

            \[\leadsto \color{blue}{\frac{c}{b}} \cdot -0.5 \]
        5. Applied rewrites89.1%

          \[\leadsto \color{blue}{\frac{c}{b} \cdot -0.5} \]
        6. Step-by-step derivation
          1. Applied rewrites88.7%

            \[\leadsto c \cdot \color{blue}{\frac{-0.5}{b}} \]
          2. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2024339 
          (FPCore (a b c)
            :name "Cubic critical, wide range"
            :precision binary64
            :pre (and (and (and (< 4.930380657631324e-32 a) (< a 2.028240960365167e+31)) (and (< 4.930380657631324e-32 b) (< b 2.028240960365167e+31))) (and (< 4.930380657631324e-32 c) (< c 2.028240960365167e+31)))
            (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))