| Alternative 1 | |
|---|---|
| Accuracy | 36.7% |
| Cost | 21000 |
(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 (* C (* A -4.0))))
(t_1 (sqrt (* F (- C (- (hypot B (- A C)) A))))))
(if (<= B -1.65e-24)
(* t_1 (/ (sqrt 2.0) B))
(if (<= B -3.8e-112)
(/
(sqrt (* 2.0 (* (fma -0.5 (/ (* B B) (- A C)) (* C 2.0)) (* F t_0))))
(- t_0))
(if (<= B 2.45e-123)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* A 2.0)))))) t_0)
(* t_1 (/ (- (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, (C * (A * -4.0)));
double t_1 = sqrt((F * (C - (hypot(B, (A - C)) - A))));
double tmp;
if (B <= -1.65e-24) {
tmp = t_1 * (sqrt(2.0) / B);
} else if (B <= -3.8e-112) {
tmp = sqrt((2.0 * (fma(-0.5, ((B * B) / (A - C)), (C * 2.0)) * (F * t_0)))) / -t_0;
} else if (B <= 2.45e-123) {
tmp = -sqrt((2.0 * (t_0 * (F * (A * 2.0))))) / t_0;
} else {
tmp = t_1 * (-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(C * Float64(A * -4.0))) t_1 = sqrt(Float64(F * Float64(C - Float64(hypot(B, Float64(A - C)) - A)))) tmp = 0.0 if (B <= -1.65e-24) tmp = Float64(t_1 * Float64(sqrt(2.0) / B)); elseif (B <= -3.8e-112) tmp = Float64(sqrt(Float64(2.0 * Float64(fma(-0.5, Float64(Float64(B * B) / Float64(A - C)), Float64(C * 2.0)) * Float64(F * t_0)))) / Float64(-t_0)); elseif (B <= 2.45e-123) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A * 2.0)))))) / t_0); else tmp = Float64(t_1 * 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[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(F * N[(C - N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.65e-24], N[(t$95$1 * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -3.8e-112], N[(N[Sqrt[N[(2.0 * N[(N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(A - C), $MachinePrecision]), $MachinePrecision] + N[(C * 2.0), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B, 2.45e-123], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(t$95$1 * 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, C \cdot \left(A \cdot -4\right)\right)\\
t_1 := \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}\\
\mathbf{if}\;B \leq -1.65 \cdot 10^{-24}:\\
\;\;\;\;t_1 \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq -3.8 \cdot 10^{-112}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, C \cdot 2\right) \cdot \left(F \cdot t_0\right)\right)}}{-t_0}\\
\mathbf{elif}\;B \leq 2.45 \cdot 10^{-123}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A \cdot 2\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
if B < -1.64999999999999992e-24Initial program 17.0%
Simplified20.4%
[Start]17.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-rr27.4%
[Start]20.4 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]20.4 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right) \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
sqrt-prod [=>]27.5 | \[ \frac{-\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+r- [=>]27.4 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]27.4 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\color{blue}{\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)}
\] |
Simplified27.5%
[Start]27.4 | \[ \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 [=>]27.4 | \[ \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 [<=]27.4 | \[ \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- [<=]27.5 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr27.5%
[Start]27.5 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
div-inv [=>]27.5 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}
\] |
distribute-rgt-neg-in [=>]27.5 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*l* [=>]27.5 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)}
\] |
+-commutative [=>]27.5 | \[ \sqrt{F \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)
\] |
associate-+l- [=>]27.5 | \[ \sqrt{F \cdot \color{blue}{\left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)
\] |
Simplified27.5%
[Start]27.5 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)
\] |
|---|---|
distribute-lft-neg-out [=>]27.5 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)}
\] |
associate-*r/ [=>]27.5 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot 1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}\right)
\] |
*-rgt-identity [=>]27.5 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)
\] |
distribute-frac-neg [<=]27.5 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}
\] |
*-commutative [=>]27.5 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right) \cdot -4}\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}
\] |
associate-*l* [=>]27.5 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{A \cdot \left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}
\] |
*-commutative [=>]27.5 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\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, \color{blue}{\left(A \cdot C\right) \cdot -4}\right)}
\] |
associate-*l* [=>]27.5 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\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, \color{blue}{A \cdot \left(C \cdot -4\right)}\right)}
\] |
Taylor expanded in B around -inf 48.3%
if -1.64999999999999992e-24 < B < -3.79999999999999995e-112Initial program 29.0%
Simplified38.3%
[Start]29.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 24.3%
Simplified24.3%
[Start]24.3 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(-0.5 \cdot \frac{{B}^{2}}{A - C} + 2 \cdot C\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
fma-def [=>]24.3 | \[ \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(-0.5, \frac{{B}^{2}}{A - C}, 2 \cdot C\right)}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]24.3 | \[ \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(-0.5, \frac{\color{blue}{B \cdot B}}{A - C}, 2 \cdot C\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr24.2%
[Start]24.3 | \[ \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(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
frac-2neg [=>]24.3 | \[ \color{blue}{\frac{-\left(-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right)\right)\right)}\right)}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}
\] |
remove-double-neg [=>]24.3 | \[ \frac{\color{blue}{\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right)\right)\right)}}}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
div-inv [=>]24.3 | \[ \color{blue}{\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right)\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}
\] |
associate-*r* [=>]24.2 | \[ \sqrt{2 \cdot \color{blue}{\left(\left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right) \cdot \mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right)\right)}} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [=>]24.2 | \[ \sqrt{2 \cdot \color{blue}{\left(\mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)}} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-/l* [=>]24.2 | \[ \sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \color{blue}{\frac{B}{\frac{A - C}{B}}}, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-/r/ [=>]24.2 | \[ \sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \color{blue}{\frac{B}{A - C} \cdot B}, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Simplified24.3%
[Start]24.2 | \[ \sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B}{A - C} \cdot B, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
associate-*r/ [=>]24.3 | \[ \color{blue}{\frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B}{A - C} \cdot B, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)} \cdot 1}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}
\] |
*-rgt-identity [=>]24.3 | \[ \frac{\color{blue}{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B}{A - C} \cdot B, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)}}}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*l/ [=>]24.3 | \[ \frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \color{blue}{\frac{B \cdot B}{A - C}}, 2 \cdot C\right) \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
*-commutative [=>]24.3 | \[ \frac{\sqrt{2 \cdot \left(\mathsf{fma}\left(-0.5, \frac{B \cdot B}{A - C}, 2 \cdot C\right) \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right)}\right)}}{-\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
if -3.79999999999999995e-112 < B < 2.4499999999999999e-123Initial program 17.9%
Simplified26.1%
[Start]17.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}
\] |
|---|
Taylor expanded in A around -inf 23.1%
if 2.4499999999999999e-123 < B Initial program 17.6%
Simplified22.6%
[Start]17.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-rr26.5%
[Start]22.6 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]22.6 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\right) \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
sqrt-prod [=>]26.8 | \[ \frac{-\color{blue}{\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-+r- [=>]26.5 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
+-commutative [=>]26.5 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(\color{blue}{\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)}
\] |
Simplified26.8%
[Start]26.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 [=>]26.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 [<=]26.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- [<=]26.8 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr26.8%
[Start]26.8 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
div-inv [=>]26.8 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}}
\] |
distribute-rgt-neg-in [=>]26.8 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-*l* [=>]26.8 | \[ \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, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)}
\] |
+-commutative [=>]26.8 | \[ \sqrt{F \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)
\] |
associate-+l- [=>]26.8 | \[ \sqrt{F \cdot \color{blue}{\left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}} \cdot \left(\left(-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)
\] |
Simplified26.8%
[Start]26.8 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right) \cdot \frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)
\] |
|---|---|
distribute-lft-neg-out [=>]26.8 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot \frac{1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)}
\] |
associate-*r/ [=>]26.8 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot 1}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}\right)
\] |
*-rgt-identity [=>]26.8 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}\right)
\] |
distribute-frac-neg [<=]26.8 | \[ \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(B, B, -4 \cdot \left(A \cdot C\right)\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}}
\] |
*-commutative [=>]26.8 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{\left(A \cdot C\right) \cdot -4}\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}
\] |
associate-*l* [=>]26.8 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, \color{blue}{A \cdot \left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}
\] |
*-commutative [=>]26.8 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\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, \color{blue}{\left(A \cdot C\right) \cdot -4}\right)}
\] |
associate-*l* [=>]26.8 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\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, \color{blue}{A \cdot \left(C \cdot -4\right)}\right)}
\] |
Taylor expanded in B around inf 42.7%
Simplified42.7%
[Start]42.7 | \[ \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)
\] |
|---|---|
associate-*r/ [=>]42.7 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \color{blue}{\frac{-1 \cdot \sqrt{2}}{B}}
\] |
mul-1-neg [=>]42.7 | \[ \sqrt{F \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \frac{\color{blue}{-\sqrt{2}}}{B}
\] |
Final simplification36.8%
| Alternative 1 | |
|---|---|
| Accuracy | 36.7% |
| Cost | 21000 |
| Alternative 2 | |
|---|---|
| Accuracy | 35.6% |
| Cost | 20424 |
| Alternative 3 | |
|---|---|
| Accuracy | 33.7% |
| Cost | 20228 |
| Alternative 4 | |
|---|---|
| Accuracy | 25.4% |
| Cost | 15180 |
| Alternative 5 | |
|---|---|
| Accuracy | 19.1% |
| Cost | 15000 |
| Alternative 6 | |
|---|---|
| Accuracy | 23.2% |
| Cost | 14472 |
| Alternative 7 | |
|---|---|
| Accuracy | 21.1% |
| Cost | 13704 |
| Alternative 8 | |
|---|---|
| Accuracy | 12.4% |
| Cost | 8584 |
| Alternative 9 | |
|---|---|
| Accuracy | 11.7% |
| Cost | 8580 |
| Alternative 10 | |
|---|---|
| Accuracy | 7.8% |
| Cost | 8452 |
| Alternative 11 | |
|---|---|
| Accuracy | 12.3% |
| Cost | 8452 |
| Alternative 12 | |
|---|---|
| Accuracy | 5.2% |
| Cost | 7940 |
| Alternative 13 | |
|---|---|
| Accuracy | 3.8% |
| Cost | 64 |
herbie shell --seed 2023137
(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))))