| Alternative 1 | |
|---|---|
| Error | 40.0 |
| Cost | 59976 |
(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 (hypot B (- A C)))
(t_1 (fma B B (* C (* A -4.0))))
(t_2 (* F (+ C (- A t_0))))
(t_3 (sqrt (* F (+ A (- C t_0)))))
(t_4 (fma B B (* A (* C -4.0))))
(t_5 (sqrt (* 2.0 t_4))))
(if (<= B -4.2e+86)
(* t_3 (/ (sqrt 2.0) B))
(if (<= B -5.6e-76)
(/ (* t_5 (- (sqrt t_2))) t_4)
(if (<= B 4.2e-259)
(/ (sqrt (* (- (* A 4.0) (/ B (/ C B))) (* F t_1))) (- t_1))
(if (<= B 1.05e-128)
(*
(/ (- t_5) t_4)
(pow (exp (* 0.25 (- (log (* F -2.0)) (log (/ -1.0 C))))) 2.0))
(if (<= B 1.2e-94)
(/ (- (sqrt (* t_4 (* A (* F 4.0))))) t_4)
(if (<= B 3700.0)
(/ (- (sqrt (* 2.0 (* t_4 t_2)))) t_4)
(* t_3 (/ (- (sqrt 2.0)) 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 = hypot(B, (A - C));
double t_1 = fma(B, B, (C * (A * -4.0)));
double t_2 = F * (C + (A - t_0));
double t_3 = sqrt((F * (A + (C - t_0))));
double t_4 = fma(B, B, (A * (C * -4.0)));
double t_5 = sqrt((2.0 * t_4));
double tmp;
if (B <= -4.2e+86) {
tmp = t_3 * (sqrt(2.0) / B);
} else if (B <= -5.6e-76) {
tmp = (t_5 * -sqrt(t_2)) / t_4;
} else if (B <= 4.2e-259) {
tmp = sqrt((((A * 4.0) - (B / (C / B))) * (F * t_1))) / -t_1;
} else if (B <= 1.05e-128) {
tmp = (-t_5 / t_4) * pow(exp((0.25 * (log((F * -2.0)) - log((-1.0 / C))))), 2.0);
} else if (B <= 1.2e-94) {
tmp = -sqrt((t_4 * (A * (F * 4.0)))) / t_4;
} else if (B <= 3700.0) {
tmp = -sqrt((2.0 * (t_4 * t_2))) / t_4;
} else {
tmp = t_3 * (-sqrt(2.0) / 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 = hypot(B, Float64(A - C)) t_1 = fma(B, B, Float64(C * Float64(A * -4.0))) t_2 = Float64(F * Float64(C + Float64(A - t_0))) t_3 = sqrt(Float64(F * Float64(A + Float64(C - t_0)))) t_4 = fma(B, B, Float64(A * Float64(C * -4.0))) t_5 = sqrt(Float64(2.0 * t_4)) tmp = 0.0 if (B <= -4.2e+86) tmp = Float64(t_3 * Float64(sqrt(2.0) / B)); elseif (B <= -5.6e-76) tmp = Float64(Float64(t_5 * Float64(-sqrt(t_2))) / t_4); elseif (B <= 4.2e-259) tmp = Float64(sqrt(Float64(Float64(Float64(A * 4.0) - Float64(B / Float64(C / B))) * Float64(F * t_1))) / Float64(-t_1)); elseif (B <= 1.05e-128) tmp = Float64(Float64(Float64(-t_5) / t_4) * (exp(Float64(0.25 * Float64(log(Float64(F * -2.0)) - log(Float64(-1.0 / C))))) ^ 2.0)); elseif (B <= 1.2e-94) tmp = Float64(Float64(-sqrt(Float64(t_4 * Float64(A * Float64(F * 4.0))))) / t_4); elseif (B <= 3700.0) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_4 * t_2)))) / t_4); else tmp = Float64(t_3 * Float64(Float64(-sqrt(2.0)) / 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[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * N[(C + N[(A - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(F * N[(A + N[(C - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(2.0 * t$95$4), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -4.2e+86], N[(t$95$3 * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -5.6e-76], N[(N[(t$95$5 * (-N[Sqrt[t$95$2], $MachinePrecision])), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[B, 4.2e-259], N[(N[Sqrt[N[(N[(N[(A * 4.0), $MachinePrecision] - N[(B / N[(C / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B, 1.05e-128], N[(N[((-t$95$5) / t$95$4), $MachinePrecision] * N[Power[N[Exp[N[(0.25 * N[(N[Log[N[(F * -2.0), $MachinePrecision]], $MachinePrecision] - N[Log[N[(-1.0 / C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.2e-94], N[((-N[Sqrt[N[(t$95$4 * N[(A * N[(F * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$4), $MachinePrecision], If[LessEqual[B, 3700.0], N[((-N[Sqrt[N[(2.0 * N[(t$95$4 * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$4), $MachinePrecision], N[(t$95$3 * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $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{hypot}\left(B, A - C\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_2 := F \cdot \left(C + \left(A - t_0\right)\right)\\
t_3 := \sqrt{F \cdot \left(A + \left(C - t_0\right)\right)}\\
t_4 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_5 := \sqrt{2 \cdot t_4}\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+86}:\\
\;\;\;\;t_3 \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq -5.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{t_5 \cdot \left(-\sqrt{t_2}\right)}{t_4}\\
\mathbf{elif}\;B \leq 4.2 \cdot 10^{-259}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot 4 - \frac{B}{\frac{C}{B}}\right) \cdot \left(F \cdot t_1\right)}}{-t_1}\\
\mathbf{elif}\;B \leq 1.05 \cdot 10^{-128}:\\
\;\;\;\;\frac{-t_5}{t_4} \cdot {\left(e^{0.25 \cdot \left(\log \left(F \cdot -2\right) - \log \left(\frac{-1}{C}\right)\right)}\right)}^{2}\\
\mathbf{elif}\;B \leq 1.2 \cdot 10^{-94}:\\
\;\;\;\;\frac{-\sqrt{t_4 \cdot \left(A \cdot \left(F \cdot 4\right)\right)}}{t_4}\\
\mathbf{elif}\;B \leq 3700:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_4 \cdot t_2\right)}}{t_4}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
if B < -4.1999999999999998e86Initial program 59.3
Simplified58.6
[Start]59.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}
\] |
|---|
Applied egg-rr53.3
Simplified53.3
[Start]53.3 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]53.3 | \[ \frac{-\color{blue}{\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, A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-+l- [<=]53.3 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [<=]53.3 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]53.3 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Applied egg-rr63.1
Simplified53.3
[Start]63.1 | \[ e^{\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]54.5 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)\right)}
\] |
expm1-log1p [=>]53.3 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
*-rgt-identity [<=]53.3 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot 1}
\] |
associate-*l/ [=>]53.3 | \[ \color{blue}{\frac{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
associate-*r/ [<=]53.3 | \[ \color{blue}{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
distribute-rgt-neg-in [=>]53.3 | \[ \color{blue}{\left(\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-*r* [<=]53.3 | \[ \color{blue}{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
distribute-lft-neg-out [=>]53.3 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
Taylor expanded in B around -inf 30.8
if -4.1999999999999998e86 < B < -5.6000000000000002e-76Initial program 42.0
Simplified36.4
[Start]42.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}
\] |
|---|
Applied egg-rr35.8
if -5.6000000000000002e-76 < B < 4.19999999999999995e-259Initial program 52.3
Simplified46.3
[Start]52.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 C around inf 51.4
Simplified51.4
[Start]51.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
unpow2 [=>]51.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(\color{blue}{B \cdot B} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]51.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + \color{blue}{A \cdot A}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
mul-1-neg [=>]51.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\color{blue}{\left(-A\right)}}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Applied egg-rr51.4
Simplified49.7
[Start]51.4 | \[ 0 - \frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
sub0-neg [=>]51.4 | \[ \color{blue}{-\frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
mul-1-neg [<=]51.4 | \[ \color{blue}{-1 \cdot \frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
metadata-eval [<=]51.4 | \[ \color{blue}{\frac{1}{-1}} \cdot \frac{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
times-frac [<=]51.4 | \[ \color{blue}{\frac{1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{-1 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
*-lft-identity [=>]51.4 | \[ \frac{\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}}{-1 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
if 4.19999999999999995e-259 < B < 1.0500000000000001e-128Initial program 52.8
Simplified47.2
[Start]52.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-rr51.7
Simplified51.7
[Start]51.7 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]51.7 | \[ \frac{-\color{blue}{\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, A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-+l- [<=]51.7 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [<=]51.7 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]51.7 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Applied egg-rr62.9
Simplified51.6
[Start]62.9 | \[ e^{\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]59.1 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)\right)}
\] |
expm1-log1p [=>]51.7 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
*-rgt-identity [<=]51.7 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot 1}
\] |
associate-*l/ [=>]51.7 | \[ \color{blue}{\frac{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
associate-*r/ [<=]52.0 | \[ \color{blue}{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
distribute-rgt-neg-in [=>]52.0 | \[ \color{blue}{\left(\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-*r* [<=]52.0 | \[ \color{blue}{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
distribute-lft-neg-out [=>]52.0 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
Applied egg-rr51.7
Taylor expanded in C around -inf 53.3
if 1.0500000000000001e-128 < B < 1.2e-94Initial program 50.6
Simplified45.2
[Start]50.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 49.5
Simplified49.5
[Start]49.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
unpow2 [=>]49.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(\color{blue}{B \cdot B} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]49.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + \color{blue}{A \cdot A}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
mul-1-neg [=>]49.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(\left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\color{blue}{\left(-A\right)}}^{2}}{C}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Taylor expanded in A around inf 48.3
Simplified48.3
[Start]48.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(4 \cdot \left(A \cdot F\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]48.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \color{blue}{\left(\left(A \cdot F\right) \cdot 4\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate-*l* [=>]48.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \color{blue}{\left(A \cdot \left(F \cdot 4\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
if 1.2e-94 < B < 3700Initial program 44.3
Simplified39.5
[Start]44.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}
\] |
|---|
if 3700 < B Initial program 55.6
Simplified54.1
[Start]55.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}
\] |
|---|
Applied egg-rr49.1
Simplified49.1
[Start]49.1 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]49.1 | \[ \frac{-\color{blue}{\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, A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-+l- [<=]49.1 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [<=]49.1 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]49.1 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Applied egg-rr62.8
Simplified49.1
[Start]62.8 | \[ e^{\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)} - 1
\] |
|---|---|
expm1-def [=>]53.2 | \[ \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)\right)}
\] |
expm1-log1p [=>]49.1 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
*-rgt-identity [<=]49.1 | \[ \color{blue}{\frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot 1}
\] |
associate-*l/ [=>]49.1 | \[ \color{blue}{\frac{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
associate-*r/ [<=]49.1 | \[ \color{blue}{\left(-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
distribute-rgt-neg-in [=>]49.1 | \[ \color{blue}{\left(\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-*r* [<=]49.1 | \[ \color{blue}{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
distribute-lft-neg-out [=>]49.1 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\right)}
\] |
Taylor expanded in B around inf 33.5
Simplified33.5
[Start]33.5 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)
\] |
|---|---|
mul-1-neg [=>]33.5 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\left(-\frac{\sqrt{2}}{B}\right)}
\] |
distribute-neg-frac [=>]33.5 | \[ \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2}}{B}}
\] |
Final simplification40.0
| Alternative 1 | |
|---|---|
| Error | 40.0 |
| Cost | 59976 |
| Alternative 2 | |
|---|---|
| Error | 40.1 |
| Cost | 34120 |
| Alternative 3 | |
|---|---|
| Error | 39.1 |
| Cost | 34120 |
| Alternative 4 | |
|---|---|
| Error | 39.0 |
| Cost | 27984 |
| Alternative 5 | |
|---|---|
| Error | 40.5 |
| Cost | 20872 |
| Alternative 6 | |
|---|---|
| Error | 41.3 |
| Cost | 20688 |
| Alternative 7 | |
|---|---|
| Error | 47.3 |
| Cost | 20432 |
| Alternative 8 | |
|---|---|
| Error | 41.9 |
| Cost | 20432 |
| Alternative 9 | |
|---|---|
| Error | 47.8 |
| Cost | 15380 |
| Alternative 10 | |
|---|---|
| Error | 48.8 |
| Cost | 14796 |
| Alternative 11 | |
|---|---|
| Error | 48.7 |
| Cost | 14096 |
| Alternative 12 | |
|---|---|
| Error | 48.8 |
| Cost | 13968 |
| Alternative 13 | |
|---|---|
| Error | 48.7 |
| Cost | 13904 |
| Alternative 14 | |
|---|---|
| Error | 53.0 |
| Cost | 8848 |
| Alternative 15 | |
|---|---|
| Error | 53.6 |
| Cost | 8068 |
| Alternative 16 | |
|---|---|
| Error | 52.8 |
| Cost | 8068 |
| Alternative 17 | |
|---|---|
| Error | 54.8 |
| Cost | 7940 |
| Alternative 18 | |
|---|---|
| Error | 58.5 |
| Cost | 7808 |
| Alternative 19 | |
|---|---|
| Error | 57.2 |
| Cost | 7808 |
| Alternative 20 | |
|---|---|
| Error | 62.6 |
| Cost | 7680 |
| Alternative 21 | |
|---|---|
| Error | 62.7 |
| Cost | 7616 |
| Alternative 22 | |
|---|---|
| Error | 63.1 |
| Cost | 7424 |
| Alternative 23 | |
|---|---|
| Error | 63.1 |
| Cost | 7296 |
herbie shell --seed 2023011
(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))))