| Alternative 1 | |
|---|---|
| Error | 48.3% |
| Cost | 27860.00 |
(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 (hypot B (- A C)))))
(t_1 (* (* 4.0 A) C))
(t_2
(/
(-
(sqrt
(*
(* (* F (- t_1 (pow B 2.0))) -2.0)
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
(- (pow B 2.0) t_1)))
(t_3 (fma -4.0 (* A C) (* B B)))
(t_4 (fma B B (* C (* A -4.0))))
(t_5 (fma B B (* A (* C -4.0)))))
(if (<= t_2 -2e-180)
(* (/ (sqrt (* 2.0 t_0)) t_3) (* (sqrt t_3) (- (sqrt F))))
(if (<= t_2 0.0)
(-
(/
(sqrt (* 2.0 (* t_4 (* F (fma 2.0 A (* -0.5 (/ B (/ C B))))))))
t_4))
(if (<= t_2 INFINITY)
(fabs (/ (sqrt t_0) (/ t_5 (sqrt (* t_5 (* 2.0 F))))))
(* (/ (- (sqrt 2.0)) B) (* (sqrt F) (sqrt (+ C (hypot C B))))))))))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 + hypot(B, (A - C)));
double t_1 = (4.0 * A) * C;
double t_2 = -sqrt((((F * (t_1 - pow(B, 2.0))) * -2.0) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / (pow(B, 2.0) - t_1);
double t_3 = fma(-4.0, (A * C), (B * B));
double t_4 = fma(B, B, (C * (A * -4.0)));
double t_5 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (t_2 <= -2e-180) {
tmp = (sqrt((2.0 * t_0)) / t_3) * (sqrt(t_3) * -sqrt(F));
} else if (t_2 <= 0.0) {
tmp = -(sqrt((2.0 * (t_4 * (F * fma(2.0, A, (-0.5 * (B / (C / B)))))))) / t_4);
} else if (t_2 <= ((double) INFINITY)) {
tmp = fabs((sqrt(t_0) / (t_5 / sqrt((t_5 * (2.0 * F))))));
} else {
tmp = (-sqrt(2.0) / B) * (sqrt(F) * sqrt((C + hypot(C, B))));
}
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 + hypot(B, Float64(A - C)))) t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(Float64(-sqrt(Float64(Float64(Float64(F * Float64(t_1 - (B ^ 2.0))) * -2.0) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / Float64((B ^ 2.0) - t_1)) t_3 = fma(-4.0, Float64(A * C), Float64(B * B)) t_4 = fma(B, B, Float64(C * Float64(A * -4.0))) t_5 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (t_2 <= -2e-180) tmp = Float64(Float64(sqrt(Float64(2.0 * t_0)) / t_3) * Float64(sqrt(t_3) * Float64(-sqrt(F)))); elseif (t_2 <= 0.0) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_4 * Float64(F * fma(2.0, A, Float64(-0.5 * Float64(B / Float64(C / B)))))))) / t_4)); elseif (t_2 <= Inf) tmp = abs(Float64(sqrt(t_0) / Float64(t_5 / sqrt(Float64(t_5 * Float64(2.0 * F)))))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * Float64(sqrt(F) * sqrt(Float64(C + hypot(C, B))))); 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 + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(N[(F * N[(t$95$1 - N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $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]) / N[(N[Power[B, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-180], N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision] * N[(N[Sqrt[t$95$3], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 0.0], (-N[(N[Sqrt[N[(2.0 * N[(t$95$4 * N[(F * N[(2.0 * A + N[(-0.5 * N[(B / N[(C / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$4), $MachinePrecision]), If[LessEqual[t$95$2, Infinity], N[Abs[N[(N[Sqrt[t$95$0], $MachinePrecision] / N[(t$95$5 / N[Sqrt[N[(t$95$5 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 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 + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(\left(F \cdot \left(t_1 - {B}^{2}\right)\right) \cdot -2\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{{B}^{2} - t_1}\\
t_3 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\
t_4 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_5 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-180}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_0}}{t_3} \cdot \left(\sqrt{t_3} \cdot \left(-\sqrt{F}\right)\right)\\
\mathbf{elif}\;t_2 \leq 0:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_4 \cdot \left(F \cdot \mathsf{fma}\left(2, A, -0.5 \cdot \frac{B}{\frac{C}{B}}\right)\right)\right)}}{t_4}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\left|\frac{\sqrt{t_0}}{\frac{t_5}{\sqrt{t_5 \cdot \left(2 \cdot F\right)}}}\right|\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(C, B\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))) < -2e-180Initial program 39.7
Simplified49.0
[Start]39.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.0
[Start]49.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 [=>]63.8 | \[ \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.0 | \[ \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.0 | \[ \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-rr63.8
[Start]63.0 | \[ \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.0 | \[ \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.0 | \[ \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.0 | \[ \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+ [=>]63.8 | \[ \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 [=>]63.8 | \[ \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 [=>]63.8 | \[ \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)}
\] |
Simplified63.8
[Start]63.8 | \[ \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)}
\] |
|---|---|
/-rgt-identity [=>]63.8 | \[ \color{blue}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}} \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)}
\] |
*-commutative [=>]63.8 | \[ \sqrt{\color{blue}{F \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \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)}
\] |
*-commutative [=>]63.8 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)} \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)}
\] |
*-commutative [=>]63.8 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)}
\] |
Applied egg-rr79.7
[Start]63.8 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
|---|---|
sqrt-prod [=>]79.7 | \[ \color{blue}{\left(\sqrt{F} \cdot \sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
*-commutative [=>]79.7 | \[ \color{blue}{\left(\sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{F}\right)} \cdot \frac{-\sqrt{2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
if -2e-180 < (/.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 10.4
Simplified11.7
[Start]10.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}
\] |
|---|
Taylor expanded in C around -inf 28.0
Simplified28.0
[Start]28.0 | \[ \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 A + -0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
fma-def [=>]28.0 | \[ \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, A, -0.5 \cdot \frac{{B}^{2}}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]28.0 | \[ \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, A, -0.5 \cdot \frac{\color{blue}{B \cdot B}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-/l* [=>]28.0 | \[ \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, A, -0.5 \cdot \color{blue}{\frac{B}{\frac{C}{B}}}\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
Simplified39.3
[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-rr36.5
[Start]39.3 | \[ \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)}
\] |
|---|---|
add-sqr-sqrt [=>]39.2 | \[ \color{blue}{\sqrt{\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)}} \cdot \sqrt{\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)}}}
\] |
sqrt-unprod [=>]29.4 | \[ \color{blue}{\sqrt{\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)} \cdot \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)}}}
\] |
frac-times [=>]23.4 | \[ \sqrt{\color{blue}{\frac{\left(-\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)}\right) \cdot \left(-\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)}\right)}{\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot \left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right)}}}
\] |
Simplified39.7
[Start]36.5 | \[ \sqrt{\frac{\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)\right)}{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}}
\] |
|---|---|
associate-/l* [=>]39.7 | \[ \sqrt{\color{blue}{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)}}}}
\] |
*-commutative [=>]39.7 | \[ \sqrt{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}}
\] |
Applied egg-rr79.3
[Start]39.7 | \[ \sqrt{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}
\] |
|---|---|
add-sqr-sqrt [=>]39.7 | \[ \sqrt{\color{blue}{\sqrt{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}} \cdot \sqrt{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}}}
\] |
rem-sqrt-square [=>]39.7 | \[ \color{blue}{\left|\sqrt{\frac{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}\right|}
\] |
sqrt-div [=>]46.9 | \[ \left|\color{blue}{\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}}{\sqrt{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}}\right|
\] |
+-commutative [=>]46.9 | \[ \left|\frac{\sqrt{A + \color{blue}{\left(\mathsf{hypot}\left(B, A - C\right) + C\right)}}}{\sqrt{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}\right|
\] |
associate-+r+ [=>]46.9 | \[ \left|\frac{\sqrt{\color{blue}{\left(A + \mathsf{hypot}\left(B, A - C\right)\right) + C}}}{\sqrt{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}\right|
\] |
+-commutative [<=]46.9 | \[ \left|\frac{\sqrt{\color{blue}{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}}}{\sqrt{\frac{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}\right|
\] |
sqrt-div [=>]52.7 | \[ \left|\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}}{\color{blue}{\frac{\sqrt{{\left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}^{2}}}{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}}\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
Simplified1.3
[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 A around 0 0.6
Simplified0.6
[Start]0.6 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}\right)
\] |
|---|---|
associate-*r* [=>]0.6 | \[ \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}}
\] |
associate-*r/ [=>]0.6 | \[ \color{blue}{\frac{-1 \cdot \sqrt{2}}{B}} \cdot \sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}
\] |
mul-1-neg [=>]0.6 | \[ \frac{\color{blue}{-\sqrt{2}}}{B} \cdot \sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}
\] |
*-commutative [=>]0.6 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{\color{blue}{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}}
\] |
+-commutative [=>]0.6 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{\color{blue}{{C}^{2} + {B}^{2}}}\right)}
\] |
unpow2 [=>]0.6 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{\color{blue}{C \cdot C} + {B}^{2}}\right)}
\] |
unpow2 [=>]0.6 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{C \cdot C + \color{blue}{B \cdot B}}\right)}
\] |
Applied egg-rr26.7
[Start]0.6 | \[ \frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \sqrt{C \cdot C + B \cdot B}\right)}
\] |
|---|---|
sqrt-prod [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{F} \cdot \sqrt{C + \sqrt{C \cdot C + B \cdot B}}\right)}
\] |
*-commutative [=>]0.5 | \[ \frac{-\sqrt{2}}{B} \cdot \color{blue}{\left(\sqrt{C + \sqrt{C \cdot C + B \cdot B}} \cdot \sqrt{F}\right)}
\] |
hypot-def [=>]26.7 | \[ \frac{-\sqrt{2}}{B} \cdot \left(\sqrt{C + \color{blue}{\mathsf{hypot}\left(C, B\right)}} \cdot \sqrt{F}\right)
\] |
Final simplification49.4
| Alternative 1 | |
|---|---|
| Error | 48.3% |
| Cost | 27860.00 |
| Alternative 2 | |
|---|---|
| Error | 52.5% |
| Cost | 27848.00 |
| Alternative 3 | |
|---|---|
| Error | 48.4% |
| Cost | 27732.00 |
| Alternative 4 | |
|---|---|
| Error | 48.1% |
| Cost | 27596.00 |
| Alternative 5 | |
|---|---|
| Error | 47.9% |
| Cost | 27272.00 |
| Alternative 6 | |
|---|---|
| Error | 48.0% |
| Cost | 26568.00 |
| Alternative 7 | |
|---|---|
| Error | 43.4% |
| Cost | 26372.00 |
| Alternative 8 | |
|---|---|
| Error | 36.6% |
| Cost | 22120.00 |
| Alternative 9 | |
|---|---|
| Error | 36.8% |
| Cost | 21196.00 |
| Alternative 10 | |
|---|---|
| Error | 36.0% |
| Cost | 20689.00 |
| Alternative 11 | |
|---|---|
| Error | 35.9% |
| Cost | 15176.00 |
| Alternative 12 | |
|---|---|
| Error | 22.9% |
| Cost | 14105.00 |
| Alternative 13 | |
|---|---|
| Error | 30.4% |
| Cost | 13841.00 |
| Alternative 14 | |
|---|---|
| Error | 23.2% |
| Cost | 13712.00 |
| Alternative 15 | |
|---|---|
| Error | 17.4% |
| Cost | 8848.00 |
| Alternative 16 | |
|---|---|
| Error | 17.9% |
| Cost | 8844.00 |
| Alternative 17 | |
|---|---|
| Error | 17.8% |
| Cost | 8716.00 |
| Alternative 18 | |
|---|---|
| Error | 17.5% |
| Cost | 8336.00 |
| Alternative 19 | |
|---|---|
| Error | 15.5% |
| Cost | 7053.00 |
| Alternative 20 | |
|---|---|
| Error | 11.1% |
| Cost | 6656.00 |
| Alternative 21 | |
|---|---|
| Error | 1.2% |
| Cost | 6592.00 |
herbie shell --seed 2023104
(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))))