| Alternative 1 | |
|---|---|
| Accuracy | 35.8% |
| Cost | 28180 |
(FPCore (A B C F)
:precision binary64
(/
(-
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(- (pow B 2.0) (* (* 4.0 A) C))))(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* C (* A -4.0)))
(t_1 (* -4.0 (* A C)))
(t_2 (hypot B (- A C)))
(t_3 (fma B B t_0))
(t_4 (+ (pow B 2.0) t_0))
(t_5
(/
(-
(sqrt
(*
(* 2.0 (* t_4 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_4)))
(if (<= t_5 0.0)
(/ (* (* (sqrt (+ (+ A C) t_2)) (sqrt F)) (- (sqrt (* 2.0 t_3)))) t_3)
(if (<= t_5 INFINITY)
(/
(* (sqrt (* 2.0 (* F (fma B B t_1)))) (- (sqrt (+ A (+ C t_2)))))
(+ t_1 (* B B)))
(*
(/ (sqrt 2.0) B)
(* (sqrt (+ C (fma 0.5 (* C (/ C B)) B))) (- (sqrt F))))))))double code(double A, double B, double C, double F) {
return -sqrt(((2.0 * ((pow(B, 2.0) - ((4.0 * A) * C)) * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / (pow(B, 2.0) - ((4.0 * A) * C));
}
double code(double A, double B, double C, double F) {
double t_0 = C * (A * -4.0);
double t_1 = -4.0 * (A * C);
double t_2 = hypot(B, (A - C));
double t_3 = fma(B, B, t_0);
double t_4 = pow(B, 2.0) + t_0;
double t_5 = -sqrt(((2.0 * (t_4 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_4;
double tmp;
if (t_5 <= 0.0) {
tmp = ((sqrt(((A + C) + t_2)) * sqrt(F)) * -sqrt((2.0 * t_3))) / t_3;
} else if (t_5 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * (F * fma(B, B, t_1)))) * -sqrt((A + (C + t_2)))) / (t_1 + (B * B));
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + fma(0.5, (C * (C / B)), B))) * -sqrt(F));
}
return tmp;
}
function code(A, B, C, F) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C))) end
function code(A, B, C, F) t_0 = Float64(C * Float64(A * -4.0)) t_1 = Float64(-4.0 * Float64(A * C)) t_2 = hypot(B, Float64(A - C)) t_3 = fma(B, B, t_0) t_4 = Float64((B ^ 2.0) + t_0) t_5 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_4 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_4) tmp = 0.0 if (t_5 <= 0.0) tmp = Float64(Float64(Float64(sqrt(Float64(Float64(A + C) + t_2)) * sqrt(F)) * Float64(-sqrt(Float64(2.0 * t_3)))) / t_3); elseif (t_5 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, t_1)))) * Float64(-sqrt(Float64(A + Float64(C + t_2))))) / Float64(t_1 + Float64(B * B))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + fma(0.5, Float64(C * Float64(C / B)), B))) * Float64(-sqrt(F)))); end return tmp end
code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$3 = N[(B * B + t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(N[Power[B, 2.0], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$5 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$4 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$4), $MachinePrecision]}, If[LessEqual[t$95$5, 0.0], N[(N[(N[(N[Sqrt[N[(N[(A + C), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$3), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$5, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(A + N[(C + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(t$95$1 + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[(0.5 * N[(C * N[(C / B), $MachinePrecision]), $MachinePrecision] + B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\begin{array}{l}
t_0 := C \cdot \left(A \cdot -4\right)\\
t_1 := -4 \cdot \left(A \cdot C\right)\\
t_2 := \mathsf{hypot}\left(B, A - C\right)\\
t_3 := \mathsf{fma}\left(B, B, t_0\right)\\
t_4 := {B}^{2} + t_0\\
t_5 := \frac{-\sqrt{\left(2 \cdot \left(t_4 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_4}\\
\mathbf{if}\;t_5 \leq 0:\\
\;\;\;\;\frac{\left(\sqrt{\left(A + C\right) + t_2} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2 \cdot t_3}\right)}{t_3}\\
\mathbf{elif}\;t_5 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, t_1\right)\right)} \cdot \left(-\sqrt{A + \left(C + t_2\right)}\right)}{t_1 + B \cdot B}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{fma}\left(0.5, C \cdot \frac{C}{B}, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 30.7%
Simplified38.5%
[Start]30.7 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Applied egg-rr50.8%
[Start]38.5 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]38.5 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right) \cdot \left(F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
sqrt-prod [=>]52.0 | \[ \frac{-\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+r+ [=>]50.8 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]50.8 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \color{blue}{\left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]50.8 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \color{blue}{\left(C + A\right)}\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Simplified52.0%
[Start]50.8 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]50.8 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+r+ [=>]52.0 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(\mathsf{hypot}\left(B, A - C\right) + C\right) + A\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [<=]52.0 | \[ \frac{-\sqrt{F \cdot \left(\color{blue}{\left(C + \mathsf{hypot}\left(B, A - C\right)\right)} + A\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+l+ [=>]52.0 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr57.7%
[Start]52.0 | \[ \frac{-\sqrt{F \cdot \left(C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
sqrt-prod [=>]59.1 | \[ \frac{-\color{blue}{\left(\sqrt{F} \cdot \sqrt{C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)}\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [=>]59.1 | \[ \frac{-\color{blue}{\left(\sqrt{C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)} \cdot \sqrt{F}\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]59.1 | \[ \frac{-\left(\sqrt{\color{blue}{\left(\mathsf{hypot}\left(B, A - C\right) + A\right) + C}} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+l+ [=>]57.7 | \[ \frac{-\left(\sqrt{\color{blue}{\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)}} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]57.7 | \[ \frac{-\left(\sqrt{\mathsf{hypot}\left(B, A - C\right) + \color{blue}{\left(C + A\right)}} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 41.4%
Simplified41.4%
[Start]41.4 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Applied egg-rr80.8%
[Start]41.4 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
associate-*r* [=>]41.4 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot \left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
sqrt-prod [=>]43.4 | \[ \frac{-\color{blue}{\sqrt{2 \cdot \left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
fma-neg [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\color{blue}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
distribute-lft-neg-in [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \color{blue}{\left(-4\right) \cdot \left(A \cdot C\right)}\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right) \cdot \left(-4\right)}\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
metadata-eval [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot \color{blue}{-4}\right) \cdot F\right)} \cdot \sqrt{\left(A + C\right) + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
associate-+l+ [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{\color{blue}{A + \left(C + \sqrt{B \cdot B + {\left(A - C\right)}^{2}}\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]43.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{A + \left(C + \sqrt{B \cdot B + \color{blue}{\left(A - C\right) \cdot \left(A - C\right)}}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
hypot-def [=>]80.8 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{A + \left(C + \color{blue}{\mathsf{hypot}\left(B, A - C\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Simplified80.8%
[Start]80.8 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]80.8 | \[ \frac{-\color{blue}{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]80.8 | \[ \frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.0%
[Start]0.0 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Taylor expanded in B around inf 0.0%
Taylor expanded in A around 0 12.9%
Simplified14.8%
[Start]12.9 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)}\right)
\] |
|---|---|
mul-1-neg [=>]12.9 | \[ \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)}}
\] |
distribute-rgt-neg-in [=>]12.9 | \[ \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)}\right)}
\] |
fma-def [=>]12.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \color{blue}{\mathsf{fma}\left(0.5, \frac{{C}^{2}}{B}, B\right)}\right)}\right)
\] |
unpow2 [=>]12.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{\color{blue}{C \cdot C}}{B}, B\right)\right)}\right)
\] |
associate-/l* [=>]14.8 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \color{blue}{\frac{C}{\frac{B}{C}}}, B\right)\right)}\right)
\] |
Applied egg-rr24.5%
[Start]14.8 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{C}{\frac{B}{C}}, B\right)\right)}\right)
\] |
|---|---|
sqrt-prod [=>]24.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{F} \cdot \sqrt{C + \mathsf{fma}\left(0.5, \frac{C}{\frac{B}{C}}, B\right)}}\right)
\] |
*-commutative [=>]24.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\color{blue}{\sqrt{C + \mathsf{fma}\left(0.5, \frac{C}{\frac{B}{C}}, B\right)} \cdot \sqrt{F}}\right)
\] |
associate-/r/ [=>]24.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{C + \mathsf{fma}\left(0.5, \color{blue}{\frac{C}{B} \cdot C}, B\right)} \cdot \sqrt{F}\right)
\] |
*-commutative [=>]24.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{C + \mathsf{fma}\left(0.5, \color{blue}{C \cdot \frac{C}{B}}, B\right)} \cdot \sqrt{F}\right)
\] |
Final simplification45.7%
| Alternative 1 | |
|---|---|
| Accuracy | 35.8% |
| Cost | 28180 |
| Alternative 2 | |
|---|---|
| Accuracy | 37.1% |
| Cost | 27984 |
| Alternative 3 | |
|---|---|
| Accuracy | 37.2% |
| Cost | 27984 |
| Alternative 4 | |
|---|---|
| Accuracy | 39.9% |
| Cost | 27784 |
| Alternative 5 | |
|---|---|
| Accuracy | 36.9% |
| Cost | 27268 |
| Alternative 6 | |
|---|---|
| Accuracy | 35.7% |
| Cost | 27152 |
| Alternative 7 | |
|---|---|
| Accuracy | 31.8% |
| Cost | 21916 |
| Alternative 8 | |
|---|---|
| Accuracy | 31.3% |
| Cost | 21660 |
| Alternative 9 | |
|---|---|
| Accuracy | 32.1% |
| Cost | 21512 |
| Alternative 10 | |
|---|---|
| Accuracy | 31.9% |
| Cost | 21452 |
| Alternative 11 | |
|---|---|
| Accuracy | 28.3% |
| Cost | 21132 |
| Alternative 12 | |
|---|---|
| Accuracy | 30.6% |
| Cost | 21128 |
| Alternative 13 | |
|---|---|
| Accuracy | 31.3% |
| Cost | 15308 |
| Alternative 14 | |
|---|---|
| Accuracy | 25.5% |
| Cost | 14088 |
| Alternative 15 | |
|---|---|
| Accuracy | 25.2% |
| Cost | 14088 |
| Alternative 16 | |
|---|---|
| Accuracy | 26.1% |
| Cost | 13580 |
| Alternative 17 | |
|---|---|
| Accuracy | 21.1% |
| Cost | 8324 |
| Alternative 18 | |
|---|---|
| Accuracy | 11.7% |
| Cost | 8196 |
| Alternative 19 | |
|---|---|
| Accuracy | 12.8% |
| Cost | 8196 |
| Alternative 20 | |
|---|---|
| Accuracy | 14.0% |
| Cost | 8192 |
| Alternative 21 | |
|---|---|
| Accuracy | 9.1% |
| Cost | 7689 |
| Alternative 22 | |
|---|---|
| Accuracy | 2.7% |
| Cost | 6848 |
| Alternative 23 | |
|---|---|
| Accuracy | 2.7% |
| Cost | 6848 |
herbie shell --seed 2023129
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))