| Alternative 1 | |
|---|---|
| Accuracy | 45.8% |
| Cost | 20168 |

(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 (fma B B (* A (* C -4.0)))) (t_1 (* B (* B 2.0))))
(if (<= B -3.45e+140)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(if (<= B -1.9e-37)
(/
(-
(*
(sqrt (fma C (* A -8.0) t_1))
(sqrt (* F (+ C (- A (hypot B (- A C))))))))
t_0)
(if (<= B 2e-81)
(/ (- (sqrt (* t_0 (* (* F 2.0) (+ A A))))) t_0)
(if (<= B 8.2e+14)
(/
(sqrt
(*
(+ A (+ A (* (/ B (/ C B)) -0.5)))
(+ (* F (* C (* A -8.0))) (* F t_1))))
(- (fma B B (* C (* A -4.0)))))
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A (hypot B A))))))))))))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 = fma(B, B, (A * (C * -4.0)));
double t_1 = B * (B * 2.0);
double tmp;
if (B <= -3.45e+140) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else if (B <= -1.9e-37) {
tmp = -(sqrt(fma(C, (A * -8.0), t_1)) * sqrt((F * (C + (A - hypot(B, (A - C))))))) / t_0;
} else if (B <= 2e-81) {
tmp = -sqrt((t_0 * ((F * 2.0) * (A + A)))) / t_0;
} else if (B <= 8.2e+14) {
tmp = sqrt(((A + (A + ((B / (C / B)) * -0.5))) * ((F * (C * (A * -8.0))) + (F * t_1)))) / -fma(B, B, (C * (A * -4.0)));
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(B, A))));
}
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 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(B * Float64(B * 2.0)) tmp = 0.0 if (B <= -3.45e+140) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); elseif (B <= -1.9e-37) tmp = Float64(Float64(-Float64(sqrt(fma(C, Float64(A * -8.0), t_1)) * sqrt(Float64(F * Float64(C + Float64(A - hypot(B, Float64(A - C)))))))) / t_0); elseif (B <= 2e-81) tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(Float64(F * 2.0) * Float64(A + A))))) / t_0); elseif (B <= 8.2e+14) tmp = Float64(sqrt(Float64(Float64(A + Float64(A + Float64(Float64(B / Float64(C / B)) * -0.5))) * Float64(Float64(F * Float64(C * Float64(A * -8.0))) + Float64(F * t_1)))) / Float64(-fma(B, B, Float64(C * Float64(A * -4.0))))); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - hypot(B, A)))))); 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[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * N[(B * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -3.45e+140], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, -1.9e-37], N[((-N[(N[Sqrt[N[(C * N[(A * -8.0), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(F * N[(C + N[(A - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2e-81], N[((-N[Sqrt[N[(t$95$0 * N[(N[(F * 2.0), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 8.2e+14], N[(N[Sqrt[N[(N[(A + N[(A + N[(N[(B / N[(C / B), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(F * N[(C * N[(A * -8.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := B \cdot \left(B \cdot 2\right)\\
\mathbf{if}\;B \leq -3.45 \cdot 10^{+140}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;B \leq -1.9 \cdot 10^{-37}:\\
\;\;\;\;\frac{-\sqrt{\mathsf{fma}\left(C, A \cdot -8, t_1\right)} \cdot \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2 \cdot 10^{-81}:\\
\;\;\;\;\frac{-\sqrt{t_0 \cdot \left(\left(F \cdot 2\right) \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 8.2 \cdot 10^{+14}:\\
\;\;\;\;\frac{\sqrt{\left(A + \left(A + \frac{B}{\frac{C}{B}} \cdot -0.5\right)\right) \cdot \left(F \cdot \left(C \cdot \left(A \cdot -8\right)\right) + F \cdot t_1\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\\
\end{array}
if B < -3.4500000000000001e140Initial program 0.2%
Simplified0.2%
[Start]0.2 | \[ \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.2%
Simplified0.2%
[Start]0.2 | \[ \frac{-\sqrt{2 \cdot \left(F \cdot {B}^{3}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]0.2 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right) \cdot {B}^{3}}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Taylor expanded in A around 0 50.7%
Simplified50.7%
[Start]50.7 | \[ -1 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)
\] |
|---|---|
mul-1-neg [=>]50.7 | \[ \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}}
\] |
*-commutative [=>]50.7 | \[ -\color{blue}{\sqrt{\frac{F}{B}} \cdot \sqrt{2}}
\] |
distribute-rgt-neg-in [=>]50.7 | \[ \color{blue}{\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)}
\] |
if -3.4500000000000001e140 < B < -1.9000000000000002e-37Initial program 37.8%
Simplified38.3%
[Start]37.8 | \[ \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-rr58.0%
[Start]38.3 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]52.4 | \[ \frac{-\sqrt{\color{blue}{\left(F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
sqrt-prod [=>]58.8 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate--r- [=>]58.0 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A - C\right)\right) + C\right)}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
+-commutative [=>]58.0 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]58.0 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, \color{blue}{\left(B \cdot B\right) \cdot 2}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate-*l* [=>]58.0 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, \color{blue}{B \cdot \left(B \cdot 2\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Simplified58.0%
[Start]58.0 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
unpow1/2 [<=]58.0 | \[ \frac{-\color{blue}{{\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]58.0 | \[ \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)} \cdot {\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]58.0 | \[ \frac{-\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \color{blue}{\left(2 \cdot B\right)}\right)} \cdot {\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow1/2 [=>]58.0 | \[ \frac{-\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(2 \cdot B\right)\right)} \cdot \color{blue}{\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
if -1.9000000000000002e-37 < B < 1.9999999999999999e-81Initial program 18.6%
Simplified24.5%
[Start]18.6 | \[ \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 C around inf 22.1%
Simplified22.1%
[Start]22.1 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A - -1 \cdot A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
cancel-sign-sub-inv [=>]22.1 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \color{blue}{\left(A + \left(--1\right) \cdot A\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
metadata-eval [=>]22.1 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \color{blue}{1} \cdot A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-lft-identity [=>]22.1 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(A + \color{blue}{A}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
if 1.9999999999999999e-81 < B < 8.2e14Initial program 26.8%
Simplified28.6%
[Start]26.8 | \[ \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 C around inf 22.3%
Simplified22.4%
[Start]22.3 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C} + -1 \cdot A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
mul-1-neg [=>]22.3 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C} + \color{blue}{\left(-A\right)}\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unsub-neg [=>]22.3 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \color{blue}{\left(0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C} - A\right)}\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate--l+ [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{\color{blue}{{B}^{2} + \left({A}^{2} - {\left(-1 \cdot A\right)}^{2}\right)}}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{\color{blue}{B \cdot B} + \left({A}^{2} - {\left(-1 \cdot A\right)}^{2}\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(\color{blue}{A \cdot A} - {\left(-1 \cdot A\right)}^{2}\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - \color{blue}{\left(-1 \cdot A\right) \cdot \left(-1 \cdot A\right)}\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
mul-1-neg [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - \color{blue}{\left(-A\right)} \cdot \left(-1 \cdot A\right)\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
mul-1-neg [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - \left(-A\right) \cdot \color{blue}{\left(-A\right)}\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
sqr-neg [=>]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - \color{blue}{A \cdot A}\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Applied egg-rr22.8%
[Start]22.4 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - A \cdot A\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
distribute-frac-neg [=>]22.4 | \[ \color{blue}{-\frac{\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - A \cdot A\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
neg-sub0 [=>]22.4 | \[ \color{blue}{0 - \frac{\sqrt{F \cdot \left(\left(A - \left(0.5 \cdot \frac{B \cdot B + \left(A \cdot A - A \cdot A\right)}{C} - A\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
Simplified22.8%
[Start]22.8 | \[ 0 - \frac{\sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
neg-sub0 [<=]22.8 | \[ \color{blue}{-\frac{\sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
neg-mul-1 [=>]22.8 | \[ \color{blue}{-1 \cdot \frac{\sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
metadata-eval [<=]22.8 | \[ \color{blue}{\frac{1}{-1}} \cdot \frac{\sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
times-frac [<=]22.8 | \[ \color{blue}{\frac{1 \cdot \sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{-1 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
neg-mul-1 [<=]22.8 | \[ \frac{1 \cdot \sqrt{F \cdot \left(\left(\left(A - 0.5 \cdot \frac{B \cdot B}{C}\right) + A\right) \cdot \mathsf{fma}\left(C, A \cdot -8, \left(B \cdot B\right) \cdot 2\right)\right)}}{\color{blue}{-\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
Applied egg-rr22.8%
[Start]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \left(\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
|---|---|
*-commutative [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
fma-udef [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \left(F \cdot \color{blue}{\left(C \cdot \left(A \cdot -8\right) + 2 \cdot \left(B \cdot B\right)\right)}\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
distribute-rgt-in [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \color{blue}{\left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \left(2 \cdot \left(B \cdot B\right)\right) \cdot F\right)}}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
*-commutative [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \color{blue}{\left(\left(B \cdot B\right) \cdot 2\right)} \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
associate-*l* [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{B \cdot B}{C} \cdot -0.5\right)\right) \cdot \left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \color{blue}{\left(B \cdot \left(B \cdot 2\right)\right)} \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
Taylor expanded in B around 0 22.8%
Simplified22.8%
[Start]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{{B}^{2}}{C} \cdot -0.5\right)\right) \cdot \left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \left(B \cdot \left(B \cdot 2\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
|---|---|
unpow2 [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \frac{\color{blue}{B \cdot B}}{C} \cdot -0.5\right)\right) \cdot \left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \left(B \cdot \left(B \cdot 2\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
associate-/l* [=>]22.8 | \[ \frac{\sqrt{\left(A + \left(A + \color{blue}{\frac{B}{\frac{C}{B}}} \cdot -0.5\right)\right) \cdot \left(\left(C \cdot \left(A \cdot -8\right)\right) \cdot F + \left(B \cdot \left(B \cdot 2\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)}
\] |
if 8.2e14 < B Initial program 11.5%
Simplified10.2%
[Start]11.5 | \[ \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 C around 0 14.5%
Simplified47.2%
[Start]14.5 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}\right)
\] |
|---|---|
mul-1-neg [=>]14.5 | \[ \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}}
\] |
distribute-rgt-neg-in [=>]14.5 | \[ \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}\right)}
\] |
*-commutative [=>]14.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{B}^{2} + {A}^{2}}\right)}}\right)
\] |
unpow2 [=>]14.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)}\right)
\] |
unpow2 [=>]14.5 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)}\right)
\] |
hypot-def [=>]47.2 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)}\right)
\] |
Final simplification37.0%
| Alternative 1 | |
|---|---|
| Accuracy | 45.8% |
| Cost | 20168 |
| Alternative 2 | |
|---|---|
| Accuracy | 36.6% |
| Cost | 15368 |
| Alternative 3 | |
|---|---|
| Accuracy | 36.6% |
| Cost | 15368 |
| Alternative 4 | |
|---|---|
| Accuracy | 38.4% |
| Cost | 14668 |
| Alternative 5 | |
|---|---|
| Accuracy | 36.9% |
| Cost | 13316 |
| Alternative 6 | |
|---|---|
| Accuracy | 29.2% |
| Cost | 8584 |
| Alternative 7 | |
|---|---|
| Accuracy | 29.2% |
| Cost | 8456 |
| Alternative 8 | |
|---|---|
| Accuracy | 23.3% |
| Cost | 8200 |
| Alternative 9 | |
|---|---|
| Accuracy | 19.7% |
| Cost | 8072 |
| Alternative 10 | |
|---|---|
| Accuracy | 9.3% |
| Cost | 7108 |
| Alternative 11 | |
|---|---|
| Accuracy | 5.5% |
| Cost | 6912 |
| Alternative 12 | |
|---|---|
| Accuracy | 5.4% |
| Cost | 6848 |
herbie shell --seed 2023159
(FPCore (A B C F)
:name "ABCF->ab-angle b"
: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))))