| Alternative 1 | |
|---|---|
| Error | 38.4 |
| Cost | 27720 |
(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 (* -4.0 (* C A)))
(t_1 (+ (* B B) t_0))
(t_2
(-
(/
(sqrt (* -8.0 (* A (* (* F C) (+ C C)))))
(+ (* B B) (* A (* C -4.0))))))
(t_3 (sqrt (* F (+ C (- A (hypot B (- A C))))))))
(if (<= B -4.4e-109)
(* t_3 (/ (sqrt 2.0) B))
(if (<= B 1e-301)
t_2
(if (<= B 1.05e-160)
(/ (* 2.0 (* (* A (sqrt 2.0)) (sqrt (* C (* F -2.0))))) t_1)
(if (<= B 7.6e-116)
t_2
(if (<= B 2.8e-67)
(/
(*
(sqrt (* F (+ A A)))
(- (sqrt (* 2.0 (fma A (* C -4.0) (* B B))))))
t_0)
(if (<= B 3.7e-47)
(/ (- (sqrt (* 2.0 (* (* F t_1) (+ A (+ C A)))))) t_1)
(* 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 = -4.0 * (C * A);
double t_1 = (B * B) + t_0;
double t_2 = -(sqrt((-8.0 * (A * ((F * C) * (C + C))))) / ((B * B) + (A * (C * -4.0))));
double t_3 = sqrt((F * (C + (A - hypot(B, (A - C))))));
double tmp;
if (B <= -4.4e-109) {
tmp = t_3 * (sqrt(2.0) / B);
} else if (B <= 1e-301) {
tmp = t_2;
} else if (B <= 1.05e-160) {
tmp = (2.0 * ((A * sqrt(2.0)) * sqrt((C * (F * -2.0))))) / t_1;
} else if (B <= 7.6e-116) {
tmp = t_2;
} else if (B <= 2.8e-67) {
tmp = (sqrt((F * (A + A))) * -sqrt((2.0 * fma(A, (C * -4.0), (B * B))))) / t_0;
} else if (B <= 3.7e-47) {
tmp = -sqrt((2.0 * ((F * t_1) * (A + (C + A))))) / t_1;
} 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 = Float64(-4.0 * Float64(C * A)) t_1 = Float64(Float64(B * B) + t_0) t_2 = Float64(-Float64(sqrt(Float64(-8.0 * Float64(A * Float64(Float64(F * C) * Float64(C + C))))) / Float64(Float64(B * B) + Float64(A * Float64(C * -4.0))))) t_3 = sqrt(Float64(F * Float64(C + Float64(A - hypot(B, Float64(A - C)))))) tmp = 0.0 if (B <= -4.4e-109) tmp = Float64(t_3 * Float64(sqrt(2.0) / B)); elseif (B <= 1e-301) tmp = t_2; elseif (B <= 1.05e-160) tmp = Float64(Float64(2.0 * Float64(Float64(A * sqrt(2.0)) * sqrt(Float64(C * Float64(F * -2.0))))) / t_1); elseif (B <= 7.6e-116) tmp = t_2; elseif (B <= 2.8e-67) tmp = Float64(Float64(sqrt(Float64(F * Float64(A + A))) * Float64(-sqrt(Float64(2.0 * fma(A, Float64(C * -4.0), Float64(B * B)))))) / t_0); elseif (B <= 3.7e-47) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(A + Float64(C + A)))))) / t_1); 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[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + t$95$0), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[Sqrt[N[(-8.0 * N[(A * N[(N[(F * C), $MachinePrecision] * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])}, Block[{t$95$3 = N[Sqrt[N[(F * N[(C + N[(A - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -4.4e-109], N[(t$95$3 * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1e-301], t$95$2, If[LessEqual[B, 1.05e-160], N[(N[(2.0 * N[(N[(A * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(C * N[(F * -2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 7.6e-116], t$95$2, If[LessEqual[B, 2.8e-67], N[(N[(N[Sqrt[N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(A * N[(C * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 3.7e-47], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(A + N[(C + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $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 := -4 \cdot \left(C \cdot A\right)\\
t_1 := B \cdot B + t_0\\
t_2 := -\frac{\sqrt{-8 \cdot \left(A \cdot \left(\left(F \cdot C\right) \cdot \left(C + C\right)\right)\right)}}{B \cdot B + A \cdot \left(C \cdot -4\right)}\\
t_3 := \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
\mathbf{if}\;B \leq -4.4 \cdot 10^{-109}:\\
\;\;\;\;t_3 \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq 10^{-301}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 1.05 \cdot 10^{-160}:\\
\;\;\;\;\frac{2 \cdot \left(\left(A \cdot \sqrt{2}\right) \cdot \sqrt{C \cdot \left(F \cdot -2\right)}\right)}{t_1}\\
\mathbf{elif}\;B \leq 7.6 \cdot 10^{-116}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 2.8 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A + A\right)} \cdot \left(-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)}{t_0}\\
\mathbf{elif}\;B \leq 3.7 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(A + \left(C + A\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
if B < -4.3999999999999999e-109Initial program 52.4
Simplified49.2
[Start]52.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-rr46.0
Simplified46.0
[Start]46.0 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]46.0 | \[ \frac{-\color{blue}{\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(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [<=]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(B \cdot B + A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [<=]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \left(\color{blue}{{B}^{2}} + A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [=>]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A \cdot \left(-4 \cdot C\right) + {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [=>]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left(A, -4 \cdot C, {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, \color{blue}{C \cdot -4}, {B}^{2}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [=>]46.0 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, \color{blue}{B \cdot B}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Applied egg-rr46.0
Simplified46.0
[Start]46.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)
\] |
|---|---|
distribute-lft-neg-out [=>]46.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\left(-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \frac{1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)}
\] |
associate-*r/ [=>]46.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(-\color{blue}{\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot 1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}\right)
\] |
*-rgt-identity [=>]46.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)
\] |
distribute-frac-neg [<=]46.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
Taylor expanded in B around -inf 36.6
if -4.3999999999999999e-109 < B < 1.00000000000000007e-301 or 1.05e-160 < B < 7.6000000000000003e-116Initial program 51.6
Simplified46.0
[Start]51.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-rr46.0
Taylor expanded in A around inf 51.2
Simplified51.2
[Start]51.2 | \[ \frac{-\sqrt{-8 \cdot \left(A \cdot \left(\left(C - -1 \cdot C\right) \cdot \left(C \cdot F\right)\right)\right)}}{B \cdot B + A \cdot \left(C \cdot -4\right)}
\] |
|---|---|
*-commutative [=>]51.2 | \[ \frac{-\sqrt{-8 \cdot \left(A \cdot \color{blue}{\left(\left(C \cdot F\right) \cdot \left(C - -1 \cdot C\right)\right)}\right)}}{B \cdot B + A \cdot \left(C \cdot -4\right)}
\] |
*-commutative [=>]51.2 | \[ \frac{-\sqrt{-8 \cdot \left(A \cdot \left(\color{blue}{\left(F \cdot C\right)} \cdot \left(C - -1 \cdot C\right)\right)\right)}}{B \cdot B + A \cdot \left(C \cdot -4\right)}
\] |
mul-1-neg [=>]51.2 | \[ \frac{-\sqrt{-8 \cdot \left(A \cdot \left(\left(F \cdot C\right) \cdot \left(C - \color{blue}{\left(-C\right)}\right)\right)\right)}}{B \cdot B + A \cdot \left(C \cdot -4\right)}
\] |
if 1.00000000000000007e-301 < B < 1.05e-160Initial program 54.7
Simplified53.9
[Start]54.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}
\] |
|---|
Taylor expanded in A around 0 56.0
Simplified56.0
[Start]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{{B}^{2} + {C}^{2}} + -1 \cdot \left(\left(A \cdot C\right) \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
unpow2 [=>]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{\color{blue}{B \cdot B} + {C}^{2}} + -1 \cdot \left(\left(A \cdot C\right) \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{B \cdot B + \color{blue}{C \cdot C}} + -1 \cdot \left(\left(A \cdot C\right) \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
mul-1-neg [=>]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{B \cdot B + C \cdot C} + \color{blue}{\left(-\left(A \cdot C\right) \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}\right)}\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{B \cdot B + C \cdot C} + \left(-\left(A \cdot C\right) \cdot \sqrt{\frac{1}{\color{blue}{B \cdot B} + {C}^{2}}}\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]56.0 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \left(\sqrt{B \cdot B + C \cdot C} + \left(-\left(A \cdot C\right) \cdot \sqrt{\frac{1}{B \cdot B + \color{blue}{C \cdot C}}}\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Taylor expanded in A around -inf 57.2
Simplified57.2
[Start]57.2 | \[ \frac{--2 \cdot \left(\left(\sqrt{2} \cdot A\right) \cdot \sqrt{C \cdot \left(F \cdot \left(-1 \cdot \left(C \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}\right) - 1\right)\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
fma-neg [=>]57.2 | \[ \frac{--2 \cdot \left(\left(\sqrt{2} \cdot A\right) \cdot \sqrt{C \cdot \left(F \cdot \color{blue}{\mathsf{fma}\left(-1, C \cdot \sqrt{\frac{1}{{B}^{2} + {C}^{2}}}, -1\right)}\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]57.2 | \[ \frac{--2 \cdot \left(\left(\sqrt{2} \cdot A\right) \cdot \sqrt{C \cdot \left(F \cdot \mathsf{fma}\left(-1, C \cdot \sqrt{\frac{1}{\color{blue}{B \cdot B} + {C}^{2}}}, -1\right)\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]57.2 | \[ \frac{--2 \cdot \left(\left(\sqrt{2} \cdot A\right) \cdot \sqrt{C \cdot \left(F \cdot \mathsf{fma}\left(-1, C \cdot \sqrt{\frac{1}{B \cdot B + \color{blue}{C \cdot C}}}, -1\right)\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
metadata-eval [=>]57.2 | \[ \frac{--2 \cdot \left(\left(\sqrt{2} \cdot A\right) \cdot \sqrt{C \cdot \left(F \cdot \mathsf{fma}\left(-1, C \cdot \sqrt{\frac{1}{B \cdot B + C \cdot C}}, \color{blue}{-1}\right)\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Taylor expanded in C around inf 51.1
if 7.6000000000000003e-116 < B < 2.8000000000000001e-67Initial program 46.9
Simplified40.3
[Start]46.9 | \[ \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-rr41.7
Simplified41.7
[Start]41.7 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]41.7 | \[ \frac{-\color{blue}{\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(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [<=]41.7 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(B \cdot B + A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [<=]41.7 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \left(\color{blue}{{B}^{2}} + A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [=>]41.7 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A \cdot \left(-4 \cdot C\right) + {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [=>]41.7 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left(A, -4 \cdot C, {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]41.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(A, \color{blue}{C \cdot -4}, {B}^{2}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [=>]41.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(A, C \cdot -4, \color{blue}{B \cdot B}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Taylor expanded in C around inf 54.4
Simplified54.4
[Start]54.4 | \[ \frac{-\sqrt{\left(A - -1 \cdot A\right) \cdot F} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]54.4 | \[ \frac{-\sqrt{\color{blue}{F \cdot \left(A - -1 \cdot A\right)}} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
mul-1-neg [=>]54.4 | \[ \frac{-\sqrt{F \cdot \left(A - \color{blue}{\left(-A\right)}\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Taylor expanded in B around 0 56.4
Simplified56.4
[Start]56.4 | \[ \frac{-\sqrt{F \cdot \left(A - \left(-A\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{-4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]56.4 | \[ \frac{-\sqrt{F \cdot \left(A - \left(-A\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\color{blue}{\left(A \cdot C\right) \cdot -4}}
\] |
if 2.8000000000000001e-67 < B < 3.7e-47Initial program 47.0
Simplified46.7
[Start]47.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 -inf 55.9
Simplified55.9
[Start]55.9 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - -1 \cdot A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
mul-1-neg [=>]55.9 | \[ \frac{-\sqrt{2 \cdot \left(\left(\left(B \cdot B - 4 \cdot \left(A \cdot C\right)\right) \cdot F\right) \cdot \left(A + \left(C - \color{blue}{\left(-A\right)}\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
if 3.7e-47 < B Initial program 53.5
Simplified51.3
[Start]53.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}
\] |
|---|
Applied egg-rr46.9
Simplified46.9
[Start]46.9 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]46.9 | \[ \frac{-\color{blue}{\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(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [<=]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(B \cdot B + A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [<=]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \left(\color{blue}{{B}^{2}} + A \cdot \left(-4 \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [=>]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A \cdot \left(-4 \cdot C\right) + {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-def [=>]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left(A, -4 \cdot C, {B}^{2}\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, \color{blue}{C \cdot -4}, {B}^{2}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
unpow2 [=>]46.9 | \[ \frac{-\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, \color{blue}{B \cdot B}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Applied egg-rr46.9
Simplified46.9
[Start]46.9 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)
\] |
|---|---|
distribute-lft-neg-out [=>]46.9 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\left(-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \frac{1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)}
\] |
associate-*r/ [=>]46.9 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(-\color{blue}{\frac{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot 1}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}\right)
\] |
*-rgt-identity [=>]46.9 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}\right)
\] |
distribute-frac-neg [<=]46.9 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2 \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
Taylor expanded in A around 0 33.0
Simplified33.0
[Start]33.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)
\] |
|---|---|
mul-1-neg [=>]33.0 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\left(-\frac{\sqrt{2}}{B}\right)}
\] |
Final simplification41.2
| Alternative 1 | |
|---|---|
| Error | 38.4 |
| Cost | 27720 |
| Alternative 2 | |
|---|---|
| Error | 38.1 |
| Cost | 27720 |
| Alternative 3 | |
|---|---|
| Error | 38.1 |
| Cost | 21448 |
| Alternative 4 | |
|---|---|
| Error | 39.8 |
| Cost | 21192 |
| Alternative 5 | |
|---|---|
| Error | 40.8 |
| Cost | 20688 |
| Alternative 6 | |
|---|---|
| Error | 42.5 |
| Cost | 20228 |
| Alternative 7 | |
|---|---|
| Error | 47.7 |
| Cost | 14540 |
| Alternative 8 | |
|---|---|
| Error | 47.9 |
| Cost | 14276 |
| Alternative 9 | |
|---|---|
| Error | 48.7 |
| Cost | 13836 |
| Alternative 10 | |
|---|---|
| Error | 52.2 |
| Cost | 8584 |
| Alternative 11 | |
|---|---|
| Error | 52.5 |
| Cost | 8324 |
| Alternative 12 | |
|---|---|
| Error | 56.2 |
| Cost | 8205 |
| Alternative 13 | |
|---|---|
| Error | 55.9 |
| Cost | 7944 |
| Alternative 14 | |
|---|---|
| Error | 54.2 |
| Cost | 7940 |
| Alternative 15 | |
|---|---|
| Error | 58.1 |
| Cost | 7556 |
| Alternative 16 | |
|---|---|
| Error | 62.1 |
| Cost | 6848 |
| Alternative 17 | |
|---|---|
| Error | 62.2 |
| Cost | 6848 |
herbie shell --seed 2023060
(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))))