| Alternative 1 | |
|---|---|
| Accuracy | 43.5% |
| Cost | 34516 |
(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 (* A (* C -4.0)))
(t_1 (fma B B t_0))
(t_2 (fma B B (* C (* A -4.0))))
(t_3 (* 2.0 (* F t_2)))
(t_4 (hypot B (- A C))))
(if (<= B -1.1e-70)
(/ (sqrt (* (- A (hypot B A)) (* F 2.0))) B)
(if (<= B 2.3e-151)
(/ (- (sqrt (* t_3 (+ A A)))) t_2)
(if (<= B 2.6e-47)
(/
(* (sqrt (* F (* 2.0 (+ A (- C t_4))))) (- (hypot B (sqrt t_0))))
t_1)
(if (<= B 45000000000000.0)
(/
(-
(cbrt
(pow
(*
t_3
(+ A (fma -0.5 (/ (- (pow (hypot B A) 2.0) (* A A)) C) A)))
1.5)))
t_2)
(if (<= B 7e+148)
(/
(*
(sqrt (* F (+ C (- A t_4))))
(- (sqrt (fma C (* A -8.0) (* B (* B 2.0))))))
t_1)
(* (sqrt (* F (- C (hypot B C)))) (- (/ (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 = A * (C * -4.0);
double t_1 = fma(B, B, t_0);
double t_2 = fma(B, B, (C * (A * -4.0)));
double t_3 = 2.0 * (F * t_2);
double t_4 = hypot(B, (A - C));
double tmp;
if (B <= -1.1e-70) {
tmp = sqrt(((A - hypot(B, A)) * (F * 2.0))) / B;
} else if (B <= 2.3e-151) {
tmp = -sqrt((t_3 * (A + A))) / t_2;
} else if (B <= 2.6e-47) {
tmp = (sqrt((F * (2.0 * (A + (C - t_4))))) * -hypot(B, sqrt(t_0))) / t_1;
} else if (B <= 45000000000000.0) {
tmp = -cbrt(pow((t_3 * (A + fma(-0.5, ((pow(hypot(B, A), 2.0) - (A * A)) / C), A))), 1.5)) / t_2;
} else if (B <= 7e+148) {
tmp = (sqrt((F * (C + (A - t_4)))) * -sqrt(fma(C, (A * -8.0), (B * (B * 2.0))))) / t_1;
} else {
tmp = sqrt((F * (C - hypot(B, C)))) * -(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(A * Float64(C * -4.0)) t_1 = fma(B, B, t_0) t_2 = fma(B, B, Float64(C * Float64(A * -4.0))) t_3 = Float64(2.0 * Float64(F * t_2)) t_4 = hypot(B, Float64(A - C)) tmp = 0.0 if (B <= -1.1e-70) tmp = Float64(sqrt(Float64(Float64(A - hypot(B, A)) * Float64(F * 2.0))) / B); elseif (B <= 2.3e-151) tmp = Float64(Float64(-sqrt(Float64(t_3 * Float64(A + A)))) / t_2); elseif (B <= 2.6e-47) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * Float64(A + Float64(C - t_4))))) * Float64(-hypot(B, sqrt(t_0)))) / t_1); elseif (B <= 45000000000000.0) tmp = Float64(Float64(-cbrt((Float64(t_3 * Float64(A + fma(-0.5, Float64(Float64((hypot(B, A) ^ 2.0) - Float64(A * A)) / C), A))) ^ 1.5))) / t_2); elseif (B <= 7e+148) tmp = Float64(Float64(sqrt(Float64(F * Float64(C + Float64(A - t_4)))) * Float64(-sqrt(fma(C, Float64(A * -8.0), Float64(B * Float64(B * 2.0)))))) / t_1); else tmp = Float64(sqrt(Float64(F * Float64(C - hypot(B, C)))) * 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[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[B, -1.1e-70], N[(N[Sqrt[N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision], If[LessEqual[B, 2.3e-151], N[((-N[Sqrt[N[(t$95$3 * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 2.6e-47], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(A + N[(C - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[B ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 45000000000000.0], N[((-N[Power[N[Power[N[(t$95$3 * N[(A + N[(-0.5 * N[(N[(N[Power[N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision], 2.0], $MachinePrecision] - N[(A * A), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision] + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 1/3], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 7e+148], N[(N[(N[Sqrt[N[(F * N[(C + N[(A - t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C * N[(A * -8.0), $MachinePrecision] + N[(B * N[(B * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * N[(C - N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-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 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B, B, t_0\right)\\
t_2 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_3 := 2 \cdot \left(F \cdot t_2\right)\\
t_4 := \mathsf{hypot}\left(B, A - C\right)\\
\mathbf{if}\;B \leq -1.1 \cdot 10^{-70}:\\
\;\;\;\;\frac{\sqrt{\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(F \cdot 2\right)}}{B}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{-151}:\\
\;\;\;\;\frac{-\sqrt{t_3 \cdot \left(A + A\right)}}{t_2}\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \left(A + \left(C - t_4\right)\right)\right)} \cdot \left(-\mathsf{hypot}\left(B, \sqrt{t_0}\right)\right)}{t_1}\\
\mathbf{elif}\;B \leq 45000000000000:\\
\;\;\;\;\frac{-\sqrt[3]{{\left(t_3 \cdot \left(A + \mathsf{fma}\left(-0.5, \frac{{\left(\mathsf{hypot}\left(B, A\right)\right)}^{2} - A \cdot A}{C}, A\right)\right)\right)}^{1.5}}}{t_2}\\
\mathbf{elif}\;B \leq 7 \cdot 10^{+148}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(C + \left(A - t_4\right)\right)} \cdot \left(-\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C - \mathsf{hypot}\left(B, C\right)\right)} \cdot \left(-\frac{\sqrt{2}}{B}\right)\\
\end{array}
if B < -1.0999999999999999e-70Initial program 17.4%
Simplified16.3%
[Start]17.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}
\] |
|---|
Taylor expanded in C around 0 0.9%
Simplified2.0%
[Start]0.9 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}\right)
\] |
|---|---|
mul-1-neg [=>]0.9 | \[ \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}}
\] |
distribute-rgt-neg-in [=>]0.9 | \[ \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(A - \sqrt{{B}^{2} + {A}^{2}}\right) \cdot F}\right)}
\] |
*-commutative [=>]0.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{F \cdot \left(A - \sqrt{{B}^{2} + {A}^{2}}\right)}}\right)
\] |
unpow2 [=>]0.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{\color{blue}{B \cdot B} + {A}^{2}}\right)}\right)
\] |
unpow2 [=>]0.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \sqrt{B \cdot B + \color{blue}{A \cdot A}}\right)}\right)
\] |
hypot-def [=>]2.0 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)}\right)
\] |
Applied egg-rr21.2%
[Start]2.0 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)
\] |
|---|---|
add-cbrt-cube [=>]2.4 | \[ \color{blue}{\sqrt[3]{\left(\left(\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\right) \cdot \left(\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\right)\right) \cdot \left(\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\right)}}
\] |
pow3 [=>]2.4 | \[ \sqrt[3]{\color{blue}{{\left(\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\right)\right)}^{3}}}
\] |
Applied egg-rr45.1%
[Start]21.2 | \[ \sqrt[3]{{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)}^{3}}
\] |
|---|---|
add-log-exp [=>]4.0 | \[ \color{blue}{\log \left(e^{\sqrt[3]{{\left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)}^{3}}}\right)}
\] |
rem-cbrt-cube [=>]4.0 | \[ \log \left(e^{\color{blue}{\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}}\right)
\] |
*-un-lft-identity [=>]4.0 | \[ \log \color{blue}{\left(1 \cdot e^{\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}\right)}
\] |
log-prod [=>]4.0 | \[ \color{blue}{\log 1 + \log \left(e^{\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}\right)}
\] |
metadata-eval [=>]4.0 | \[ \color{blue}{0} + \log \left(e^{\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}\right)
\] |
add-log-exp [<=]45.0 | \[ 0 + \color{blue}{\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}
\] |
associate-*l/ [=>]45.0 | \[ 0 + \color{blue}{\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}}{B}}
\] |
sqrt-unprod [=>]45.1 | \[ 0 + \frac{\color{blue}{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}}}{B}
\] |
hypot-udef [=>]21.4 | \[ 0 + \frac{\sqrt{2 \cdot \left(F \cdot \left(A - \color{blue}{\sqrt{A \cdot A + B \cdot B}}\right)\right)}}{B}
\] |
+-commutative [=>]21.4 | \[ 0 + \frac{\sqrt{2 \cdot \left(F \cdot \left(A - \sqrt{\color{blue}{B \cdot B + A \cdot A}}\right)\right)}}{B}
\] |
hypot-def [=>]45.1 | \[ 0 + \frac{\sqrt{2 \cdot \left(F \cdot \left(A - \color{blue}{\mathsf{hypot}\left(B, A\right)}\right)\right)}}{B}
\] |
Simplified45.1%
[Start]45.1 | \[ 0 + \frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)}}{B}
\] |
|---|---|
+-lft-identity [=>]45.1 | \[ \color{blue}{\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right)}}{B}}
\] |
*-commutative [=>]45.1 | \[ \frac{\sqrt{\color{blue}{\left(F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\right) \cdot 2}}}{B}
\] |
*-commutative [=>]45.1 | \[ \frac{\sqrt{\color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot F\right)} \cdot 2}}{B}
\] |
associate-*l* [=>]45.1 | \[ \frac{\sqrt{\color{blue}{\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(F \cdot 2\right)}}}{B}
\] |
if -1.0999999999999999e-70 < B < 2.29999999999999996e-151Initial program 17.3%
Simplified29.0%
[Start]17.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Taylor expanded in C around inf 44.6%
if 2.29999999999999996e-151 < B < 2.6e-47Initial program 25.3%
Simplified31.0%
[Start]25.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-rr29.9%
[Start]31.0 | \[ \frac{-\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
sqrt-prod [=>]30.5 | \[ \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{\left(2 \cdot F\right) \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
fma-udef [=>]30.5 | \[ \frac{-\sqrt{\color{blue}{B \cdot B + A \cdot \left(-4 \cdot C\right)}} \cdot \sqrt{\left(2 \cdot F\right) \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
add-sqr-sqrt [=>]27.5 | \[ \frac{-\sqrt{B \cdot B + \color{blue}{\sqrt{A \cdot \left(-4 \cdot C\right)} \cdot \sqrt{A \cdot \left(-4 \cdot C\right)}}} \cdot \sqrt{\left(2 \cdot F\right) \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
hypot-def [=>]27.5 | \[ \frac{-\color{blue}{\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right)} \cdot \sqrt{\left(2 \cdot F\right) \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]27.5 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right) \cdot \sqrt{\color{blue}{\left(F \cdot 2\right)} \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-*l* [=>]27.5 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right) \cdot \sqrt{\color{blue}{F \cdot \left(2 \cdot \left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate--r- [=>]29.9 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right) \cdot \sqrt{F \cdot \left(2 \cdot \color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
+-commutative [=>]29.9 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right) \cdot \sqrt{F \cdot \left(2 \cdot \color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
Simplified29.9%
[Start]29.9 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \left(-4 \cdot C\right)}\right) \cdot \sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]29.9 | \[ \frac{-\mathsf{hypot}\left(B, \sqrt{A \cdot \color{blue}{\left(C \cdot -4\right)}}\right) \cdot \sqrt{F \cdot \left(2 \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
if 2.6e-47 < B < 4.5e13Initial program 33.7%
Simplified44.1%
[Start]33.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 C around inf 33.3%
Simplified33.3%
[Start]33.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left({B}^{2} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
unpow2 [=>]33.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(\color{blue}{B \cdot B} + {A}^{2}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]33.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + \color{blue}{A \cdot A}\right) - {\left(-1 \cdot A\right)}^{2}}{C}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
mul-1-neg [=>]33.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\color{blue}{\left(-A\right)}}^{2}}{C}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
Applied egg-rr26.1%
[Start]33.3 | \[ \frac{-\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
add-cbrt-cube [=>]26.1 | \[ \frac{-\color{blue}{\sqrt[3]{\left(\sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right)} \cdot \sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right)}\right) \cdot \sqrt{\left(2 \cdot \left(\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right) \cdot F\right)\right) \cdot \left(A + \left(A + -0.5 \cdot \frac{\left(B \cdot B + A \cdot A\right) - {\left(-A\right)}^{2}}{C}\right)\right)}}}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
if 4.5e13 < B < 6.9999999999999998e148Initial program 27.6%
Simplified22.3%
[Start]27.6 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Applied egg-rr49.4%
[Start]22.3 | \[ \frac{-\sqrt{F \cdot \left(\left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
associate-*r* [=>]35.0 | \[ \frac{-\sqrt{\color{blue}{\left(F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)\right) \cdot \mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
sqrt-prod [=>]50.0 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate--r- [=>]49.4 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(\left(A - \mathsf{hypot}\left(B, A - C\right)\right) + C\right)}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
+-commutative [=>]49.4 | \[ \frac{-\sqrt{F \cdot \color{blue}{\left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, 2 \cdot \left(B \cdot B\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]49.4 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, \color{blue}{\left(B \cdot B\right) \cdot 2}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
associate-*l* [=>]49.4 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, \color{blue}{B \cdot \left(B \cdot 2\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
Simplified49.4%
[Start]49.4 | \[ \frac{-\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
|---|---|
unpow1/2 [<=]49.4 | \[ \frac{-\color{blue}{{\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}} \cdot \sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]49.4 | \[ \frac{-\color{blue}{\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(B \cdot 2\right)\right)} \cdot {\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
*-commutative [=>]49.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \color{blue}{\left(2 \cdot B\right)}\right)} \cdot {\left(F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}^{0.5}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
unpow1/2 [=>]49.4 | \[ \frac{-\sqrt{\mathsf{fma}\left(C, A \cdot -8, B \cdot \left(2 \cdot B\right)\right)} \cdot \color{blue}{\sqrt{F \cdot \left(C + \left(A - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}
\] |
if 6.9999999999999998e148 < B Initial program 0.6%
Simplified0.7%
[Start]0.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 0 1.2%
Simplified46.9%
[Start]1.2 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{\left(C - \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}\right)
\] |
|---|---|
mul-1-neg [=>]1.2 | \[ \color{blue}{-\frac{\sqrt{2}}{B} \cdot \sqrt{\left(C - \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}}
\] |
distribute-rgt-neg-in [=>]1.2 | \[ \color{blue}{\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\left(C - \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F}\right)}
\] |
*-commutative [=>]1.2 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{\color{blue}{F \cdot \left(C - \sqrt{{B}^{2} + {C}^{2}}\right)}}\right)
\] |
unpow2 [=>]1.2 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C - \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)}\right)
\] |
unpow2 [=>]1.2 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C - \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)}\right)
\] |
hypot-def [=>]46.9 | \[ \frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(C - \color{blue}{\mathsf{hypot}\left(B, C\right)}\right)}\right)
\] |
Final simplification43.5%
| Alternative 1 | |
|---|---|
| Accuracy | 43.5% |
| Cost | 34516 |
| Alternative 2 | |
|---|---|
| Accuracy | 44.0% |
| Cost | 34188 |
| Alternative 3 | |
|---|---|
| Accuracy | 45.0% |
| Cost | 27980 |
| Alternative 4 | |
|---|---|
| Accuracy | 45.0% |
| Cost | 27852 |
| Alternative 5 | |
|---|---|
| Accuracy | 43.8% |
| Cost | 21000 |
| Alternative 6 | |
|---|---|
| Accuracy | 40.4% |
| Cost | 20232 |
| Alternative 7 | |
|---|---|
| Accuracy | 40.5% |
| Cost | 20168 |
| Alternative 8 | |
|---|---|
| Accuracy | 38.1% |
| Cost | 14344 |
| Alternative 9 | |
|---|---|
| Accuracy | 35.0% |
| Cost | 14216 |
| Alternative 10 | |
|---|---|
| Accuracy | 24.7% |
| Cost | 13704 |
| Alternative 11 | |
|---|---|
| Accuracy | 33.7% |
| Cost | 13704 |
| Alternative 12 | |
|---|---|
| Accuracy | 24.5% |
| Cost | 13640 |
| Alternative 13 | |
|---|---|
| Accuracy | 8.1% |
| Cost | 8716 |
| Alternative 14 | |
|---|---|
| Accuracy | 18.2% |
| Cost | 8712 |
| Alternative 15 | |
|---|---|
| Accuracy | 17.0% |
| Cost | 8584 |
| Alternative 16 | |
|---|---|
| Accuracy | 17.7% |
| Cost | 8584 |
| Alternative 17 | |
|---|---|
| Accuracy | 8.9% |
| Cost | 7300 |
| Alternative 18 | |
|---|---|
| Accuracy | 8.7% |
| Cost | 7236 |
| Alternative 19 | |
|---|---|
| Accuracy | 8.5% |
| Cost | 6980 |
| Alternative 20 | |
|---|---|
| Accuracy | 5.3% |
| Cost | 6848 |
| Alternative 21 | |
|---|---|
| Accuracy | 3.8% |
| Cost | 6464 |
herbie shell --seed 2023143
(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))))