| Alternative 1 | |
|---|---|
| Accuracy | 43.0% |
| Cost | 34384 |
(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 (fma B B t_0))
(t_2 (fma -4.0 (* A C) (* B B)))
(t_3 (+ (pow B 2.0) t_0))
(t_4
(-
(/
(sqrt
(*
(* 2.0 (* t_3 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
t_3)))
(t_5 (sqrt (* 2.0 (+ C (+ A (hypot B (- A C))))))))
(if (<= t_4 -2e-196)
(* (/ t_5 t_2) (* (sqrt t_2) (- (sqrt F))))
(if (<= t_4 0.0)
(/
(- (sqrt (* 2.0 (* t_1 (* F (fma 2.0 C (/ (* (* B B) -0.5) A)))))))
t_1)
(if (<= t_4 INFINITY)
(* t_5 (sqrt (* F (/ 1.0 (fma B B (* -4.0 (* A C)))))))
(* (/ (- (sqrt 2.0)) B) (* (sqrt F) (sqrt (+ 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 = C * (A * -4.0);
double t_1 = fma(B, B, t_0);
double t_2 = fma(-4.0, (A * C), (B * B));
double t_3 = pow(B, 2.0) + t_0;
double t_4 = -(sqrt(((2.0 * (t_3 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_3);
double t_5 = sqrt((2.0 * (C + (A + hypot(B, (A - C))))));
double tmp;
if (t_4 <= -2e-196) {
tmp = (t_5 / t_2) * (sqrt(t_2) * -sqrt(F));
} else if (t_4 <= 0.0) {
tmp = -sqrt((2.0 * (t_1 * (F * fma(2.0, C, (((B * B) * -0.5) / A)))))) / t_1;
} else if (t_4 <= ((double) INFINITY)) {
tmp = t_5 * sqrt((F * (1.0 / fma(B, B, (-4.0 * (A * C))))));
} else {
tmp = (-sqrt(2.0) / B) * (sqrt(F) * sqrt((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 = Float64(C * Float64(A * -4.0)) t_1 = fma(B, B, t_0) t_2 = fma(-4.0, Float64(A * C), Float64(B * B)) t_3 = Float64((B ^ 2.0) + t_0) t_4 = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(t_3 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_3)) t_5 = sqrt(Float64(2.0 * Float64(C + Float64(A + hypot(B, Float64(A - C)))))) tmp = 0.0 if (t_4 <= -2e-196) tmp = Float64(Float64(t_5 / t_2) * Float64(sqrt(t_2) * Float64(-sqrt(F)))); elseif (t_4 <= 0.0) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * fma(2.0, C, Float64(Float64(Float64(B * B) * -0.5) / A))))))) / t_1); elseif (t_4 <= Inf) tmp = Float64(t_5 * sqrt(Float64(F * Float64(1.0 / fma(B, B, Float64(-4.0 * Float64(A * C))))))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * Float64(sqrt(F) * sqrt(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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B, 2.0], $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$4 = (-N[(N[Sqrt[N[(N[(2.0 * N[(t$95$3 * 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$3), $MachinePrecision])}, Block[{t$95$5 = N[Sqrt[N[(2.0 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$4, -2e-196], N[(N[(t$95$5 / t$95$2), $MachinePrecision] * N[(N[Sqrt[t$95$2], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 0.0], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(2.0 * C + N[(N[(N[(B * B), $MachinePrecision] * -0.5), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[(t$95$5 * N[Sqrt[N[(F * N[(1.0 / N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[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 := C \cdot \left(A \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B, B, t_0\right)\\
t_2 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\
t_3 := {B}^{2} + t_0\\
t_4 := -\frac{\sqrt{\left(2 \cdot \left(t_3 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_3}\\
t_5 := \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
\mathbf{if}\;t_4 \leq -2 \cdot 10^{-196}:\\
\;\;\;\;\frac{t_5}{t_2} \cdot \left(\sqrt{t_2} \cdot \left(-\sqrt{F}\right)\right)\\
\mathbf{elif}\;t_4 \leq 0:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \mathsf{fma}\left(2, C, \frac{\left(B \cdot B\right) \cdot -0.5}{A}\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;t_5 \cdot \sqrt{F \cdot \frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \sqrt{A + \mathsf{hypot}\left(B, A\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))) < -2.0000000000000001e-196Initial program 40.7%
Simplified50.0%
[Start]40.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-rr63.3%
[Start]50.0 | \[ \frac{-\sqrt{\left(\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
sqrt-prod [=>]64.1 | \[ \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
associate-+r+ [=>]63.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \sqrt{2 \cdot \color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
+-commutative [=>]63.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \sqrt{2 \cdot \color{blue}{\left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Applied egg-rr64.0%
[Start]63.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
distribute-rgt-neg-in [=>]63.3 | \[ \frac{\color{blue}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
*-un-lft-identity [=>]63.3 | \[ \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F} \cdot \left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}\right)}{\color{blue}{1 \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}
\] |
times-frac [=>]63.3 | \[ \color{blue}{\frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{1} \cdot \frac{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}
\] |
associate-+r+ [=>]64.0 | \[ \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{1} \cdot \frac{-\sqrt{2 \cdot \color{blue}{\left(\left(\mathsf{hypot}\left(B, A - C\right) + A\right) + C\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
+-commutative [=>]64.0 | \[ \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{1} \cdot \frac{-\sqrt{2 \cdot \color{blue}{\left(C + \left(\mathsf{hypot}\left(B, A - C\right) + A\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
+-commutative [=>]64.0 | \[ \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{1} \cdot \frac{-\sqrt{2 \cdot \left(C + \color{blue}{\left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Applied egg-rr80.7%
[Start]64.0 | \[ \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{1} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
sqrt-prod [=>]80.7 | \[ \frac{\color{blue}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)} \cdot \sqrt{F}}}{1} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
if -2.0000000000000001e-196 < (/.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 6.3%
Simplified7.9%
[Start]6.3 | \[ \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 A around -inf 29.7%
Simplified29.7%
[Start]29.7 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(2 \cdot C + -0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
fma-def [=>]29.7 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \color{blue}{\mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B}^{2}}{A}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*r/ [=>]29.7 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(2, C, \color{blue}{\frac{-0.5 \cdot {B}^{2}}{A}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]29.7 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(2, C, \frac{-0.5 \cdot \color{blue}{\left(B \cdot B\right)}}{A}\right)\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 39.4%
Simplified57.6%
[Start]39.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-rr37.5%
[Start]57.6 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
add-sqr-sqrt [=>]57.3 | \[ \color{blue}{\sqrt{\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}} \cdot \sqrt{\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
sqrt-unprod [=>]49.3 | \[ \color{blue}{\sqrt{\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
frac-times [=>]37.5 | \[ \sqrt{\color{blue}{\frac{\left(-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}\right) \cdot \left(-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}\right)}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
Simplified40.4%
[Start]37.5 | \[ \sqrt{\frac{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)}{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}}
\] |
|---|---|
associate-*r* [=>]37.5 | \[ \sqrt{\frac{\color{blue}{\left(2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)}}{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}}
\] |
associate-/l* [=>]40.4 | \[ \sqrt{\color{blue}{\frac{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F}}}}
\] |
*-commutative [=>]40.4 | \[ \sqrt{\frac{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{\color{blue}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}}
\] |
Applied egg-rr45.9%
[Start]40.4 | \[ \sqrt{\frac{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
|---|---|
div-inv [=>]40.3 | \[ \sqrt{\color{blue}{\left(2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right) \cdot \frac{1}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}}
\] |
sqrt-prod [=>]47.0 | \[ \color{blue}{\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\frac{1}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}}
\] |
associate-+r+ [=>]47.0 | \[ \sqrt{2 \cdot \color{blue}{\left(\left(C + A\right) + \mathsf{hypot}\left(B, A - C\right)\right)}} \cdot \sqrt{\frac{1}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
+-commutative [=>]47.0 | \[ \sqrt{2 \cdot \color{blue}{\left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}} \cdot \sqrt{\frac{1}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}
\] |
clear-num [<=]47.3 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\color{blue}{\frac{F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}}}
\] |
*-commutative [=>]47.3 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\frac{\color{blue}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F}}{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}}
\] |
associate-/l* [=>]45.9 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\color{blue}{\frac{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F}}}}
\] |
associate-*r* [=>]45.9 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, \color{blue}{\left(C \cdot A\right) \cdot -4}\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F}}}
\] |
*-commutative [=>]45.9 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, \color{blue}{-4 \cdot \left(C \cdot A\right)}\right)}{\frac{{\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}^{2}}{F}}}
\] |
Simplified76.7%
[Start]45.9 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}}{F}}}
\] |
|---|---|
+-commutative [<=]45.9 | \[ \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \color{blue}{\left(A + C\right)}\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}}{F}}}
\] |
+-commutative [=>]45.9 | \[ \sqrt{2 \cdot \color{blue}{\left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}}{F}}}
\] |
+-commutative [=>]45.9 | \[ \sqrt{2 \cdot \left(\color{blue}{\left(C + A\right)} + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}}{F}}}
\] |
associate-+l+ [=>]45.9 | \[ \sqrt{2 \cdot \color{blue}{\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}}{F}}}
\] |
associate-/r/ [=>]52.7 | \[ \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\color{blue}{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{{\left(\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)\right)}^{2}} \cdot F}}
\] |
unpow2 [=>]52.7 | \[ \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\color{blue}{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right) \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}} \cdot F}
\] |
associate-/r* [=>]76.7 | \[ \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\color{blue}{\frac{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}} \cdot F}
\] |
*-inverses [=>]76.7 | \[ \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\frac{\color{blue}{1}}{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)} \cdot F}
\] |
*-commutative [<=]76.7 | \[ \sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \color{blue}{\left(A \cdot C\right)}\right)} \cdot F}
\] |
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 C around 0 0.5%
Simplified0.5%
[Start]0.5 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A + \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}\right)
\] |
|---|---|
associate-*r* [=>]0.5 | \[ \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{\left(A + \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}}
\] |
associate-*r/ [=>]0.5 | \[ \color{blue}{\frac{-1 \cdot \sqrt{2}}{B}} \cdot \sqrt{\left(A + \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}
\] |
mul-1-neg [=>]0.5 | \[ \frac{\color{blue}{-\sqrt{2}}}{B} \cdot \sqrt{\left(A + \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}
\] |
*-commutative [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{\color{blue}{F \cdot \left(A + \sqrt{{B}^{2} + {A}^{2}}\right)}}
\] |
unpow2 [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)}
\] |
unpow2 [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)}
\] |
Applied egg-rr26.8%
[Start]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A + \sqrt{B \cdot B + A \cdot A}\right)}
\] |
|---|---|
sqrt-prod [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{A + \sqrt{B \cdot B + A \cdot A}}\right)}
\] |
*-commutative [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{A + \sqrt{B \cdot B + A \cdot A}} \cdot \sqrt{F}\right)}
\] |
hypot-def [=>]26.8 | \[ \frac{-\sqrt{2}}{B} \cdot \left(\sqrt{A + \color{blue}{\mathsf{hypot}\left(B, A\right)}} \cdot \sqrt{F}\right)
\] |
Final simplification50.1%
| Alternative 1 | |
|---|---|
| Accuracy | 43.0% |
| Cost | 34384 |
| Alternative 2 | |
|---|---|
| Accuracy | 43.1% |
| Cost | 34120 |
| Alternative 3 | |
|---|---|
| Accuracy | 43.1% |
| Cost | 28112 |
| Alternative 4 | |
|---|---|
| Accuracy | 38.7% |
| Cost | 27856 |
| Alternative 5 | |
|---|---|
| Accuracy | 39.6% |
| Cost | 27856 |
| Alternative 6 | |
|---|---|
| Accuracy | 39.6% |
| Cost | 27856 |
| Alternative 7 | |
|---|---|
| Accuracy | 38.3% |
| Cost | 27140 |
| Alternative 8 | |
|---|---|
| Accuracy | 38.8% |
| Cost | 27140 |
| Alternative 9 | |
|---|---|
| Accuracy | 35.9% |
| Cost | 26964 |
| Alternative 10 | |
|---|---|
| Accuracy | 29.7% |
| Cost | 21716 |
| Alternative 11 | |
|---|---|
| Accuracy | 30.0% |
| Cost | 15308 |
| Alternative 12 | |
|---|---|
| Accuracy | 19.6% |
| Cost | 14620 |
| Alternative 13 | |
|---|---|
| Accuracy | 21.1% |
| Cost | 14604 |
| Alternative 14 | |
|---|---|
| Accuracy | 20.9% |
| Cost | 14604 |
| Alternative 15 | |
|---|---|
| Accuracy | 21.1% |
| Cost | 14476 |
| Alternative 16 | |
|---|---|
| Accuracy | 22.1% |
| Cost | 13968 |
| Alternative 17 | |
|---|---|
| Accuracy | 22.1% |
| Cost | 13840 |
| Alternative 18 | |
|---|---|
| Accuracy | 17.5% |
| Cost | 13584 |
| Alternative 19 | |
|---|---|
| Accuracy | 16.0% |
| Cost | 8976 |
| Alternative 20 | |
|---|---|
| Accuracy | 15.9% |
| Cost | 8848 |
| Alternative 21 | |
|---|---|
| Accuracy | 17.0% |
| Cost | 8584 |
| Alternative 22 | |
|---|---|
| Accuracy | 17.3% |
| Cost | 8584 |
| Alternative 23 | |
|---|---|
| Accuracy | 15.0% |
| Cost | 8072 |
| Alternative 24 | |
|---|---|
| Accuracy | 14.4% |
| Cost | 7053 |
| Alternative 25 | |
|---|---|
| Accuracy | 11.8% |
| Cost | 6656 |
| Alternative 26 | |
|---|---|
| Accuracy | 1.1% |
| Cost | 6592 |
herbie shell --seed 2023131
(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))))