Cubic critical, medium range

Percentage Accurate: 31.3% → 99.6%
Time: 11.8s
Alternatives: 8
Speedup: 2.9×

Specification

?
\[\left(\left(1.1102230246251565 \cdot 10^{-16} < a \land a < 9007199254740992\right) \land \left(1.1102230246251565 \cdot 10^{-16} < b \land b < 9007199254740992\right)\right) \land \left(1.1102230246251565 \cdot 10^{-16} < c \land c < 9007199254740992\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 8 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: 31.3% 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.6% accurate, 0.8× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Applied rewrites31.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 99.4% accurate, 0.9× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Applied rewrites31.9%

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

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

    \[\leadsto \color{blue}{\frac{1}{\left(\left(-b\right) - \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right) \cdot \frac{-3 \cdot a}{\mathsf{fma}\left(-3 \cdot c, a, 0\right)}}} \]
  6. Taylor expanded in c around 0

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

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

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

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

Alternative 3: 90.7% accurate, 1.0× speedup?

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

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

    \[\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 \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    2. clear-numN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{3}}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
    13. lower--.f6433.5

      \[\leadsto \frac{0.3333333333333333}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
  4. Applied rewrites33.5%

    \[\leadsto \color{blue}{\frac{0.3333333333333333}{\frac{a}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - b}}} \]
  5. Taylor expanded in c around 0

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

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

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

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

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

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

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

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

      \[\leadsto \frac{0.3333333333333333}{\frac{\mathsf{fma}\left(a \cdot \frac{c}{b}, 0.5, \color{blue}{-0.6666666666666666 \cdot b}\right)}{c}} \]
  7. Applied rewrites89.9%

    \[\leadsto \frac{0.3333333333333333}{\color{blue}{\frac{\mathsf{fma}\left(a \cdot \frac{c}{b}, 0.5, -0.6666666666666666 \cdot b\right)}{c}}} \]
  8. Final simplification89.9%

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

Alternative 4: 90.8% accurate, 1.1× speedup?

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

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

    \[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a} \]
  2. Add Preprocessing
  3. Applied rewrites31.9%

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

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

    \[\leadsto \color{blue}{\frac{1}{\left(\left(-b\right) - \sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)}\right) \cdot \frac{-3 \cdot a}{\mathsf{fma}\left(-3 \cdot c, a, 0\right)}}} \]
  6. Taylor expanded in a around 0

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \color{blue}{\frac{b}{c}} \cdot -2\right)} \]
  8. Applied rewrites89.8%

    \[\leadsto \frac{1}{\color{blue}{\mathsf{fma}\left(\frac{a}{b}, 1.5, \frac{b}{c} \cdot -2\right)}} \]
  9. Final simplification89.8%

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

Alternative 5: 90.7% accurate, 1.1× speedup?

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

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

    \[\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 \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    2. clear-numN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{3}}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
    13. lower--.f6433.5

      \[\leadsto \frac{0.3333333333333333}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
  4. Applied rewrites33.5%

    \[\leadsto \color{blue}{\frac{0.3333333333333333}{\frac{a}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - b}}} \]
  5. Taylor expanded in a around 0

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

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

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

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

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

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

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

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

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

Alternative 6: 90.7% accurate, 1.1× speedup?

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

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

    \[\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 \color{blue}{\frac{\left(-b\right) + \sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c}}{3 \cdot a}} \]
    2. clear-numN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{3}}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
    13. lower--.f6433.5

      \[\leadsto \frac{0.3333333333333333}{\frac{a}{\color{blue}{\sqrt{b \cdot b - \left(3 \cdot a\right) \cdot c} - b}}} \]
  4. Applied rewrites33.5%

    \[\leadsto \color{blue}{\frac{0.3333333333333333}{\frac{a}{\sqrt{\mathsf{fma}\left(-3 \cdot c, a, b \cdot b\right)} - b}}} \]
  5. Taylor expanded in b around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\frac{1}{3}}{\mathsf{fma}\left(\frac{a}{b}, \frac{\frac{1}{2}}{b}, \mathsf{neg}\left(\frac{\color{blue}{\frac{2}{3}}}{c}\right)\right) \cdot b} \]
    17. distribute-neg-fracN/A

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

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

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

    \[\leadsto \frac{0.3333333333333333}{\color{blue}{\mathsf{fma}\left(\frac{a}{b}, \frac{0.5}{b}, \frac{-0.6666666666666666}{c}\right) \cdot b}} \]
  8. Step-by-step derivation
    1. Applied rewrites89.7%

      \[\leadsto \frac{0.3333333333333333}{\frac{\mathsf{fma}\left(-0.6666666666666666, b \cdot b, c \cdot \left(0.5 \cdot a\right)\right)}{c \cdot \left(b \cdot b\right)} \cdot b} \]
    2. Taylor expanded in a around 0

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

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

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

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

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

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

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

    Alternative 7: 81.2% accurate, 2.9× speedup?

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

      \[\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 c 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-/.f6479.8

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

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

      \[\leadsto -0.5 \cdot \frac{c}{b} \]
    7. Add Preprocessing

    Alternative 8: 81.0% accurate, 2.9× speedup?

    \[\begin{array}{l} \\ \frac{-0.5}{b} \cdot c \end{array} \]
    (FPCore (a b c) :precision binary64 (* (/ -0.5 b) c))
    double code(double a, double b, double c) {
    	return (-0.5 / b) * c;
    }
    
    real(8) function code(a, b, c)
        real(8), intent (in) :: a
        real(8), intent (in) :: b
        real(8), intent (in) :: c
        code = ((-0.5d0) / b) * c
    end function
    
    public static double code(double a, double b, double c) {
    	return (-0.5 / b) * c;
    }
    
    def code(a, b, c):
    	return (-0.5 / b) * c
    
    function code(a, b, c)
    	return Float64(Float64(-0.5 / b) * c)
    end
    
    function tmp = code(a, b, c)
    	tmp = (-0.5 / b) * c;
    end
    
    code[a_, b_, c_] := N[(N[(-0.5 / b), $MachinePrecision] * c), $MachinePrecision]
    
    \begin{array}{l}
    
    \\
    \frac{-0.5}{b} \cdot c
    \end{array}
    
    Derivation
    1. Initial program 33.5%

      \[\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 c 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-/.f6479.8

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

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

        \[\leadsto c \cdot \color{blue}{\frac{-0.5}{b}} \]
      2. Final simplification79.6%

        \[\leadsto \frac{-0.5}{b} \cdot c \]
      3. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2024270 
      (FPCore (a b c)
        :name "Cubic critical, medium range"
        :precision binary64
        :pre (and (and (and (< 1.1102230246251565e-16 a) (< a 9007199254740992.0)) (and (< 1.1102230246251565e-16 b) (< b 9007199254740992.0))) (and (< 1.1102230246251565e-16 c) (< c 9007199254740992.0)))
        (/ (+ (- b) (sqrt (- (* b b) (* (* 3.0 a) c)))) (* 3.0 a)))