| Alternative 1 | |
|---|---|
| Error | 32.7 |
| Cost | 155788 |
(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 (- (sqrt F)))
(t_1 (sqrt (* 2.0 (+ A (+ C (hypot B (- A C)))))))
(t_2 (fma B B (* C (* A -4.0))))
(t_3
(/
(-
(sqrt
(* 2.0 (* t_2 (+ (* F (* (* B B) (/ -0.5 A))) (* F (* 2.0 C)))))))
t_2))
(t_4 (fma -4.0 (* A C) (* B B))))
(if (<= B -2.8e-60)
(* t_1 (/ t_0 (- B)))
(if (<= B -1.65e-260)
(/ (* (sqrt (* F t_4)) (- (sqrt (* 2.0 (* 2.0 C))))) t_4)
(if (<= B 3.2e-239)
(/
(- (pow (* (* A (* F (* A C))) -16.0) 0.5))
(+ (* B B) (* -4.0 (* A C))))
(if (<= B 8e-94)
t_3
(if (<= B 1.45e-48)
(* (/ (sqrt F) (sqrt t_4)) (- (sqrt (* 2.0 (+ A A)))))
(if (<= B 0.036)
t_3
(* t_1 (/ t_0 (fma -2.0 (* C (/ A B)) 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 = -sqrt(F);
double t_1 = sqrt((2.0 * (A + (C + hypot(B, (A - C))))));
double t_2 = fma(B, B, (C * (A * -4.0)));
double t_3 = -sqrt((2.0 * (t_2 * ((F * ((B * B) * (-0.5 / A))) + (F * (2.0 * C)))))) / t_2;
double t_4 = fma(-4.0, (A * C), (B * B));
double tmp;
if (B <= -2.8e-60) {
tmp = t_1 * (t_0 / -B);
} else if (B <= -1.65e-260) {
tmp = (sqrt((F * t_4)) * -sqrt((2.0 * (2.0 * C)))) / t_4;
} else if (B <= 3.2e-239) {
tmp = -pow(((A * (F * (A * C))) * -16.0), 0.5) / ((B * B) + (-4.0 * (A * C)));
} else if (B <= 8e-94) {
tmp = t_3;
} else if (B <= 1.45e-48) {
tmp = (sqrt(F) / sqrt(t_4)) * -sqrt((2.0 * (A + A)));
} else if (B <= 0.036) {
tmp = t_3;
} else {
tmp = t_1 * (t_0 / fma(-2.0, (C * (A / B)), 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(-sqrt(F)) t_1 = sqrt(Float64(2.0 * Float64(A + Float64(C + hypot(B, Float64(A - C)))))) t_2 = fma(B, B, Float64(C * Float64(A * -4.0))) t_3 = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(Float64(F * Float64(Float64(B * B) * Float64(-0.5 / A))) + Float64(F * Float64(2.0 * C))))))) / t_2) t_4 = fma(-4.0, Float64(A * C), Float64(B * B)) tmp = 0.0 if (B <= -2.8e-60) tmp = Float64(t_1 * Float64(t_0 / Float64(-B))); elseif (B <= -1.65e-260) tmp = Float64(Float64(sqrt(Float64(F * t_4)) * Float64(-sqrt(Float64(2.0 * Float64(2.0 * C))))) / t_4); elseif (B <= 3.2e-239) tmp = Float64(Float64(-(Float64(Float64(A * Float64(F * Float64(A * C))) * -16.0) ^ 0.5)) / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))); elseif (B <= 8e-94) tmp = t_3; elseif (B <= 1.45e-48) tmp = Float64(Float64(sqrt(F) / sqrt(t_4)) * Float64(-sqrt(Float64(2.0 * Float64(A + A))))); elseif (B <= 0.036) tmp = t_3; else tmp = Float64(t_1 * Float64(t_0 / fma(-2.0, Float64(C * Float64(A / B)), 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[F], $MachinePrecision])}, Block[{t$95$1 = N[Sqrt[N[(2.0 * N[(A + N[(C + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(N[(F * N[(N[(B * B), $MachinePrecision] * N[(-0.5 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(F * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.8e-60], N[(t$95$1 * N[(t$95$0 / (-B)), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.65e-260], N[(N[(N[Sqrt[N[(F * t$95$4), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[B, 3.2e-239], N[((-N[Power[N[(N[(A * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -16.0), $MachinePrecision], 0.5], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8e-94], t$95$3, If[LessEqual[B, 1.45e-48], N[(N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 0.036], t$95$3, N[(t$95$1 * N[(t$95$0 / N[(-2.0 * N[(C * N[(A / B), $MachinePrecision]), $MachinePrecision] + B), $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 := -\sqrt{F}\\
t_1 := \sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}\\
t_2 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_3 := \frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \left(\left(B \cdot B\right) \cdot \frac{-0.5}{A}\right) + F \cdot \left(2 \cdot C\right)\right)\right)}}{t_2}\\
t_4 := \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)\\
\mathbf{if}\;B \leq -2.8 \cdot 10^{-60}:\\
\;\;\;\;t_1 \cdot \frac{t_0}{-B}\\
\mathbf{elif}\;B \leq -1.65 \cdot 10^{-260}:\\
\;\;\;\;\frac{\sqrt{F \cdot t_4} \cdot \left(-\sqrt{2 \cdot \left(2 \cdot C\right)}\right)}{t_4}\\
\mathbf{elif}\;B \leq 3.2 \cdot 10^{-239}:\\
\;\;\;\;\frac{-{\left(\left(A \cdot \left(F \cdot \left(A \cdot C\right)\right)\right) \cdot -16\right)}^{0.5}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B \leq 8 \cdot 10^{-94}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{-48}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{t_4}} \cdot \left(-\sqrt{2 \cdot \left(A + A\right)}\right)\\
\mathbf{elif}\;B \leq 0.036:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \frac{t_0}{\mathsf{fma}\left(-2, C \cdot \frac{A}{B}, B\right)}\\
\end{array}
if B < -2.8000000000000002e-60Initial program 52.6
Simplified50.1
[Start]52.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-rr45.9
Simplified45.8
[Start]45.9 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
*-commutative [<=]45.9 | \[ \frac{-\color{blue}{\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)}
\] |
*-commutative [=>]45.9 | \[ \frac{-\sqrt{\color{blue}{F \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \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)}
\] |
*-commutative [=>]45.9 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)} \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)}
\] |
+-commutative [=>]45.9 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \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)}
\] |
associate-+r+ [<=]45.8 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Applied egg-rr45.9
Simplified45.8
[Start]45.9 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \left(\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)
\] |
|---|---|
associate-*r/ [=>]45.9 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\frac{\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
*-rgt-identity [=>]45.9 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\color{blue}{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
distribute-frac-neg [=>]45.9 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\left(-\frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)}
\] |
distribute-rgt-neg-out [=>]45.9 | \[ \color{blue}{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
associate-*r/ [=>]45.9 | \[ -\color{blue}{\frac{\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
Applied egg-rr42.6
Simplified41.4
[Start]42.6 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\frac{\sqrt{F}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}\right)
\] |
|---|---|
associate-*l/ [=>]42.6 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{\sqrt{F} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}
\] |
*-inverses [=>]41.4 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot \color{blue}{1}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}
\] |
Taylor expanded in B around -inf 27.2
Simplified27.2
[Start]27.2 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{-1 \cdot B}
\] |
|---|---|
mul-1-neg [=>]27.2 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{\color{blue}{-B}}
\] |
if -2.8000000000000002e-60 < B < -1.6499999999999999e-260Initial program 51.3
Simplified46.1
[Start]51.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-rr42.1
Simplified41.5
[Start]42.1 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
*-commutative [<=]42.1 | \[ \frac{-\color{blue}{\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)}
\] |
*-commutative [=>]42.1 | \[ \frac{-\sqrt{\color{blue}{F \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \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)}
\] |
*-commutative [=>]42.1 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)} \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)}
\] |
+-commutative [=>]42.1 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \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)}
\] |
associate-+r+ [<=]41.5 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Taylor expanded in A around -inf 48.9
if -1.6499999999999999e-260 < B < 3.1999999999999999e-239Initial program 54.0
Simplified54.0
[Start]54.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 B around 0 55.0
Simplified54.9
[Start]55.0 | \[ \frac{-\sqrt{2 \cdot \left(-8 \cdot \left({A}^{2} \cdot \left(C \cdot F\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
associate-*r* [=>]54.9 | \[ \frac{-\sqrt{2 \cdot \left(-8 \cdot \color{blue}{\left(\left({A}^{2} \cdot C\right) \cdot F\right)}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]54.9 | \[ \frac{-\sqrt{2 \cdot \left(-8 \cdot \left(\left(\color{blue}{\left(A \cdot A\right)} \cdot C\right) \cdot F\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Applied egg-rr50.1
if 3.1999999999999999e-239 < B < 7.9999999999999996e-94 or 1.4500000000000001e-48 < B < 0.0359999999999999973Initial program 48.6
Simplified44.1
[Start]48.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 A around -inf 49.4
Simplified49.4
[Start]49.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(2 \cdot C + -0.5 \cdot \frac{{B}^{2}}{A}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
fma-def [=>]49.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \color{blue}{\mathsf{fma}\left(2, C, -0.5 \cdot \frac{{B}^{2}}{A}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*r/ [=>]49.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(2, C, \color{blue}{\frac{-0.5 \cdot {B}^{2}}{A}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]49.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(2, C, \frac{-0.5 \cdot \color{blue}{\left(B \cdot B\right)}}{A}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr49.4
if 7.9999999999999996e-94 < B < 1.4500000000000001e-48Initial program 47.2
Simplified41.7
[Start]47.2 | \[ \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-rr38.2
Simplified37.7
[Start]38.2 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
*-commutative [<=]38.2 | \[ \frac{-\color{blue}{\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)}
\] |
*-commutative [=>]38.2 | \[ \frac{-\sqrt{\color{blue}{F \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \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)}
\] |
*-commutative [=>]38.2 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)} \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)}
\] |
+-commutative [=>]38.2 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \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)}
\] |
associate-+r+ [<=]37.7 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Applied egg-rr38.2
Simplified37.7
[Start]38.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \left(\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)
\] |
|---|---|
associate-*r/ [=>]38.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\frac{\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
*-rgt-identity [=>]38.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\color{blue}{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
distribute-frac-neg [=>]38.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\left(-\frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)}
\] |
distribute-rgt-neg-out [=>]38.2 | \[ \color{blue}{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
associate-*r/ [=>]38.2 | \[ -\color{blue}{\frac{\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
Applied egg-rr39.1
Simplified38.9
[Start]39.1 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\frac{\sqrt{F}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}\right)
\] |
|---|---|
associate-*l/ [=>]39.1 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{\sqrt{F} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}
\] |
*-inverses [=>]38.9 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot \color{blue}{1}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}
\] |
Taylor expanded in C around -inf 54.2
if 0.0359999999999999973 < B Initial program 54.3
Simplified52.5
[Start]54.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-rr48.2
Simplified48.2
[Start]48.2 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(A + C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right) \cdot F}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
*-commutative [<=]48.2 | \[ \frac{-\color{blue}{\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)}
\] |
*-commutative [=>]48.2 | \[ \frac{-\sqrt{\color{blue}{F \cdot \mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \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)}
\] |
*-commutative [=>]48.2 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, \color{blue}{C \cdot A}, B \cdot B\right)} \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)}
\] |
+-commutative [=>]48.2 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \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)}
\] |
associate-+r+ [<=]48.2 | \[ \frac{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
Applied egg-rr48.2
Simplified48.2
[Start]48.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \left(\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)
\] |
|---|---|
associate-*r/ [=>]48.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\frac{\left(-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}\right) \cdot 1}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
*-rgt-identity [=>]48.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\color{blue}{-\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
distribute-frac-neg [=>]48.2 | \[ \sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \color{blue}{\left(-\frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}\right)}
\] |
distribute-rgt-neg-out [=>]48.2 | \[ \color{blue}{-\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \frac{\sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
associate-*r/ [=>]48.2 | \[ -\color{blue}{\frac{\sqrt{F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{2 \cdot \left(\mathsf{hypot}\left(B, A - C\right) + \left(C + A\right)\right)}}{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}}
\] |
Applied egg-rr43.5
Simplified42.2
[Start]43.5 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(\frac{\sqrt{F}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}\right)
\] |
|---|---|
associate-*l/ [=>]43.5 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \color{blue}{\frac{\sqrt{F} \cdot \frac{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}}
\] |
*-inverses [=>]42.2 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot \color{blue}{1}}{\sqrt{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}}
\] |
Taylor expanded in A around 0 25.1
Simplified23.9
[Start]25.1 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{-2 \cdot \frac{A \cdot C}{B} + B}
\] |
|---|---|
fma-def [=>]25.1 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{\color{blue}{\mathsf{fma}\left(-2, \frac{A \cdot C}{B}, B\right)}}
\] |
associate-/l* [=>]23.9 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{\mathsf{fma}\left(-2, \color{blue}{\frac{A}{\frac{B}{C}}}, B\right)}
\] |
associate-/r/ [=>]23.9 | \[ -\sqrt{2 \cdot \left(A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \frac{\sqrt{F} \cdot 1}{\mathsf{fma}\left(-2, \color{blue}{\frac{A}{B} \cdot C}, B\right)}
\] |
Final simplification36.6
| Alternative 1 | |
|---|---|
| Error | 32.7 |
| Cost | 155788 |
| Alternative 2 | |
|---|---|
| Error | 31.9 |
| Cost | 27848 |
| Alternative 3 | |
|---|---|
| Error | 36.7 |
| Cost | 27736 |
| Alternative 4 | |
|---|---|
| Error | 34.9 |
| Cost | 27728 |
| Alternative 5 | |
|---|---|
| Error | 34.3 |
| Cost | 27592 |
| Alternative 6 | |
|---|---|
| Error | 36.7 |
| Cost | 27284 |
| Alternative 7 | |
|---|---|
| Error | 36.6 |
| Cost | 21904 |
| Alternative 8 | |
|---|---|
| Error | 36.7 |
| Cost | 21528 |
| Alternative 9 | |
|---|---|
| Error | 36.6 |
| Cost | 21328 |
| Alternative 10 | |
|---|---|
| Error | 53.2 |
| Cost | 21280 |
| Alternative 11 | |
|---|---|
| Error | 46.4 |
| Cost | 21280 |
| Alternative 12 | |
|---|---|
| Error | 46.4 |
| Cost | 21216 |
| Alternative 13 | |
|---|---|
| Error | 38.2 |
| Cost | 21216 |
| Alternative 14 | |
|---|---|
| Error | 38.2 |
| Cost | 21216 |
| Alternative 15 | |
|---|---|
| Error | 54.2 |
| Cost | 16352 |
| Alternative 16 | |
|---|---|
| Error | 54.0 |
| Cost | 15776 |
| Alternative 17 | |
|---|---|
| Error | 53.2 |
| Cost | 15120 |
| Alternative 18 | |
|---|---|
| Error | 54.5 |
| Cost | 15004 |
| Alternative 19 | |
|---|---|
| Error | 53.5 |
| Cost | 8584 |
| Alternative 20 | |
|---|---|
| Error | 55.2 |
| Cost | 7945 |
| Alternative 21 | |
|---|---|
| Error | 55.4 |
| Cost | 7945 |
| Alternative 22 | |
|---|---|
| Error | 54.8 |
| Cost | 7940 |
| Alternative 23 | |
|---|---|
| Error | 55.4 |
| Cost | 7876 |
| Alternative 24 | |
|---|---|
| Error | 57.0 |
| Cost | 6656 |
herbie shell --seed 2023057
(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))))