| Alternative 1 | |
|---|---|
| Error | 55.53% |
| Cost | 40652 |
(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 (* (* B B) -0.5))
(t_1 (* (* C A) -4.0))
(t_2 (fma B B t_1))
(t_3 (fma B B (* C (* A -4.0))))
(t_4 (fma -4.0 (* C A) (* B B)))
(t_5 (+ (* B B) t_1))
(t_6 (hypot B (- A C)))
(t_7 (+ A (+ C t_6)))
(t_8 (sqrt (* 2.0 (* F t_2)))))
(if (<= B -3.75e+124)
(/ (sqrt (* F (+ C (hypot B C)))) (/ B (sqrt 2.0)))
(if (<= B 1.45e-159)
(/ (* (sqrt t_7) (- t_8)) t_5)
(if (<= B 3.45e-118)
(/
(* (sqrt (* 2.0 (fma 2.0 A (/ t_0 C)))) (* (sqrt t_4) (- (sqrt F))))
t_4)
(if (<= B 5e-99)
(/ (* (sqrt (* F (+ C (+ A t_6)))) (- (sqrt (* 2.0 t_3)))) t_3)
(if (<= B 1.4e-79)
(-
(/
(sqrt (* 2.0 (* t_3 (* F (fma 2.0 A (* -0.5 (/ B (/ C B))))))))
t_3))
(if (<= B 5.8e-78)
(/ (* t_8 (- (sqrt (* 2.0 A)))) t_5)
(if (<= B 2.8e+32)
(* (sqrt (* 2.0 (* (* F t_7) t_2))) (/ -1.0 t_2))
(if (<= B 1.95e+99)
(/
(- (sqrt (* 2.0 (* t_3 (* F (fma 2.0 C (/ t_0 A)))))))
t_3)
(if (<= B 1.45e+199)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(*
(sqrt (* F (+ C (fma 0.5 (/ (* C C) B) B))))
(/ (- (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 = (B * B) * -0.5;
double t_1 = (C * A) * -4.0;
double t_2 = fma(B, B, t_1);
double t_3 = fma(B, B, (C * (A * -4.0)));
double t_4 = fma(-4.0, (C * A), (B * B));
double t_5 = (B * B) + t_1;
double t_6 = hypot(B, (A - C));
double t_7 = A + (C + t_6);
double t_8 = sqrt((2.0 * (F * t_2)));
double tmp;
if (B <= -3.75e+124) {
tmp = sqrt((F * (C + hypot(B, C)))) / (B / sqrt(2.0));
} else if (B <= 1.45e-159) {
tmp = (sqrt(t_7) * -t_8) / t_5;
} else if (B <= 3.45e-118) {
tmp = (sqrt((2.0 * fma(2.0, A, (t_0 / C)))) * (sqrt(t_4) * -sqrt(F))) / t_4;
} else if (B <= 5e-99) {
tmp = (sqrt((F * (C + (A + t_6)))) * -sqrt((2.0 * t_3))) / t_3;
} else if (B <= 1.4e-79) {
tmp = -(sqrt((2.0 * (t_3 * (F * fma(2.0, A, (-0.5 * (B / (C / B)))))))) / t_3);
} else if (B <= 5.8e-78) {
tmp = (t_8 * -sqrt((2.0 * A))) / t_5;
} else if (B <= 2.8e+32) {
tmp = sqrt((2.0 * ((F * t_7) * t_2))) * (-1.0 / t_2);
} else if (B <= 1.95e+99) {
tmp = -sqrt((2.0 * (t_3 * (F * fma(2.0, C, (t_0 / A)))))) / t_3;
} else if (B <= 1.45e+199) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else {
tmp = sqrt((F * (C + fma(0.5, ((C * C) / B), B)))) * (-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(Float64(B * B) * -0.5) t_1 = Float64(Float64(C * A) * -4.0) t_2 = fma(B, B, t_1) t_3 = fma(B, B, Float64(C * Float64(A * -4.0))) t_4 = fma(-4.0, Float64(C * A), Float64(B * B)) t_5 = Float64(Float64(B * B) + t_1) t_6 = hypot(B, Float64(A - C)) t_7 = Float64(A + Float64(C + t_6)) t_8 = sqrt(Float64(2.0 * Float64(F * t_2))) tmp = 0.0 if (B <= -3.75e+124) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) / Float64(B / sqrt(2.0))); elseif (B <= 1.45e-159) tmp = Float64(Float64(sqrt(t_7) * Float64(-t_8)) / t_5); elseif (B <= 3.45e-118) tmp = Float64(Float64(sqrt(Float64(2.0 * fma(2.0, A, Float64(t_0 / C)))) * Float64(sqrt(t_4) * Float64(-sqrt(F)))) / t_4); elseif (B <= 5e-99) tmp = Float64(Float64(sqrt(Float64(F * Float64(C + Float64(A + t_6)))) * Float64(-sqrt(Float64(2.0 * t_3)))) / t_3); elseif (B <= 1.4e-79) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_3 * Float64(F * fma(2.0, A, Float64(-0.5 * Float64(B / Float64(C / B)))))))) / t_3)); elseif (B <= 5.8e-78) tmp = Float64(Float64(t_8 * Float64(-sqrt(Float64(2.0 * A)))) / t_5); elseif (B <= 2.8e+32) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(F * t_7) * t_2))) * Float64(-1.0 / t_2)); elseif (B <= 1.95e+99) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_3 * Float64(F * fma(2.0, C, Float64(t_0 / A))))))) / t_3); elseif (B <= 1.45e+199) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); else tmp = Float64(sqrt(Float64(F * Float64(C + fma(0.5, Float64(Float64(C * C) / B), B)))) * 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[(N[(B * B), $MachinePrecision] * -0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[(C * A), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$2 = N[(B * B + t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(-4.0 * N[(C * A), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(B * B), $MachinePrecision] + t$95$1), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, Block[{t$95$7 = N[(A + N[(C + t$95$6), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[Sqrt[N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -3.75e+124], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(B / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.45e-159], N[(N[(N[Sqrt[t$95$7], $MachinePrecision] * (-t$95$8)), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[B, 3.45e-118], N[(N[(N[Sqrt[N[(2.0 * N[(2.0 * A + N[(t$95$0 / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[t$95$4], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$4), $MachinePrecision], If[LessEqual[B, 5e-99], N[(N[(N[Sqrt[N[(F * N[(C + N[(A + t$95$6), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$3), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[B, 1.4e-79], (-N[(N[Sqrt[N[(2.0 * N[(t$95$3 * N[(F * N[(2.0 * A + N[(-0.5 * N[(B / N[(C / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision]), If[LessEqual[B, 5.8e-78], N[(N[(t$95$8 * (-N[Sqrt[N[(2.0 * A), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[B, 2.8e+32], N[(N[Sqrt[N[(2.0 * N[(N[(F * t$95$7), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.95e+99], N[((-N[Sqrt[N[(2.0 * N[(t$95$3 * N[(F * N[(2.0 * C + N[(t$95$0 / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], If[LessEqual[B, 1.45e+199], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(F * N[(C + N[(0.5 * N[(N[(C * C), $MachinePrecision] / B), $MachinePrecision] + B), $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 := \left(B \cdot B\right) \cdot -0.5\\
t_1 := \left(C \cdot A\right) \cdot -4\\
t_2 := \mathsf{fma}\left(B, B, t_1\right)\\
t_3 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_4 := \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\\
t_5 := B \cdot B + t_1\\
t_6 := \mathsf{hypot}\left(B, A - C\right)\\
t_7 := A + \left(C + t_6\right)\\
t_8 := \sqrt{2 \cdot \left(F \cdot t_2\right)}\\
\mathbf{if}\;B \leq -3.75 \cdot 10^{+124}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{\frac{B}{\sqrt{2}}}\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{-159}:\\
\;\;\;\;\frac{\sqrt{t_7} \cdot \left(-t_8\right)}{t_5}\\
\mathbf{elif}\;B \leq 3.45 \cdot 10^{-118}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \mathsf{fma}\left(2, A, \frac{t_0}{C}\right)} \cdot \left(\sqrt{t_4} \cdot \left(-\sqrt{F}\right)\right)}{t_4}\\
\mathbf{elif}\;B \leq 5 \cdot 10^{-99}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(C + \left(A + t_6\right)\right)} \cdot \left(-\sqrt{2 \cdot t_3}\right)}{t_3}\\
\mathbf{elif}\;B \leq 1.4 \cdot 10^{-79}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_3 \cdot \left(F \cdot \mathsf{fma}\left(2, A, -0.5 \cdot \frac{B}{\frac{C}{B}}\right)\right)\right)}}{t_3}\\
\mathbf{elif}\;B \leq 5.8 \cdot 10^{-78}:\\
\;\;\;\;\frac{t_8 \cdot \left(-\sqrt{2 \cdot A}\right)}{t_5}\\
\mathbf{elif}\;B \leq 2.8 \cdot 10^{+32}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(F \cdot t_7\right) \cdot t_2\right)} \cdot \frac{-1}{t_2}\\
\mathbf{elif}\;B \leq 1.95 \cdot 10^{+99}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_3 \cdot \left(F \cdot \mathsf{fma}\left(2, C, \frac{t_0}{A}\right)\right)\right)}}{t_3}\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{+199}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{C \cdot C}{B}, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
if B < -3.75000000000000019e124Initial program 97
Simplified97
[Start]97 | \[ \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 99.73
Simplified99.73
[Start]99.73 | \[ \frac{-\sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]99.73 | \[ \frac{-\sqrt{\color{blue}{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]99.73 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]99.73 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]99.73 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{B \cdot B + C \cdot C}\right)} \cdot \color{blue}{\left(B \cdot \sqrt{2}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Applied egg-rr89.21
Taylor expanded in B around inf 48.79
if -3.75000000000000019e124 < B < 1.44999999999999995e-159Initial program 76.46
Simplified76.47
[Start]76.46 | \[ \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-rr60.57
Simplified60.57
[Start]60.57 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]60.57 | \[ \frac{-\color{blue}{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]60.57 | \[ \frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
if 1.44999999999999995e-159 < B < 3.4500000000000001e-118Initial program 81.57
Simplified70.62
[Start]81.57 | \[ \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-rr62.87
Simplified61.21
[Start]62.87 | \[ \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 [<=]62.87 | \[ \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 [=>]62.87 | \[ \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 [=>]62.87 | \[ \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 [=>]62.87 | \[ \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+ [<=]61.21 | \[ \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-rr68.73
Taylor expanded in C around -inf 76.82
Simplified76.82
[Start]76.82 | \[ \frac{-\left(\sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \left(2 \cdot A + -0.5 \cdot \frac{{B}^{2}}{C}\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
|---|---|
fma-def [=>]76.82 | \[ \frac{-\left(\sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \color{blue}{\mathsf{fma}\left(2, A, -0.5 \cdot \frac{{B}^{2}}{C}\right)}}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
associate-*r/ [=>]76.82 | \[ \frac{-\left(\sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(2, A, \color{blue}{\frac{-0.5 \cdot {B}^{2}}{C}}\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
unpow2 [=>]76.82 | \[ \frac{-\left(\sqrt{\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)} \cdot \sqrt{F}\right) \cdot \sqrt{2 \cdot \mathsf{fma}\left(2, A, \frac{-0.5 \cdot \color{blue}{\left(B \cdot B\right)}}{C}\right)}}{\mathsf{fma}\left(-4, A \cdot C, B \cdot B\right)}
\] |
if 3.4500000000000001e-118 < B < 4.99999999999999969e-99Initial program 76.88
Simplified73.47
[Start]76.88 | \[ \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-rr74.69
Simplified74.69
[Start]74.69 | \[ \frac{-\sqrt{2 \cdot \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \sqrt{F \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
*-commutative [=>]74.69 | \[ \frac{-\color{blue}{\sqrt{F \cdot \left(C + \left(A + \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)}
\] |
if 4.99999999999999969e-99 < B < 1.40000000000000006e-79Initial program 75.66
Simplified65.66
[Start]75.66 | \[ \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 78.96
Simplified78.96
[Start]78.96 | \[ \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 A + -0.5 \cdot \frac{{B}^{2}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
|---|---|
fma-def [=>]78.96 | \[ \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, A, -0.5 \cdot \frac{{B}^{2}}{C}\right)}\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
unpow2 [=>]78.96 | \[ \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, A, -0.5 \cdot \frac{\color{blue}{B \cdot B}}{C}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
associate-/l* [=>]78.96 | \[ \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, A, -0.5 \cdot \color{blue}{\frac{B}{\frac{C}{B}}}\right)\right)\right)}}{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}
\] |
if 1.40000000000000006e-79 < B < 5.8000000000000001e-78Initial program 54.32
Simplified54.32
[Start]54.32 | \[ \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-rr54.99
Simplified54.99
[Start]54.99 | \[ \frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]54.99 | \[ \frac{-\color{blue}{\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right) \cdot F\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]54.99 | \[ \frac{-\sqrt{A + \left(C + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{2 \cdot \color{blue}{\left(F \cdot \mathsf{fma}\left(B, B, \left(A \cdot C\right) \cdot -4\right)\right)}}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Taylor expanded in A around inf 98.17
if 5.8000000000000001e-78 < B < 2.8e32Initial program 62.75
Simplified56.29
[Start]62.75 | \[ \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.42
Simplified48.53
[Start]49.42 | \[ \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 [<=]49.42 | \[ \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 [=>]49.42 | \[ \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 [=>]49.42 | \[ \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 [=>]49.42 | \[ \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.53 | \[ \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-rr54.69
Applied egg-rr56.26
Simplified56.77
[Start]56.26 | \[ \sqrt{\left(2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right) \cdot \left(F \cdot \mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)\right)} \cdot \frac{1}{-\mathsf{fma}\left(-4, C \cdot A, B \cdot B\right)}
\] |
|---|
if 2.8e32 < B < 1.94999999999999997e99Initial program 68.79
Simplified61.46
[Start]68.79 | \[ \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 89.02
Simplified89.02
[Start]89.02 | \[ \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 [=>]89.02 | \[ \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/ [=>]89.02 | \[ \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 [=>]89.02 | \[ \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)}
\] |
if 1.94999999999999997e99 < B < 1.4499999999999999e199Initial program 90.12
Simplified90.12
[Start]90.12 | \[ \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 79.08
Simplified79.08
[Start]79.08 | \[ \frac{-\sqrt{\left(C + \sqrt{{B}^{2} + {C}^{2}}\right) \cdot F} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
|---|---|
*-commutative [=>]79.08 | \[ \frac{-\sqrt{\color{blue}{F \cdot \left(C + \sqrt{{B}^{2} + {C}^{2}}\right)}} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]79.08 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{\color{blue}{B \cdot B} + {C}^{2}}\right)} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
unpow2 [=>]79.08 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{B \cdot B + \color{blue}{C \cdot C}}\right)} \cdot \left(\sqrt{2} \cdot B\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
*-commutative [=>]79.08 | \[ \frac{-\sqrt{F \cdot \left(C + \sqrt{B \cdot B + C \cdot C}\right)} \cdot \color{blue}{\left(B \cdot \sqrt{2}\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\] |
Taylor expanded in C around 0 53.77
Simplified53.77
[Start]53.77 | \[ -1 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{B}}\right)
\] |
|---|---|
mul-1-neg [=>]53.77 | \[ \color{blue}{-\sqrt{2} \cdot \sqrt{\frac{F}{B}}}
\] |
distribute-rgt-neg-in [=>]53.77 | \[ \color{blue}{\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)}
\] |
if 1.4499999999999999e199 < B Initial program 100
Simplified100
[Start]100 | \[ \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 inf 100
Taylor expanded in A around 0 61.25
Simplified61.25
[Start]61.25 | \[ -1 \cdot \left(\frac{\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)}\right)
\] |
|---|---|
associate-*r* [=>]61.25 | \[ \color{blue}{\left(-1 \cdot \frac{\sqrt{2}}{B}\right) \cdot \sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)}}
\] |
*-commutative [=>]61.25 | \[ \color{blue}{\sqrt{F \cdot \left(C + \left(0.5 \cdot \frac{{C}^{2}}{B} + B\right)\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)}
\] |
fma-def [=>]61.25 | \[ \sqrt{F \cdot \left(C + \color{blue}{\mathsf{fma}\left(0.5, \frac{{C}^{2}}{B}, B\right)}\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)
\] |
unpow2 [=>]61.25 | \[ \sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{\color{blue}{C \cdot C}}{B}, B\right)\right)} \cdot \left(-1 \cdot \frac{\sqrt{2}}{B}\right)
\] |
associate-*r/ [=>]61.25 | \[ \sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{C \cdot C}{B}, B\right)\right)} \cdot \color{blue}{\frac{-1 \cdot \sqrt{2}}{B}}
\] |
mul-1-neg [=>]61.25 | \[ \sqrt{F \cdot \left(C + \mathsf{fma}\left(0.5, \frac{C \cdot C}{B}, B\right)\right)} \cdot \frac{\color{blue}{-\sqrt{2}}}{B}
\] |
Final simplification60.59
| Alternative 1 | |
|---|---|
| Error | 55.53% |
| Cost | 40652 |
| Alternative 2 | |
|---|---|
| Error | 61.39% |
| Cost | 28312 |
| Alternative 3 | |
|---|---|
| Error | 62.03% |
| Cost | 28248 |
| Alternative 4 | |
|---|---|
| Error | 61.76% |
| Cost | 28248 |
| Alternative 5 | |
|---|---|
| Error | 56.9% |
| Cost | 28112 |
| Alternative 6 | |
|---|---|
| Error | 62.18% |
| Cost | 27864 |
| Alternative 7 | |
|---|---|
| Error | 62.14% |
| Cost | 27864 |
| Alternative 8 | |
|---|---|
| Error | 62.08% |
| Cost | 21396 |
| Alternative 9 | |
|---|---|
| Error | 61.83% |
| Cost | 19972 |
| Alternative 10 | |
|---|---|
| Error | 68.6% |
| Cost | 15044 |
| Alternative 11 | |
|---|---|
| Error | 74.18% |
| Cost | 14216 |
| Alternative 12 | |
|---|---|
| Error | 78.29% |
| Cost | 13448 |
| Alternative 13 | |
|---|---|
| Error | 83.16% |
| Cost | 8844 |
| Alternative 14 | |
|---|---|
| Error | 82.72% |
| Cost | 8716 |
| Alternative 15 | |
|---|---|
| Error | 87.22% |
| Cost | 8452 |
| Alternative 16 | |
|---|---|
| Error | 84.67% |
| Cost | 8452 |
| Alternative 17 | |
|---|---|
| Error | 89.23% |
| Cost | 8196 |
| Alternative 18 | |
|---|---|
| Error | 88.45% |
| Cost | 8196 |
| Alternative 19 | |
|---|---|
| Error | 96.59% |
| Cost | 7808 |
| Alternative 20 | |
|---|---|
| Error | 91.06% |
| Cost | 7808 |
| Alternative 21 | |
|---|---|
| Error | 97.55% |
| Cost | 6656 |
herbie shell --seed 2023121
(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))))