Quadratic roots, medium range

?

Percentage Accurate: 32.0% → 99.2%
Time: 13.3s
Precision: binary64
Cost: 14400

?

\[\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)\]
\[\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a} \]
\[\frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot a\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]
(FPCore (a b c)
 :precision binary64
 (/ (+ (- b) (sqrt (- (* b b) (* (* 4.0 a) c)))) (* 2.0 a)))
(FPCore (a b c)
 :precision binary64
 (*
  (/
   (+ (* 0.0 (* b b)) (* (* c a) -4.0))
   (+ b (sqrt (fma c (* a -4.0) (* b b)))))
  (/ 0.5 a)))
double code(double a, double b, double c) {
	return (-b + sqrt(((b * b) - ((4.0 * a) * c)))) / (2.0 * a);
}
double code(double a, double b, double c) {
	return (((0.0 * (b * b)) + ((c * a) * -4.0)) / (b + sqrt(fma(c, (a * -4.0), (b * b))))) * (0.5 / 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 code(a, b, c)
	return Float64(Float64(Float64(Float64(0.0 * Float64(b * b)) + Float64(Float64(c * a) * -4.0)) / Float64(b + sqrt(fma(c, Float64(a * -4.0), Float64(b * b))))) * Float64(0.5 / 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]
code[a_, b_, c_] := N[(N[(N[(N[(0.0 * N[(b * b), $MachinePrecision]), $MachinePrecision] + N[(N[(c * a), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] / N[(b + N[Sqrt[N[(c * N[(a * -4.0), $MachinePrecision] + N[(b * b), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(0.5 / a), $MachinePrecision]), $MachinePrecision]
\frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{2 \cdot a}
\frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot a\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a}

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.

Herbie found 6 alternatives:

AlternativeAccuracySpeedup

Accuracy vs Speed

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.

Bogosity?

Bogosity

Derivation?

  1. Initial program 30.6%

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

    \[\leadsto \color{blue}{\left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)} - b\right) \cdot \frac{0.5}{a}} \]
    Step-by-step derivation

    [Start]30.6%

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

    /-rgt-identity [<=]30.6%

    \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\color{blue}{\frac{2 \cdot a}{1}}} \]

    metadata-eval [<=]30.6%

    \[ \frac{\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}}{\frac{2 \cdot a}{\color{blue}{--1}}} \]

    associate-/l* [<=]30.6%

    \[ \color{blue}{\frac{\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \left(--1\right)}{2 \cdot a}} \]

    associate-*r/ [<=]30.6%

    \[ \color{blue}{\left(\left(-b\right) + \sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c}\right) \cdot \frac{--1}{2 \cdot a}} \]

    +-commutative [=>]30.6%

    \[ \color{blue}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} + \left(-b\right)\right)} \cdot \frac{--1}{2 \cdot a} \]

    unsub-neg [=>]30.6%

    \[ \color{blue}{\left(\sqrt{b \cdot b - \left(4 \cdot a\right) \cdot c} - b\right)} \cdot \frac{--1}{2 \cdot a} \]

    fma-neg [=>]30.6%

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

    associate-*l* [=>]30.6%

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

    *-commutative [=>]30.6%

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

    distribute-rgt-neg-in [=>]30.6%

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

    metadata-eval [=>]30.6%

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

    associate-/r* [=>]30.6%

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

    metadata-eval [=>]30.6%

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

    metadata-eval [=>]30.6%

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

    \[\leadsto \left(\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right) + \mathsf{fma}\left(a \cdot \left(c \cdot -4\right), 1, \left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)}} - b\right) \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]30.6%

    \[ \left(\sqrt{\mathsf{fma}\left(b, b, \left(a \cdot c\right) \cdot -4\right)} - b\right) \cdot \frac{0.5}{a} \]

    fma-udef [=>]30.6%

    \[ \left(\sqrt{\color{blue}{b \cdot b + \left(a \cdot c\right) \cdot -4}} - b\right) \cdot \frac{0.5}{a} \]

    *-commutative [=>]30.6%

    \[ \left(\sqrt{b \cdot b + \color{blue}{-4 \cdot \left(a \cdot c\right)}} - b\right) \cdot \frac{0.5}{a} \]

    metadata-eval [<=]30.6%

    \[ \left(\sqrt{b \cdot b + \color{blue}{\left(-4\right)} \cdot \left(a \cdot c\right)} - b\right) \cdot \frac{0.5}{a} \]

    cancel-sign-sub-inv [<=]30.6%

    \[ \left(\sqrt{\color{blue}{b \cdot b - 4 \cdot \left(a \cdot c\right)}} - b\right) \cdot \frac{0.5}{a} \]

    associate-*l* [<=]30.6%

    \[ \left(\sqrt{b \cdot b - \color{blue}{\left(4 \cdot a\right) \cdot c}} - b\right) \cdot \frac{0.5}{a} \]

    *-un-lft-identity [=>]30.6%

    \[ \left(\sqrt{b \cdot b - \color{blue}{1 \cdot \left(\left(4 \cdot a\right) \cdot c\right)}} - b\right) \cdot \frac{0.5}{a} \]

    prod-diff [=>]30.6%

    \[ \left(\sqrt{\color{blue}{\mathsf{fma}\left(b, b, -\left(\left(4 \cdot a\right) \cdot c\right) \cdot 1\right) + \mathsf{fma}\left(-\left(4 \cdot a\right) \cdot c, 1, \left(\left(4 \cdot a\right) \cdot c\right) \cdot 1\right)}} - b\right) \cdot \frac{0.5}{a} \]
  4. Simplified30.5%

    \[\leadsto \left(\sqrt{\color{blue}{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)}} - b\right) \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]30.7%

    \[ \left(\sqrt{\mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right) + \mathsf{fma}\left(a \cdot \left(c \cdot -4\right), 1, \left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    +-commutative [=>]30.7%

    \[ \left(\sqrt{\color{blue}{\mathsf{fma}\left(a \cdot \left(c \cdot -4\right), 1, \left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right) + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)}} - b\right) \cdot \frac{0.5}{a} \]

    fma-udef [=>]30.7%

    \[ \left(\sqrt{\color{blue}{\left(\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1 + \left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-rgt-identity [=>]30.7%

    \[ \left(\sqrt{\left(\color{blue}{a \cdot \left(c \cdot -4\right)} + \left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right) + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-rgt-identity [=>]30.7%

    \[ \left(\sqrt{\left(a \cdot \left(c \cdot -4\right) + \color{blue}{a \cdot \left(c \cdot -4\right)}\right) + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    count-2 [=>]30.7%

    \[ \left(\sqrt{\color{blue}{2 \cdot \left(a \cdot \left(c \cdot -4\right)\right)} + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-commutative [=>]30.7%

    \[ \left(\sqrt{2 \cdot \color{blue}{\left(\left(c \cdot -4\right) \cdot a\right)} + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-commutative [=>]30.7%

    \[ \left(\sqrt{2 \cdot \left(\color{blue}{\left(-4 \cdot c\right)} \cdot a\right) + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    associate-*r* [<=]30.7%

    \[ \left(\sqrt{2 \cdot \color{blue}{\left(-4 \cdot \left(c \cdot a\right)\right)} + \mathsf{fma}\left(b, b, -\left(a \cdot \left(c \cdot -4\right)\right) \cdot 1\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-rgt-identity [=>]30.7%

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

    fma-neg [<=]30.5%

    \[ \left(\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \color{blue}{\left(b \cdot b - a \cdot \left(c \cdot -4\right)\right)}} - b\right) \cdot \frac{0.5}{a} \]

    *-commutative [=>]30.5%

    \[ \left(\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - \color{blue}{\left(c \cdot -4\right) \cdot a}\right)} - b\right) \cdot \frac{0.5}{a} \]

    *-commutative [=>]30.5%

    \[ \left(\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - \color{blue}{\left(-4 \cdot c\right)} \cdot a\right)} - b\right) \cdot \frac{0.5}{a} \]

    associate-*r* [<=]30.5%

    \[ \left(\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - \color{blue}{-4 \cdot \left(c \cdot a\right)}\right)} - b\right) \cdot \frac{0.5}{a} \]
  5. Applied egg-rr31.3%

    \[\leadsto \color{blue}{\frac{\left(-8 \cdot \left(c \cdot a\right) + \left(b \cdot b + 4 \cdot \left(c \cdot a\right)\right)\right) - b \cdot b}{\sqrt{-8 \cdot \left(c \cdot a\right) + \left(b \cdot b + 4 \cdot \left(c \cdot a\right)\right)} + b}} \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]30.5%

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

    flip-- [=>]30.3%

    \[ \color{blue}{\frac{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} \cdot \sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} - b \cdot b}{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} + b}} \cdot \frac{0.5}{a} \]

    add-sqr-sqrt [<=]31.3%

    \[ \frac{\color{blue}{\left(2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)\right)} - b \cdot b}{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} + b} \cdot \frac{0.5}{a} \]

    associate-*r* [=>]31.3%

    \[ \frac{\left(\color{blue}{\left(2 \cdot -4\right) \cdot \left(c \cdot a\right)} + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)\right) - b \cdot b}{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} + b} \cdot \frac{0.5}{a} \]

    metadata-eval [=>]31.3%

    \[ \frac{\left(\color{blue}{-8} \cdot \left(c \cdot a\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)\right) - b \cdot b}{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} + b} \cdot \frac{0.5}{a} \]

    cancel-sign-sub-inv [=>]31.3%

    \[ \frac{\left(-8 \cdot \left(c \cdot a\right) + \color{blue}{\left(b \cdot b + \left(--4\right) \cdot \left(c \cdot a\right)\right)}\right) - b \cdot b}{\sqrt{2 \cdot \left(-4 \cdot \left(c \cdot a\right)\right) + \left(b \cdot b - -4 \cdot \left(c \cdot a\right)\right)} + b} \cdot \frac{0.5}{a} \]

    metadata-eval [=>]31.3%

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

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) - b \cdot b}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}}} \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]31.3%

    \[ \frac{\left(-8 \cdot \left(c \cdot a\right) + \left(b \cdot b + 4 \cdot \left(c \cdot a\right)\right)\right) - b \cdot b}{\sqrt{-8 \cdot \left(c \cdot a\right) + \left(b \cdot b + 4 \cdot \left(c \cdot a\right)\right)} + b} \cdot \frac{0.5}{a} \]
  7. Applied egg-rr31.5%

    \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right) + \left(-b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]31.5%

    \[ \frac{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) - b \cdot b}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    sub-neg [=>]31.5%

    \[ \frac{\color{blue}{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right) + \left(-b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    *-commutative [=>]31.5%

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

    \[\leadsto \frac{\color{blue}{0 \cdot \left(b \cdot b\right) + \left(c \cdot a\right) \cdot -4}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]
    Step-by-step derivation

    [Start]31.5%

    \[ \frac{\mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right) + \left(-b \cdot b\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    +-commutative [=>]31.5%

    \[ \frac{\color{blue}{\left(-b \cdot b\right) + \mathsf{fma}\left(c, -4 \cdot a, b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    fma-def [<=]31.5%

    \[ \frac{\left(-b \cdot b\right) + \color{blue}{\left(c \cdot \left(-4 \cdot a\right) + b \cdot b\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    +-commutative [=>]31.5%

    \[ \frac{\left(-b \cdot b\right) + \color{blue}{\left(b \cdot b + c \cdot \left(-4 \cdot a\right)\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    associate-+r+ [=>]99.3%

    \[ \frac{\color{blue}{\left(\left(-b \cdot b\right) + b \cdot b\right) + c \cdot \left(-4 \cdot a\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    neg-mul-1 [=>]99.3%

    \[ \frac{\left(\color{blue}{-1 \cdot \left(b \cdot b\right)} + b \cdot b\right) + c \cdot \left(-4 \cdot a\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    distribute-lft1-in [=>]99.3%

    \[ \frac{\color{blue}{\left(-1 + 1\right) \cdot \left(b \cdot b\right)} + c \cdot \left(-4 \cdot a\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    metadata-eval [=>]99.3%

    \[ \frac{\color{blue}{0} \cdot \left(b \cdot b\right) + c \cdot \left(-4 \cdot a\right)}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    associate-*r* [=>]99.3%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \color{blue}{\left(c \cdot -4\right) \cdot a}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    rem-square-sqrt [<=]0.0%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot \color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)}\right) \cdot a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    unpow2 [<=]0.0%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot \color{blue}{{\left(\sqrt{-4}\right)}^{2}}\right) \cdot a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    *-commutative [=>]0.0%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \color{blue}{\left({\left(\sqrt{-4}\right)}^{2} \cdot c\right)} \cdot a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    unpow2 [=>]0.0%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \left(\color{blue}{\left(\sqrt{-4} \cdot \sqrt{-4}\right)} \cdot c\right) \cdot a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    rem-square-sqrt [=>]99.3%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \left(\color{blue}{-4} \cdot c\right) \cdot a}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    associate-*r* [<=]99.3%

    \[ \frac{0 \cdot \left(b \cdot b\right) + \color{blue}{-4 \cdot \left(c \cdot a\right)}}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

    *-commutative [=>]99.3%

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

    \[\leadsto \frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot a\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]

Alternatives

Alternative 1
Accuracy99.2%
Cost14400
\[\frac{0 \cdot \left(b \cdot b\right) + \left(c \cdot a\right) \cdot -4}{b + \sqrt{\mathsf{fma}\left(c, a \cdot -4, b \cdot b\right)}} \cdot \frac{0.5}{a} \]
Alternative 2
Accuracy90.9%
Cost16452
\[\begin{array}{l} t_0 := \left(c \cdot a\right) \cdot -8 + \left(b \cdot b + \left(c \cdot a\right) \cdot 4\right)\\ \mathbf{if}\;\frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2} \leq -1000:\\ \;\;\;\;\frac{0.5}{a} \cdot \frac{t_0 - b \cdot b}{b + \sqrt{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\frac{-c \cdot c}{\frac{{b}^{3}}{a}} - \frac{c}{b}\\ \end{array} \]
Alternative 3
Accuracy90.8%
Cost14788
\[\begin{array}{l} t_0 := \frac{\sqrt{b \cdot b - c \cdot \left(a \cdot 4\right)} - b}{a \cdot 2}\\ \mathbf{if}\;t_0 \leq -1000:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{-c \cdot c}{\frac{{b}^{3}}{a}} - \frac{c}{b}\\ \end{array} \]
Alternative 4
Accuracy90.7%
Cost7232
\[\frac{-c \cdot c}{\frac{{b}^{3}}{a}} - \frac{c}{b} \]
Alternative 5
Accuracy90.7%
Cost1344
\[\frac{\frac{\left(c \cdot a\right) \cdot -4}{b + \left(b + \frac{-2}{\frac{b}{c \cdot a}}\right)}}{a \cdot 2} \]
Alternative 6
Accuracy81.0%
Cost256
\[\frac{-c}{b} \]

Reproduce?

herbie shell --seed 2023165 
(FPCore (a b c)
  :name "Quadratic roots, 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) (* (* 4.0 a) c)))) (* 2.0 a)))