| Alternative 1 | |
|---|---|
| Error | 39.5% |
| Cost | 34780.00 |
(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 A (* C -4.0) (* B B)))
(t_1 (* (+ C (fma -0.5 (/ (* B B) A) C)) (* 2.0 (* F t_0))))
(t_2 (hypot B (- A C)))
(t_3 (- A (- t_2 C)))
(t_4 (* t_3 F))
(t_5 (fma B B (* A (* C -4.0)))))
(if (<= B -1.95e+98)
(/ (sqrt (* t_3 (* 2.0 F))) B)
(if (<= B -7.2e-143)
(/ (* (sqrt t_4) (- (sqrt (* 2.0 t_5)))) t_5)
(if (<= B -3.4e-286)
(/ (- (sqrt (* 2.0 (* -4.0 (* (* A C) (* F (+ C C))))))) t_5)
(if (<= B 7.5e-280)
(- (/ (sqrt (* t_0 (* (* 2.0 F) (* A 2.0)))) t_0))
(if (<= B 1.75e-195)
(/ (* (cbrt (sqrt t_1)) (- (cbrt t_1))) t_0)
(if (<= B 1.45e-114)
(/ (sqrt (* 2.0 (* F (* t_5 (- (+ A C) t_2))))) (- t_5))
(if (<= B 1.5e+141)
(/
(* (sqrt t_0) (- (sqrt (* (* 2.0 F) (- C (- t_2 A))))))
t_0)
(/ (- (sqrt (* 2.0 t_4))) 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(A, (C * -4.0), (B * B));
double t_1 = (C + fma(-0.5, ((B * B) / A), C)) * (2.0 * (F * t_0));
double t_2 = hypot(B, (A - C));
double t_3 = A - (t_2 - C);
double t_4 = t_3 * F;
double t_5 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (B <= -1.95e+98) {
tmp = sqrt((t_3 * (2.0 * F))) / B;
} else if (B <= -7.2e-143) {
tmp = (sqrt(t_4) * -sqrt((2.0 * t_5))) / t_5;
} else if (B <= -3.4e-286) {
tmp = -sqrt((2.0 * (-4.0 * ((A * C) * (F * (C + C)))))) / t_5;
} else if (B <= 7.5e-280) {
tmp = -(sqrt((t_0 * ((2.0 * F) * (A * 2.0)))) / t_0);
} else if (B <= 1.75e-195) {
tmp = (cbrt(sqrt(t_1)) * -cbrt(t_1)) / t_0;
} else if (B <= 1.45e-114) {
tmp = sqrt((2.0 * (F * (t_5 * ((A + C) - t_2))))) / -t_5;
} else if (B <= 1.5e+141) {
tmp = (sqrt(t_0) * -sqrt(((2.0 * F) * (C - (t_2 - A))))) / t_0;
} else {
tmp = -sqrt((2.0 * t_4)) / 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(A, Float64(C * -4.0), Float64(B * B)) t_1 = Float64(Float64(C + fma(-0.5, Float64(Float64(B * B) / A), C)) * Float64(2.0 * Float64(F * t_0))) t_2 = hypot(B, Float64(A - C)) t_3 = Float64(A - Float64(t_2 - C)) t_4 = Float64(t_3 * F) t_5 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B <= -1.95e+98) tmp = Float64(sqrt(Float64(t_3 * Float64(2.0 * F))) / B); elseif (B <= -7.2e-143) tmp = Float64(Float64(sqrt(t_4) * Float64(-sqrt(Float64(2.0 * t_5)))) / t_5); elseif (B <= -3.4e-286) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-4.0 * Float64(Float64(A * C) * Float64(F * Float64(C + C))))))) / t_5); elseif (B <= 7.5e-280) tmp = Float64(-Float64(sqrt(Float64(t_0 * Float64(Float64(2.0 * F) * Float64(A * 2.0)))) / t_0)); elseif (B <= 1.75e-195) tmp = Float64(Float64(cbrt(sqrt(t_1)) * Float64(-cbrt(t_1))) / t_0); elseif (B <= 1.45e-114) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(t_5 * Float64(Float64(A + C) - t_2))))) / Float64(-t_5)); elseif (B <= 1.5e+141) tmp = Float64(Float64(sqrt(t_0) * Float64(-sqrt(Float64(Float64(2.0 * F) * Float64(C - Float64(t_2 - A)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * t_4))) / 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] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision] + C), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$3 = N[(A - N[(t$95$2 - C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * F), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.95e+98], N[(N[Sqrt[N[(t$95$3 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision], If[LessEqual[B, -7.2e-143], N[(N[(N[Sqrt[t$95$4], $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[B, -3.4e-286], N[((-N[Sqrt[N[(2.0 * N[(-4.0 * N[(N[(A * C), $MachinePrecision] * N[(F * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$5), $MachinePrecision], If[LessEqual[B, 7.5e-280], (-N[(N[Sqrt[N[(t$95$0 * N[(N[(2.0 * F), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 1.75e-195], N[(N[(N[Power[N[Sqrt[t$95$1], $MachinePrecision], 1/3], $MachinePrecision] * (-N[Power[t$95$1, 1/3], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1.45e-114], N[(N[Sqrt[N[(2.0 * N[(F * N[(t$95$5 * N[(N[(A + C), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$5)), $MachinePrecision], If[LessEqual[B, 1.5e+141], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(C - N[(t$95$2 - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * t$95$4), $MachinePrecision]], $MachinePrecision]) / B), $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(A, C \cdot -4, B \cdot B\right)\\
t_1 := \left(C + \mathsf{fma}\left(-0.5, \frac{B \cdot B}{A}, C\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)\\
t_2 := \mathsf{hypot}\left(B, A - C\right)\\
t_3 := A - \left(t_2 - C\right)\\
t_4 := t_3 \cdot F\\
t_5 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B \leq -1.95 \cdot 10^{+98}:\\
\;\;\;\;\frac{\sqrt{t_3 \cdot \left(2 \cdot F\right)}}{B}\\
\mathbf{elif}\;B \leq -7.2 \cdot 10^{-143}:\\
\;\;\;\;\frac{\sqrt{t_4} \cdot \left(-\sqrt{2 \cdot t_5}\right)}{t_5}\\
\mathbf{elif}\;B \leq -3.4 \cdot 10^{-286}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-4 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(C + C\right)\right)\right)\right)}}{t_5}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{-280}:\\
\;\;\;\;-\frac{\sqrt{t_0 \cdot \left(\left(2 \cdot F\right) \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.75 \cdot 10^{-195}:\\
\;\;\;\;\frac{\sqrt[3]{\sqrt{t_1}} \cdot \left(-\sqrt[3]{t_1}\right)}{t_0}\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{-114}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(t_5 \cdot \left(\left(A + C\right) - t_2\right)\right)\right)}}{-t_5}\\
\mathbf{elif}\;B \leq 1.5 \cdot 10^{+141}:\\
\;\;\;\;\frac{\sqrt{t_0} \cdot \left(-\sqrt{\left(2 \cdot F\right) \cdot \left(C - \left(t_2 - A\right)\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot t_4}}{B}\\
\end{array}
if B < -1.95e98Initial program 5.1
Simplified6.1
[Start]5.1 | \[ \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-rr13.7
Simplified13.7
[Start]13.7 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
|---|---|
associate--l+ [=>]13.7 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
+-commutative [=>]13.7 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate--r- [<=]13.7 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
Applied egg-rr13.8
Simplified16.3
[Start]13.8 | \[ \frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
|---|---|
*-commutative [=>]13.8 | \[ \color{blue}{\frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}
\] |
*-inverses [=>]16.3 | \[ \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \color{blue}{1}
\] |
associate-/r/ [<=]16.3 | \[ \color{blue}{\frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{1}}}
\] |
/-rgt-identity [=>]16.3 | \[ \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\color{blue}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}
\] |
*-commutative [=>]16.3 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right) \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
associate-*l* [=>]16.3 | \[ \frac{-\sqrt{\color{blue}{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
Taylor expanded in B around -inf 54.0
Simplified54.0
[Start]54.0 | \[ \frac{-\sqrt{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{-1 \cdot B}
\] |
|---|---|
mul-1-neg [=>]54.0 | \[ \frac{-\sqrt{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}{\color{blue}{-B}}
\] |
Applied egg-rr54.1
Simplified54.0
[Start]54.1 | \[ 0 + \frac{\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)}}{B}
\] |
|---|---|
+-lft-identity [=>]54.1 | \[ \color{blue}{\frac{\sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)}}{B}}
\] |
associate--l+ [=>]54.0 | \[ \frac{\sqrt{\color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(2 \cdot F\right)}}{B}
\] |
if -1.95e98 < B < -7.1999999999999996e-143Initial program 30.9
Simplified38.4
[Start]30.9 | \[ \frac{-\sqrt{\left(2 \cdot \left(\left({B}^{2} - \left(4 \cdot A\right) \cdot C\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{{B}^{2} - \left(4 \cdot A\right) \cdot C}
\] |
|---|
Applied egg-rr39.2
Simplified39.2
[Start]39.2 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)} \cdot \sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
*-commutative [=>]39.2 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \sqrt{2 \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]39.2 | \[ \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, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
if -7.1999999999999996e-143 < B < -3.4000000000000001e-286Initial program 16.1
Simplified26.5
[Start]16.1 | \[ \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 19.5
Simplified23.8
[Start]19.5 | \[ \frac{-\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot \left(\left(C - -1 \cdot C\right) \cdot F\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
associate-*r* [=>]23.8 | \[ \frac{-\sqrt{2 \cdot \left(-4 \cdot \color{blue}{\left(\left(A \cdot C\right) \cdot \left(\left(C - -1 \cdot C\right) \cdot F\right)\right)}\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]23.8 | \[ \frac{-\sqrt{2 \cdot \left(-4 \cdot \left(\left(A \cdot C\right) \cdot \color{blue}{\left(F \cdot \left(C - -1 \cdot C\right)\right)}\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
mul-1-neg [=>]23.8 | \[ \frac{-\sqrt{2 \cdot \left(-4 \cdot \left(\left(A \cdot C\right) \cdot \left(F \cdot \left(C - \color{blue}{\left(-C\right)}\right)\right)\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
if -3.4000000000000001e-286 < B < 7.4999999999999999e-280Initial program 17.4
Simplified28.6
[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 A around -inf 24.4
if 7.4999999999999999e-280 < B < 1.75000000000000007e-195Initial program 19.1
Simplified26.2
[Start]19.1 | \[ \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 19.5
Simplified19.5
[Start]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\left(C + -0.5 \cdot \frac{\left({B}^{2} + {C}^{2}\right) - {\left(-1 \cdot C\right)}^{2}}{A}\right) - -1 \cdot C\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
|---|---|
+-commutative [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\color{blue}{\left(-0.5 \cdot \frac{\left({B}^{2} + {C}^{2}\right) - {\left(-1 \cdot C\right)}^{2}}{A} + C\right)} - -1 \cdot C\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate--l+ [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\color{blue}{\left(-0.5 \cdot \frac{\left({B}^{2} + {C}^{2}\right) - {\left(-1 \cdot C\right)}^{2}}{A} + \left(C - -1 \cdot C\right)\right)} \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate-*r/ [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\color{blue}{\frac{-0.5 \cdot \left(\left({B}^{2} + {C}^{2}\right) - {\left(-1 \cdot C\right)}^{2}\right)}{A}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate-/l* [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\color{blue}{\frac{-0.5}{\frac{A}{\left({B}^{2} + {C}^{2}\right) - {\left(-1 \cdot C\right)}^{2}}}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate--l+ [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\frac{-0.5}{\frac{A}{\color{blue}{{B}^{2} + \left({C}^{2} - {\left(-1 \cdot C\right)}^{2}\right)}}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
unpow2 [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\frac{-0.5}{\frac{A}{\color{blue}{B \cdot B} + \left({C}^{2} - {\left(-1 \cdot C\right)}^{2}\right)}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
unpow2 [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\frac{-0.5}{\frac{A}{B \cdot B + \left(\color{blue}{C \cdot C} - {\left(-1 \cdot C\right)}^{2}\right)}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
mul-1-neg [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\frac{-0.5}{\frac{A}{B \cdot B + \left(C \cdot C - {\color{blue}{\left(-C\right)}}^{2}\right)}} + \left(C - -1 \cdot C\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
mul-1-neg [=>]19.5 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right) \cdot \left(\left(\frac{-0.5}{\frac{A}{B \cdot B + \left(C \cdot C - {\left(-C\right)}^{2}\right)}} + \left(C - \color{blue}{\left(-C\right)}\right)\right) \cdot \left(2 \cdot F\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
Applied egg-rr21.5
Simplified21.5
[Start]21.5 | \[ \frac{-\sqrt[3]{\sqrt{\left(C + \left(C + -0.5 \cdot \frac{\mathsf{fma}\left(B, B, \left(-C\right) \cdot \left(C - C\right)\right)}{A}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\right)}} \cdot \sqrt[3]{\left(C + \left(C + -0.5 \cdot \frac{\mathsf{fma}\left(B, B, \left(-C\right) \cdot \left(C - C\right)\right)}{A}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
|---|---|
*-commutative [=>]21.5 | \[ \frac{-\color{blue}{\sqrt[3]{\left(C + \left(C + -0.5 \cdot \frac{\mathsf{fma}\left(B, B, \left(-C\right) \cdot \left(C - C\right)\right)}{A}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\right)} \cdot \sqrt[3]{\sqrt{\left(C + \left(C + -0.5 \cdot \frac{\mathsf{fma}\left(B, B, \left(-C\right) \cdot \left(C - C\right)\right)}{A}\right)\right) \cdot \left(\left(2 \cdot F\right) \cdot \mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)\right)}}}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
if 1.75000000000000007e-195 < B < 1.44999999999999998e-114Initial program 18.3
Simplified27.0
[Start]18.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-rr26.6
Simplified19.3
[Start]26.6 | \[ \sqrt{2 \cdot \left(\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot F\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
|---|---|
associate-*r/ [=>]26.9 | \[ \color{blue}{\frac{\sqrt{2 \cdot \left(\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot F\right)\right)} \cdot 1}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}}
\] |
*-rgt-identity [=>]26.9 | \[ \frac{\color{blue}{\sqrt{2 \cdot \left(\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right) \cdot F\right)\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-*r* [=>]21.0 | \[ \frac{\sqrt{2 \cdot \color{blue}{\left(\left(\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)\right) \cdot F\right)}}}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
associate-+r- [=>]19.3 | \[ \frac{\sqrt{2 \cdot \left(\left(\color{blue}{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]19.3 | \[ \frac{\sqrt{2 \cdot \left(\left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}
\] |
*-commutative [=>]19.3 | \[ \frac{\sqrt{2 \cdot \left(\left(\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right) \cdot F\right)}}{-\mathsf{fma}\left(B, B, A \cdot \color{blue}{\left(C \cdot -4\right)}\right)}
\] |
if 1.44999999999999998e-114 < B < 1.4999999999999999e141Initial program 30.0
Simplified37.6
[Start]30.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-rr42.3
Simplified43.0
[Start]42.3 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
|---|---|
associate--l+ [=>]42.9 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
+-commutative [=>]42.9 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate--r- [<=]43.0 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
if 1.4999999999999999e141 < B Initial program 1.5
Simplified1.8
[Start]1.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-rr4.2
Simplified4.2
[Start]4.2 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\left(\left(A + C\right) - \mathsf{hypot}\left(B, A - C\right)\right) \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
|---|---|
associate--l+ [=>]4.2 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
+-commutative [=>]4.2 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(\left(C - \mathsf{hypot}\left(B, A - C\right)\right) + A\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
associate--r- [<=]4.2 | \[ \frac{-\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)} \cdot \sqrt{\color{blue}{\left(C - \left(\mathsf{hypot}\left(B, A - C\right) - A\right)\right)} \cdot \left(2 \cdot F\right)}}{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}
\] |
Applied egg-rr4.2
Simplified7.2
[Start]4.2 | \[ \frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
|---|---|
*-commutative [=>]4.2 | \[ \color{blue}{\frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}
\] |
*-inverses [=>]7.2 | \[ \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}} \cdot \color{blue}{1}
\] |
associate-/r/ [<=]7.2 | \[ \color{blue}{\frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\frac{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}{1}}}
\] |
/-rgt-identity [=>]7.2 | \[ \frac{-\sqrt{\left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(2 \cdot F\right)}}{\color{blue}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}}
\] |
*-commutative [=>]7.2 | \[ \frac{-\sqrt{\color{blue}{\left(2 \cdot F\right) \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
associate-*l* [=>]7.2 | \[ \frac{-\sqrt{\color{blue}{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)}}}{\sqrt{\mathsf{fma}\left(A, C \cdot -4, B \cdot B\right)}}
\] |
Taylor expanded in A around 0 53.2
Final simplification39.6
| Alternative 1 | |
|---|---|
| Error | 39.5% |
| Cost | 34780.00 |
| Alternative 2 | |
|---|---|
| Error | 39.5% |
| Cost | 34120.00 |
| Alternative 3 | |
|---|---|
| Error | 39.2% |
| Cost | 28248.00 |
| Alternative 4 | |
|---|---|
| Error | 39.5% |
| Cost | 28248.00 |
| Alternative 5 | |
|---|---|
| Error | 39.1% |
| Cost | 27868.00 |
| Alternative 6 | |
|---|---|
| Error | 36.8% |
| Cost | 21776.00 |
| Alternative 7 | |
|---|---|
| Error | 36.9% |
| Cost | 21264.00 |
| Alternative 8 | |
|---|---|
| Error | 36.7% |
| Cost | 20804.00 |
| Alternative 9 | |
|---|---|
| Error | 36.7% |
| Cost | 20752.00 |
| Alternative 10 | |
|---|---|
| Error | 36.6% |
| Cost | 20752.00 |
| Alternative 11 | |
|---|---|
| Error | 36.7% |
| Cost | 14736.00 |
| Alternative 12 | |
|---|---|
| Error | 34.7% |
| Cost | 14348.00 |
| Alternative 13 | |
|---|---|
| Error | 36.2% |
| Cost | 14344.00 |
| Alternative 14 | |
|---|---|
| Error | 35.9% |
| Cost | 14344.00 |
| Alternative 15 | |
|---|---|
| Error | 35.0% |
| Cost | 14216.00 |
| Alternative 16 | |
|---|---|
| Error | 34.8% |
| Cost | 14024.00 |
| Alternative 17 | |
|---|---|
| Error | 25.0% |
| Cost | 13828.00 |
| Alternative 18 | |
|---|---|
| Error | 23.6% |
| Cost | 13700.00 |
| Alternative 19 | |
|---|---|
| Error | 22.1% |
| Cost | 8584.00 |
| Alternative 20 | |
|---|---|
| Error | 22.3% |
| Cost | 8584.00 |
| Alternative 21 | |
|---|---|
| Error | 19.6% |
| Cost | 8452.00 |
| Alternative 22 | |
|---|---|
| Error | 15.9% |
| Cost | 7940.00 |
| Alternative 23 | |
|---|---|
| Error | 4.7% |
| Cost | 6980.00 |
| Alternative 24 | |
|---|---|
| Error | 14.6% |
| Cost | 6976.00 |
| Alternative 25 | |
|---|---|
| Error | 3.8% |
| Cost | 6464.00 |
herbie shell --seed 2023093
(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))))