| Alternative 1 | |
|---|---|
| Error | 38.5 |
| Cost | 34760 |
(FPCore (A B C F)
:precision binary64
(/
(-
(sqrt
(*
(* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
(- (pow B 2.0) (* (* 4.0 A) C))))(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0))))
(t_1 (* F t_0))
(t_2 (- A (hypot B (- A C))))
(t_3 (* F (+ C t_2)))
(t_4 (sqrt t_3))
(t_5 (+ (* B B) (* A A)))
(t_6 (- A (sqrt t_5))))
(if (<= B -6e+35)
(* t_4 (/ (sqrt 2.0) B))
(if (<= B -5.5e-90)
(/ (- (sqrt (* 2.0 (* t_3 t_0)))) t_0)
(if (<= B -2.3e-115)
(*
(/ (sqrt (* 2.0 t_0)) t_0)
(-
(* (sqrt (/ F t_6)) (* (* C (+ 1.0 (* A (sqrt (/ 1.0 t_5))))) -0.5))
(sqrt (* F t_6))))
(if (<= B 1.3e-141)
(/ (- (sqrt (* 2.0 (+ (* t_1 t_2) (* C t_1))))) t_0)
(* t_4 (/ (- (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 = fma(B, B, (A * (C * -4.0)));
double t_1 = F * t_0;
double t_2 = A - hypot(B, (A - C));
double t_3 = F * (C + t_2);
double t_4 = sqrt(t_3);
double t_5 = (B * B) + (A * A);
double t_6 = A - sqrt(t_5);
double tmp;
if (B <= -6e+35) {
tmp = t_4 * (sqrt(2.0) / B);
} else if (B <= -5.5e-90) {
tmp = -sqrt((2.0 * (t_3 * t_0))) / t_0;
} else if (B <= -2.3e-115) {
tmp = (sqrt((2.0 * t_0)) / t_0) * ((sqrt((F / t_6)) * ((C * (1.0 + (A * sqrt((1.0 / t_5))))) * -0.5)) - sqrt((F * t_6)));
} else if (B <= 1.3e-141) {
tmp = -sqrt((2.0 * ((t_1 * t_2) + (C * t_1)))) / t_0;
} else {
tmp = t_4 * (-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 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(F * t_0) t_2 = Float64(A - hypot(B, Float64(A - C))) t_3 = Float64(F * Float64(C + t_2)) t_4 = sqrt(t_3) t_5 = Float64(Float64(B * B) + Float64(A * A)) t_6 = Float64(A - sqrt(t_5)) tmp = 0.0 if (B <= -6e+35) tmp = Float64(t_4 * Float64(sqrt(2.0) / B)); elseif (B <= -5.5e-90) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_3 * t_0)))) / t_0); elseif (B <= -2.3e-115) tmp = Float64(Float64(sqrt(Float64(2.0 * t_0)) / t_0) * Float64(Float64(sqrt(Float64(F / t_6)) * Float64(Float64(C * Float64(1.0 + Float64(A * sqrt(Float64(1.0 / t_5))))) * -0.5)) - sqrt(Float64(F * t_6)))); elseif (B <= 1.3e-141) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * t_2) + Float64(C * t_1))))) / t_0); else tmp = Float64(t_4 * 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[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(A - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(F * N[(C + t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[t$95$3], $MachinePrecision]}, Block[{t$95$5 = N[(N[(B * B), $MachinePrecision] + N[(A * A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(A - N[Sqrt[t$95$5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -6e+35], N[(t$95$4 * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -5.5e-90], N[((-N[Sqrt[N[(2.0 * N[(t$95$3 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, -2.3e-115], N[(N[(N[Sqrt[N[(2.0 * t$95$0), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision] * N[(N[(N[Sqrt[N[(F / t$95$6), $MachinePrecision]], $MachinePrecision] * N[(N[(C * N[(1.0 + N[(A * N[Sqrt[N[(1.0 / t$95$5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.5), $MachinePrecision]), $MachinePrecision] - N[Sqrt[N[(F * t$95$6), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.3e-141], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * t$95$2), $MachinePrecision] + N[(C * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(t$95$4 * 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{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := F \cdot t_0\\
t_2 := A - \mathsf{hypot}\left(B, A - C\right)\\
t_3 := F \cdot \left(C + t_2\right)\\
t_4 := \sqrt{t_3}\\
t_5 := B \cdot B + A \cdot A\\
t_6 := A - \sqrt{t_5}\\
\mathbf{if}\;B \leq -6 \cdot 10^{+35}:\\
\;\;\;\;t_4 \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq -5.5 \cdot 10^{-90}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_3 \cdot t_0\right)}}{t_0}\\
\mathbf{elif}\;B \leq -2.3 \cdot 10^{-115}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_0}}{t_0} \cdot \left(\sqrt{\frac{F}{t_6}} \cdot \left(\left(C \cdot \left(1 + A \cdot \sqrt{\frac{1}{t_5}}\right)\right) \cdot -0.5\right) - \sqrt{F \cdot t_6}\right)\\
\mathbf{elif}\;B \leq 1.3 \cdot 10^{-141}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot t_2 + C \cdot t_1\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_4 \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
if B < -5.99999999999999981e35Initial program 56.5
Simplified55.3
[Start]56.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-rr49.6
Simplified49.6
[Start]49.6 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]49.6 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]49.6 | \[ \frac{-\sqrt{F \cdot \left(\color{blue}{\left(A + C\right)} - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*r* [=>]49.6 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(C \cdot A\right) \cdot -4}\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [<=]49.6 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right)} \cdot -4\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr49.5
Simplified49.5
[Start]49.5 | \[ \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(C \cdot -4\right)\right)}\right)
\] |
|---|---|
associate-+r- [=>]49.6 | \[ \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
+-commutative [=>]49.6 | \[ \sqrt{F \cdot \left(\color{blue}{\left(C + A\right)} - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
associate-+r- [<=]49.6 | \[ \sqrt{F \cdot \color{blue}{\left(C + \left(A - \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(C \cdot -4\right)\right)}\right)
\] |
distribute-lft-neg-out [=>]49.6 | \[ \sqrt{F \cdot \left(C + \left(A - \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(C \cdot -4\right)\right)}\right)}
\] |
associate-*r/ [=>]49.5 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\color{blue}{\frac{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}\right)
\] |
*-rgt-identity [=>]49.5 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)
\] |
distribute-frac-neg [<=]49.5 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
Taylor expanded in B around -inf 30.7
if -5.99999999999999981e35 < B < -5.5000000000000003e-90Initial program 43.9
Simplified37.3
[Start]43.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}
\] |
|---|
if -5.5000000000000003e-90 < B < -2.29999999999999985e-115Initial program 47.4
Simplified42.4
[Start]47.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-rr42.9
Simplified42.9
[Start]42.9 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]42.9 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]42.9 | \[ \frac{-\sqrt{F \cdot \left(\color{blue}{\left(A + C\right)} - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*r* [=>]42.9 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(C \cdot A\right) \cdot -4}\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [<=]42.9 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right)} \cdot -4\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr42.4
Simplified42.2
[Start]42.4 | \[ \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(C \cdot -4\right)\right)}\right)
\] |
|---|---|
associate-+r- [=>]42.9 | \[ \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
+-commutative [=>]42.9 | \[ \sqrt{F \cdot \left(\color{blue}{\left(C + A\right)} - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
associate-+r- [<=]42.2 | \[ \sqrt{F \cdot \color{blue}{\left(C + \left(A - \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(C \cdot -4\right)\right)}\right)
\] |
distribute-lft-neg-out [=>]42.2 | \[ \sqrt{F \cdot \left(C + \left(A - \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(C \cdot -4\right)\right)}\right)}
\] |
associate-*r/ [=>]42.2 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\color{blue}{\frac{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}\right)
\] |
*-rgt-identity [=>]42.2 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)
\] |
distribute-frac-neg [<=]42.2 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
Taylor expanded in C around 0 53.3
Simplified53.3
[Start]53.3 | \[ \left(\sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F} + 0.5 \cdot \left(\sqrt{\frac{F}{A - \sqrt{{B}^{2} + {A}^{2}}}} \cdot \left(C \cdot \left(1 - -1 \cdot \left(A \cdot \sqrt{\frac{1}{{B}^{2} + {A}^{2}}}\right)\right)\right)\right)\right) \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
unpow2 [=>]53.3 | \[ \left(\sqrt{\left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right) \cdot F} + 0.5 \cdot \left(\sqrt{\frac{F}{A - \sqrt{{B}^{2} + {A}^{2}}}} \cdot \left(C \cdot \left(1 - -1 \cdot \left(A \cdot \sqrt{\frac{1}{{B}^{2} + {A}^{2}}}\right)\right)\right)\right)\right) \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow2 [=>]53.3 | \[ \left(\sqrt{\left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right) \cdot F} + 0.5 \cdot \left(\sqrt{\frac{F}{A - \sqrt{{B}^{2} + {A}^{2}}}} \cdot \left(C \cdot \left(1 - -1 \cdot \left(A \cdot \sqrt{\frac{1}{{B}^{2} + {A}^{2}}}\right)\right)\right)\right)\right) \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]53.3 | \[ \left(\sqrt{\left(A - \sqrt{B \cdot B + A \cdot A}\right) \cdot F} + \color{blue}{\left(\sqrt{\frac{F}{A - \sqrt{{B}^{2} + {A}^{2}}}} \cdot \left(C \cdot \left(1 - -1 \cdot \left(A \cdot \sqrt{\frac{1}{{B}^{2} + {A}^{2}}}\right)\right)\right)\right) \cdot 0.5}\right) \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate-*l* [=>]53.3 | \[ \left(\sqrt{\left(A - \sqrt{B \cdot B + A \cdot A}\right) \cdot F} + \color{blue}{\sqrt{\frac{F}{A - \sqrt{{B}^{2} + {A}^{2}}}} \cdot \left(\left(C \cdot \left(1 - -1 \cdot \left(A \cdot \sqrt{\frac{1}{{B}^{2} + {A}^{2}}}\right)\right)\right) \cdot 0.5\right)}\right) \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
if -2.29999999999999985e-115 < B < 1.30000000000000005e-141Initial program 52.0
Simplified46.0
[Start]52.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-rr46.1
if 1.30000000000000005e-141 < B Initial program 51.8
Simplified48.8
[Start]51.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-rr46.5
Simplified46.5
[Start]46.5 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]46.5 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(\left(C + A\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]46.5 | \[ \frac{-\sqrt{F \cdot \left(\color{blue}{\left(A + C\right)} - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*r* [=>]46.5 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(C \cdot A\right) \cdot -4}\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [<=]46.5 | \[ \frac{-\sqrt{F \cdot \left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right)} \cdot -4\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr46.2
Simplified46.3
[Start]46.2 | \[ \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(C \cdot -4\right)\right)}\right)
\] |
|---|---|
associate-+r- [=>]46.5 | \[ \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
+-commutative [=>]46.5 | \[ \sqrt{F \cdot \left(\color{blue}{\left(C + A\right)} - \mathsf{hypot}\left(B, A - C\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(C \cdot -4\right)\right)}\right)
\] |
associate-+r- [<=]46.3 | \[ \sqrt{F \cdot \color{blue}{\left(C + \left(A - \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(C \cdot -4\right)\right)}\right)
\] |
distribute-lft-neg-out [=>]46.3 | \[ \sqrt{F \cdot \left(C + \left(A - \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(C \cdot -4\right)\right)}\right)}
\] |
associate-*r/ [=>]46.3 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\color{blue}{\frac{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)} \cdot 1}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}\right)
\] |
*-rgt-identity [=>]46.3 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-\frac{\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)
\] |
distribute-frac-neg [<=]46.3 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}}
\] |
Taylor expanded in B around inf 37.4
Simplified37.4
[Start]37.4 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)
\] |
|---|---|
associate-*r/ [=>]37.4 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{-1 \cdot \sqrt{2}}{B}}
\] |
mul-1-neg [=>]37.4 | \[ \sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\color{blue}{-\sqrt{2}}}{B}
\] |
Final simplification38.8
| Alternative 1 | |
|---|---|
| Error | 38.5 |
| Cost | 34760 |
| Alternative 2 | |
|---|---|
| Error | 38.9 |
| Cost | 27984 |
| Alternative 3 | |
|---|---|
| Error | 38.5 |
| Cost | 27720 |
| Alternative 4 | |
|---|---|
| Error | 41.0 |
| Cost | 27404 |
| Alternative 5 | |
|---|---|
| Error | 40.9 |
| Cost | 21528 |
| Alternative 6 | |
|---|---|
| Error | 41.2 |
| Cost | 21084 |
| Alternative 7 | |
|---|---|
| Error | 47.7 |
| Cost | 20492 |
| Alternative 8 | |
|---|---|
| Error | 48.4 |
| Cost | 15632 |
| Alternative 9 | |
|---|---|
| Error | 51.3 |
| Cost | 14737 |
| Alternative 10 | |
|---|---|
| Error | 51.1 |
| Cost | 14608 |
| Alternative 11 | |
|---|---|
| Error | 51.1 |
| Cost | 14476 |
| Alternative 12 | |
|---|---|
| Error | 51.1 |
| Cost | 14348 |
| Alternative 13 | |
|---|---|
| Error | 51.3 |
| Cost | 14344 |
| Alternative 14 | |
|---|---|
| Error | 51.5 |
| Cost | 13584 |
| Alternative 15 | |
|---|---|
| Error | 54.0 |
| Cost | 8980 |
| Alternative 16 | |
|---|---|
| Error | 53.0 |
| Cost | 8976 |
| Alternative 17 | |
|---|---|
| Error | 52.4 |
| Cost | 8972 |
| Alternative 18 | |
|---|---|
| Error | 52.7 |
| Cost | 8716 |
| Alternative 19 | |
|---|---|
| Error | 53.1 |
| Cost | 8588 |
| Alternative 20 | |
|---|---|
| Error | 53.1 |
| Cost | 8460 |
| Alternative 21 | |
|---|---|
| Error | 53.8 |
| Cost | 8337 |
| Alternative 22 | |
|---|---|
| Error | 54.0 |
| Cost | 8072 |
| Alternative 23 | |
|---|---|
| Error | 54.2 |
| Cost | 7053 |
| Alternative 24 | |
|---|---|
| Error | 56.8 |
| Cost | 6656 |
| Alternative 25 | |
|---|---|
| Error | 63.3 |
| Cost | 6592 |
herbie shell --seed 2023054
(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))))