
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * 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]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 30 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * 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]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (+ C (+ A (hypot B (- A C))))))
(t_1 (- t_0))
(t_2 (- (* B B) (* 4.0 (* A C))))
(t_3 (/ (sqrt 2.0) B))
(t_4 (+ C (hypot C B)))
(t_5 (* -0.5 (/ (* B B) A)))
(t_6 (fma B B (* C (* A -4.0))))
(t_7 (fma B B (* -4.0 (* A C))))
(t_8 (sqrt (* 2.0 (* F t_7)))))
(if (<= B -1.35e+154)
(* t_3 (sqrt (* F t_4)))
(if (<= B -1.15e-7)
(/ (* (sqrt 2.0) (* (sqrt F) (- B))) (/ t_7 t_1))
(if (<= B 2.7e-70)
(/ (* t_8 (- (sqrt (+ C (+ C t_5))))) t_2)
(if (<= B 380000.0)
(* t_0 (/ (- (sqrt (* 2.0 (* F t_6)))) t_6))
(if (<= B 1.55e+56)
(/ (- (sqrt (* (* 2.0 (* F t_2)) (fma 2.0 C t_5)))) t_2)
(if (<= B 7e+106)
(/ (* t_8 t_1) t_2)
(* t_3 (* (sqrt F) (- (sqrt t_4))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C + (A + hypot(B, (A - C)))));
double t_1 = -t_0;
double t_2 = (B * B) - (4.0 * (A * C));
double t_3 = sqrt(2.0) / B;
double t_4 = C + hypot(C, B);
double t_5 = -0.5 * ((B * B) / A);
double t_6 = fma(B, B, (C * (A * -4.0)));
double t_7 = fma(B, B, (-4.0 * (A * C)));
double t_8 = sqrt((2.0 * (F * t_7)));
double tmp;
if (B <= -1.35e+154) {
tmp = t_3 * sqrt((F * t_4));
} else if (B <= -1.15e-7) {
tmp = (sqrt(2.0) * (sqrt(F) * -B)) / (t_7 / t_1);
} else if (B <= 2.7e-70) {
tmp = (t_8 * -sqrt((C + (C + t_5)))) / t_2;
} else if (B <= 380000.0) {
tmp = t_0 * (-sqrt((2.0 * (F * t_6))) / t_6);
} else if (B <= 1.55e+56) {
tmp = -sqrt(((2.0 * (F * t_2)) * fma(2.0, C, t_5))) / t_2;
} else if (B <= 7e+106) {
tmp = (t_8 * t_1) / t_2;
} else {
tmp = t_3 * (sqrt(F) * -sqrt(t_4));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) t_1 = Float64(-t_0) t_2 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_3 = Float64(sqrt(2.0) / B) t_4 = Float64(C + hypot(C, B)) t_5 = Float64(-0.5 * Float64(Float64(B * B) / A)) t_6 = fma(B, B, Float64(C * Float64(A * -4.0))) t_7 = fma(B, B, Float64(-4.0 * Float64(A * C))) t_8 = sqrt(Float64(2.0 * Float64(F * t_7))) tmp = 0.0 if (B <= -1.35e+154) tmp = Float64(t_3 * sqrt(Float64(F * t_4))); elseif (B <= -1.15e-7) tmp = Float64(Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-B))) / Float64(t_7 / t_1)); elseif (B <= 2.7e-70) tmp = Float64(Float64(t_8 * Float64(-sqrt(Float64(C + Float64(C + t_5))))) / t_2); elseif (B <= 380000.0) tmp = Float64(t_0 * Float64(Float64(-sqrt(Float64(2.0 * Float64(F * t_6)))) / t_6)); elseif (B <= 1.55e+56) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_2)) * fma(2.0, C, t_5)))) / t_2); elseif (B <= 7e+106) tmp = Float64(Float64(t_8 * t_1) / t_2); else tmp = Float64(t_3 * Float64(sqrt(F) * Float64(-sqrt(t_4)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = (-t$95$0)}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$4 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$8 = N[Sqrt[N[(2.0 * N[(F * t$95$7), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.35e+154], N[(t$95$3 * N[Sqrt[N[(F * t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.15e-7], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-B)), $MachinePrecision]), $MachinePrecision] / N[(t$95$7 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.7e-70], N[(N[(t$95$8 * (-N[Sqrt[N[(C + N[(C + t$95$5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 380000.0], N[(t$95$0 * N[((-N[Sqrt[N[(2.0 * N[(F * t$95$6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$6), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.55e+56], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + t$95$5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 7e+106], N[(N[(t$95$8 * t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision], N[(t$95$3 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$4], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\\
t_1 := -t_0\\
t_2 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{\sqrt{2}}{B}\\
t_4 := C + \mathsf{hypot}\left(C, B\right)\\
t_5 := -0.5 \cdot \frac{B \cdot B}{A}\\
t_6 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
t_7 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
t_8 := \sqrt{2 \cdot \left(F \cdot t_7\right)}\\
\mathbf{if}\;B \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3 \cdot \sqrt{F \cdot t_4}\\
\mathbf{elif}\;B \leq -1.15 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-B\right)\right)}{\frac{t_7}{t_1}}\\
\mathbf{elif}\;B \leq 2.7 \cdot 10^{-70}:\\
\;\;\;\;\frac{t_8 \cdot \left(-\sqrt{C + \left(C + t_5\right)}\right)}{t_2}\\
\mathbf{elif}\;B \leq 380000:\\
\;\;\;\;t_0 \cdot \frac{-\sqrt{2 \cdot \left(F \cdot t_6\right)}}{t_6}\\
\mathbf{elif}\;B \leq 1.55 \cdot 10^{+56}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_2\right)\right) \cdot \mathsf{fma}\left(2, C, t_5\right)}}{t_2}\\
\mathbf{elif}\;B \leq 7 \cdot 10^{+106}:\\
\;\;\;\;\frac{t_8 \cdot t_1}{t_2}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_4}\right)\right)\\
\end{array}
\end{array}
if B < -1.35000000000000003e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
cancel-sign-sub-inv0.0%
fma-def0.0%
metadata-eval0.0%
*-commutative0.0%
+-commutative0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.5%
Taylor expanded in A around 0 2.4%
*-commutative2.4%
*-commutative2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-def43.9%
Simplified43.9%
if -1.35000000000000003e154 < B < -1.14999999999999997e-7Initial program 40.8%
associate-*l*40.8%
unpow240.8%
+-commutative40.8%
unpow240.8%
associate-*l*40.8%
unpow240.8%
Simplified40.8%
sqrt-prod45.8%
*-commutative45.8%
cancel-sign-sub-inv45.8%
fma-def45.8%
metadata-eval45.8%
*-commutative45.8%
+-commutative45.8%
unpow245.8%
hypot-udef53.4%
associate-+r+53.4%
Applied egg-rr53.4%
sqrt-prod53.5%
Applied egg-rr53.5%
associate-*r*53.5%
Simplified53.5%
div-inv53.4%
distribute-rgt-neg-in53.4%
sqrt-unprod53.3%
associate-*l*53.3%
cancel-sign-sub-inv53.3%
metadata-eval53.3%
*-commutative53.3%
associate-*l*53.3%
fma-udef53.3%
associate-*l*53.3%
Applied egg-rr53.3%
associate-*r/53.4%
*-rgt-identity53.4%
associate-/l*53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
Simplified53.4%
Taylor expanded in B around -inf 63.5%
mul-1-neg63.5%
associate-*r*63.4%
Simplified63.4%
if -1.14999999999999997e-7 < B < 2.7000000000000001e-70Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod28.4%
*-commutative28.4%
cancel-sign-sub-inv28.4%
fma-def28.4%
metadata-eval28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
hypot-udef40.2%
associate-+r+41.2%
Applied egg-rr41.2%
Taylor expanded in A around -inf 30.1%
unpow230.1%
Simplified30.1%
if 2.7000000000000001e-70 < B < 3.8e5Initial program 62.5%
associate-*l*62.5%
unpow262.5%
+-commutative62.5%
unpow262.5%
associate-*l*62.5%
unpow262.5%
Simplified62.5%
sqrt-prod62.4%
*-commutative62.4%
cancel-sign-sub-inv62.4%
fma-def62.4%
metadata-eval62.4%
*-commutative62.4%
+-commutative62.4%
unpow262.4%
hypot-udef71.6%
associate-+r+73.0%
Applied egg-rr73.0%
sqrt-prod72.6%
Applied egg-rr72.6%
associate-*r*72.6%
Simplified72.6%
div-inv72.4%
distribute-rgt-neg-in72.4%
sqrt-unprod72.8%
associate-*l*72.8%
cancel-sign-sub-inv72.8%
metadata-eval72.8%
*-commutative72.8%
associate-*l*72.8%
fma-udef72.8%
associate-*l*72.8%
Applied egg-rr72.8%
associate-*r/73.0%
*-rgt-identity73.0%
associate-/l*72.9%
*-commutative72.9%
*-commutative72.9%
*-commutative72.9%
*-commutative72.9%
*-commutative72.9%
*-commutative72.9%
Simplified72.9%
associate-/r/73.1%
*-commutative73.1%
associate-*l*73.1%
associate-*l*73.1%
Applied egg-rr73.1%
if 3.8e5 < B < 1.55000000000000002e56Initial program 11.9%
associate-*l*11.9%
unpow211.9%
+-commutative11.9%
unpow211.9%
associate-*l*11.9%
unpow211.9%
Simplified11.9%
Taylor expanded in A around -inf 33.0%
fma-def33.0%
unpow233.0%
Simplified33.0%
if 1.55000000000000002e56 < B < 6.99999999999999962e106Initial program 46.7%
associate-*l*46.7%
unpow246.7%
+-commutative46.7%
unpow246.7%
associate-*l*46.7%
unpow246.7%
Simplified46.7%
sqrt-prod55.6%
*-commutative55.6%
cancel-sign-sub-inv55.6%
fma-def55.6%
metadata-eval55.6%
*-commutative55.6%
+-commutative55.6%
unpow255.6%
hypot-udef73.4%
associate-+r+74.6%
Applied egg-rr74.6%
if 6.99999999999999962e106 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
sqrt-prod18.0%
hypot-udef77.1%
Applied egg-rr77.1%
hypot-def18.0%
unpow218.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
unpow218.0%
hypot-def77.1%
Simplified77.1%
Final simplification48.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* -4.0 (* A C))))
(t_1 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_2
(/
(-
(sqrt
(*
(* 2.0 (* t_1 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_1))
(t_3 (- (* B B) (* 4.0 (* A C)))))
(if (<= t_2 -2e-216)
(/
(*
(sqrt (+ C (+ A (hypot B (- A C)))))
(* (sqrt 2.0) (* (sqrt t_0) (- (sqrt F)))))
t_3)
(if (<= t_2 INFINITY)
(/
(*
(sqrt (* 2.0 (* F t_0)))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_3)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt (+ C (hypot C B))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (-4.0 * (A * C)));
double t_1 = pow(B, 2.0) - ((4.0 * A) * C);
double t_2 = -sqrt(((2.0 * (t_1 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_1;
double t_3 = (B * B) - (4.0 * (A * C));
double tmp;
if (t_2 <= -2e-216) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(2.0) * (sqrt(t_0) * -sqrt(F)))) / t_3;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_3;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt((C + hypot(C, B))));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(-4.0 * Float64(A * C))) t_1 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_1) t_3 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (t_2 <= -2e-216) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(sqrt(2.0) * Float64(sqrt(t_0) * Float64(-sqrt(F))))) / t_3); elseif (t_2 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_3); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(Float64(C + hypot(C, B)))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -2e-216], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[t$95$0], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$2, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
t_1 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_3 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-216}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(\sqrt{2} \cdot \left(\sqrt{t_0} \cdot \left(-\sqrt{F}\right)\right)\right)}{t_3}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_3}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(C, B\right)}\right)\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -2.0000000000000001e-216Initial program 51.8%
associate-*l*51.8%
unpow251.8%
+-commutative51.8%
unpow251.8%
associate-*l*51.8%
unpow251.8%
Simplified51.8%
sqrt-prod57.5%
*-commutative57.5%
cancel-sign-sub-inv57.5%
fma-def57.5%
metadata-eval57.5%
*-commutative57.5%
+-commutative57.5%
unpow257.5%
hypot-udef70.9%
associate-+r+72.2%
Applied egg-rr72.2%
sqrt-prod72.0%
Applied egg-rr72.0%
associate-*r*72.0%
Simplified72.0%
sqrt-prod79.7%
associate-*l*79.7%
Applied egg-rr79.7%
*-commutative79.7%
*-commutative79.7%
*-commutative79.7%
Simplified79.7%
if -2.0000000000000001e-216 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 24.8%
associate-*l*24.8%
unpow224.8%
+-commutative24.8%
unpow224.8%
associate-*l*24.8%
unpow224.8%
Simplified24.8%
sqrt-prod27.6%
*-commutative27.6%
cancel-sign-sub-inv27.6%
fma-def27.6%
metadata-eval27.6%
*-commutative27.6%
+-commutative27.6%
unpow227.6%
hypot-udef43.8%
associate-+r+44.8%
Applied egg-rr44.8%
Taylor expanded in A around -inf 41.5%
unpow241.5%
Simplified41.5%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified1.0%
Taylor expanded in A around 0 1.6%
mul-1-neg1.6%
*-commutative1.6%
unpow21.6%
unpow21.6%
Simplified1.6%
sqrt-prod1.6%
hypot-udef25.1%
Applied egg-rr25.1%
hypot-def1.6%
unpow21.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
unpow21.6%
hypot-def25.1%
Simplified25.1%
Final simplification50.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt (+ C (+ A (hypot B (- A C)))))))
(t_1 (* -0.5 (/ (* B B) A)))
(t_2 (- (* B B) (* 4.0 (* A C))))
(t_3 (/ (sqrt 2.0) B))
(t_4 (+ C (hypot C B)))
(t_5 (fma B B (* -4.0 (* A C))))
(t_6 (sqrt (* 2.0 (* F t_5))))
(t_7 (/ (* t_6 t_0) t_2)))
(if (<= B -1.35e+154)
(* t_3 (sqrt (* F t_4)))
(if (<= B -1.85e-7)
(/ (* (sqrt 2.0) (* (sqrt F) (- B))) (/ t_5 t_0))
(if (<= B 7.4e-69)
(/ (* t_6 (- (sqrt (+ C (+ C t_1))))) t_2)
(if (<= B 235000.0)
t_7
(if (<= B 2.15e+55)
(/ (- (sqrt (* (* 2.0 (* F t_2)) (fma 2.0 C t_1)))) t_2)
(if (<= B 4.5e+105)
t_7
(* t_3 (* (sqrt F) (- (sqrt t_4))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt((C + (A + hypot(B, (A - C)))));
double t_1 = -0.5 * ((B * B) / A);
double t_2 = (B * B) - (4.0 * (A * C));
double t_3 = sqrt(2.0) / B;
double t_4 = C + hypot(C, B);
double t_5 = fma(B, B, (-4.0 * (A * C)));
double t_6 = sqrt((2.0 * (F * t_5)));
double t_7 = (t_6 * t_0) / t_2;
double tmp;
if (B <= -1.35e+154) {
tmp = t_3 * sqrt((F * t_4));
} else if (B <= -1.85e-7) {
tmp = (sqrt(2.0) * (sqrt(F) * -B)) / (t_5 / t_0);
} else if (B <= 7.4e-69) {
tmp = (t_6 * -sqrt((C + (C + t_1)))) / t_2;
} else if (B <= 235000.0) {
tmp = t_7;
} else if (B <= 2.15e+55) {
tmp = -sqrt(((2.0 * (F * t_2)) * fma(2.0, C, t_1))) / t_2;
} else if (B <= 4.5e+105) {
tmp = t_7;
} else {
tmp = t_3 * (sqrt(F) * -sqrt(t_4));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C)))))) t_1 = Float64(-0.5 * Float64(Float64(B * B) / A)) t_2 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_3 = Float64(sqrt(2.0) / B) t_4 = Float64(C + hypot(C, B)) t_5 = fma(B, B, Float64(-4.0 * Float64(A * C))) t_6 = sqrt(Float64(2.0 * Float64(F * t_5))) t_7 = Float64(Float64(t_6 * t_0) / t_2) tmp = 0.0 if (B <= -1.35e+154) tmp = Float64(t_3 * sqrt(Float64(F * t_4))); elseif (B <= -1.85e-7) tmp = Float64(Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-B))) / Float64(t_5 / t_0)); elseif (B <= 7.4e-69) tmp = Float64(Float64(t_6 * Float64(-sqrt(Float64(C + Float64(C + t_1))))) / t_2); elseif (B <= 235000.0) tmp = t_7; elseif (B <= 2.15e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_2)) * fma(2.0, C, t_1)))) / t_2); elseif (B <= 4.5e+105) tmp = t_7; else tmp = Float64(t_3 * Float64(sqrt(F) * Float64(-sqrt(t_4)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])}, Block[{t$95$1 = N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$4 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[Sqrt[N[(2.0 * N[(F * t$95$5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[(N[(t$95$6 * t$95$0), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[LessEqual[B, -1.35e+154], N[(t$95$3 * N[Sqrt[N[(F * t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.85e-7], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-B)), $MachinePrecision]), $MachinePrecision] / N[(t$95$5 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 7.4e-69], N[(N[(t$95$6 * (-N[Sqrt[N[(C + N[(C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 235000.0], t$95$7, If[LessEqual[B, 2.15e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 4.5e+105], t$95$7, N[(t$95$3 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$4], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\\
t_1 := -0.5 \cdot \frac{B \cdot B}{A}\\
t_2 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{\sqrt{2}}{B}\\
t_4 := C + \mathsf{hypot}\left(C, B\right)\\
t_5 := \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\\
t_6 := \sqrt{2 \cdot \left(F \cdot t_5\right)}\\
t_7 := \frac{t_6 \cdot t_0}{t_2}\\
\mathbf{if}\;B \leq -1.35 \cdot 10^{+154}:\\
\;\;\;\;t_3 \cdot \sqrt{F \cdot t_4}\\
\mathbf{elif}\;B \leq -1.85 \cdot 10^{-7}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-B\right)\right)}{\frac{t_5}{t_0}}\\
\mathbf{elif}\;B \leq 7.4 \cdot 10^{-69}:\\
\;\;\;\;\frac{t_6 \cdot \left(-\sqrt{C + \left(C + t_1\right)}\right)}{t_2}\\
\mathbf{elif}\;B \leq 235000:\\
\;\;\;\;t_7\\
\mathbf{elif}\;B \leq 2.15 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_2\right)\right) \cdot \mathsf{fma}\left(2, C, t_1\right)}}{t_2}\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{+105}:\\
\;\;\;\;t_7\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_4}\right)\right)\\
\end{array}
\end{array}
if B < -1.35000000000000003e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
sqrt-prod0.0%
*-commutative0.0%
cancel-sign-sub-inv0.0%
fma-def0.0%
metadata-eval0.0%
*-commutative0.0%
+-commutative0.0%
unpow20.0%
hypot-udef0.0%
associate-+r+0.0%
Applied egg-rr0.0%
Taylor expanded in B around -inf 1.5%
Taylor expanded in A around 0 2.4%
*-commutative2.4%
*-commutative2.4%
+-commutative2.4%
unpow22.4%
unpow22.4%
hypot-def43.9%
Simplified43.9%
if -1.35000000000000003e154 < B < -1.85000000000000002e-7Initial program 40.8%
associate-*l*40.8%
unpow240.8%
+-commutative40.8%
unpow240.8%
associate-*l*40.8%
unpow240.8%
Simplified40.8%
sqrt-prod45.8%
*-commutative45.8%
cancel-sign-sub-inv45.8%
fma-def45.8%
metadata-eval45.8%
*-commutative45.8%
+-commutative45.8%
unpow245.8%
hypot-udef53.4%
associate-+r+53.4%
Applied egg-rr53.4%
sqrt-prod53.5%
Applied egg-rr53.5%
associate-*r*53.5%
Simplified53.5%
div-inv53.4%
distribute-rgt-neg-in53.4%
sqrt-unprod53.3%
associate-*l*53.3%
cancel-sign-sub-inv53.3%
metadata-eval53.3%
*-commutative53.3%
associate-*l*53.3%
fma-udef53.3%
associate-*l*53.3%
Applied egg-rr53.3%
associate-*r/53.4%
*-rgt-identity53.4%
associate-/l*53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
*-commutative53.4%
Simplified53.4%
Taylor expanded in B around -inf 63.5%
mul-1-neg63.5%
associate-*r*63.4%
Simplified63.4%
if -1.85000000000000002e-7 < B < 7.4000000000000005e-69Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod28.4%
*-commutative28.4%
cancel-sign-sub-inv28.4%
fma-def28.4%
metadata-eval28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
hypot-udef40.2%
associate-+r+41.2%
Applied egg-rr41.2%
Taylor expanded in A around -inf 30.1%
unpow230.1%
Simplified30.1%
if 7.4000000000000005e-69 < B < 235000 or 2.1499999999999999e55 < B < 4.5000000000000001e105Initial program 57.1%
associate-*l*57.1%
unpow257.1%
+-commutative57.1%
unpow257.1%
associate-*l*57.1%
unpow257.1%
Simplified57.1%
sqrt-prod60.0%
*-commutative60.0%
cancel-sign-sub-inv60.0%
fma-def60.0%
metadata-eval60.0%
*-commutative60.0%
+-commutative60.0%
unpow260.0%
hypot-udef72.2%
associate-+r+73.5%
Applied egg-rr73.5%
if 235000 < B < 2.1499999999999999e55Initial program 11.9%
associate-*l*11.9%
unpow211.9%
+-commutative11.9%
unpow211.9%
associate-*l*11.9%
unpow211.9%
Simplified11.9%
Taylor expanded in A around -inf 33.0%
fma-def33.0%
unpow233.0%
Simplified33.0%
if 4.5000000000000001e105 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
sqrt-prod18.0%
hypot-udef77.1%
Applied egg-rr77.1%
hypot-def18.0%
unpow218.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
unpow218.0%
hypot-def77.1%
Simplified77.1%
Final simplification48.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma C (* A -4.0) (* B B)))
(t_1 (/ (sqrt 2.0) B))
(t_2 (+ C (hypot C B)))
(t_3 (- (* B B) (* 4.0 (* A C))))
(t_4
(/
(*
(sqrt (* 2.0 (* F (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ C (+ A (hypot B (- A C)))))))
t_3)))
(if (<= B -1.45e+84)
(* t_1 (sqrt (* F t_2)))
(if (<= B -4.6e-143)
t_4
(if (<= B 6e-230)
(/ (* (sqrt (* t_0 (* F (+ C C)))) (- (sqrt 2.0))) t_0)
(if (<= B 330000.0)
t_4
(if (<= B 4.5e+55)
(/
(-
(sqrt (* (* 2.0 (* F t_3)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_3)
(if (<= B 6.5e+105)
t_4
(* t_1 (* (sqrt F) (- (sqrt t_2))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(C, (A * -4.0), (B * B));
double t_1 = sqrt(2.0) / B;
double t_2 = C + hypot(C, B);
double t_3 = (B * B) - (4.0 * (A * C));
double t_4 = (sqrt((2.0 * (F * fma(B, B, (-4.0 * (A * C)))))) * -sqrt((C + (A + hypot(B, (A - C)))))) / t_3;
double tmp;
if (B <= -1.45e+84) {
tmp = t_1 * sqrt((F * t_2));
} else if (B <= -4.6e-143) {
tmp = t_4;
} else if (B <= 6e-230) {
tmp = (sqrt((t_0 * (F * (C + C)))) * -sqrt(2.0)) / t_0;
} else if (B <= 330000.0) {
tmp = t_4;
} else if (B <= 4.5e+55) {
tmp = -sqrt(((2.0 * (F * t_3)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_3;
} else if (B <= 6.5e+105) {
tmp = t_4;
} else {
tmp = t_1 * (sqrt(F) * -sqrt(t_2));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(C, Float64(A * -4.0), Float64(B * B)) t_1 = Float64(sqrt(2.0) / B) t_2 = Float64(C + hypot(C, B)) t_3 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_4 = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_3) tmp = 0.0 if (B <= -1.45e+84) tmp = Float64(t_1 * sqrt(Float64(F * t_2))); elseif (B <= -4.6e-143) tmp = t_4; elseif (B <= 6e-230) tmp = Float64(Float64(sqrt(Float64(t_0 * Float64(F * Float64(C + C)))) * Float64(-sqrt(2.0))) / t_0); elseif (B <= 330000.0) tmp = t_4; elseif (B <= 4.5e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_3)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_3); elseif (B <= 6.5e+105) tmp = t_4; else tmp = Float64(t_1 * Float64(sqrt(F) * Float64(-sqrt(t_2)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$2 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$3), $MachinePrecision]}, If[LessEqual[B, -1.45e+84], N[(t$95$1 * N[Sqrt[N[(F * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -4.6e-143], t$95$4, If[LessEqual[B, 6e-230], N[(N[(N[Sqrt[N[(t$95$0 * N[(F * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 330000.0], t$95$4, If[LessEqual[B, 4.5e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $MachinePrecision], If[LessEqual[B, 6.5e+105], t$95$4, N[(t$95$1 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$2], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_1 := \frac{\sqrt{2}}{B}\\
t_2 := C + \mathsf{hypot}\left(C, B\right)\\
t_3 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_4 := \frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_3}\\
\mathbf{if}\;B \leq -1.45 \cdot 10^{+84}:\\
\;\;\;\;t_1 \cdot \sqrt{F \cdot t_2}\\
\mathbf{elif}\;B \leq -4.6 \cdot 10^{-143}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-230}:\\
\;\;\;\;\frac{\sqrt{t_0 \cdot \left(F \cdot \left(C + C\right)\right)} \cdot \left(-\sqrt{2}\right)}{t_0}\\
\mathbf{elif}\;B \leq 330000:\\
\;\;\;\;t_4\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_3\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_3}\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{+105}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_2}\right)\right)\\
\end{array}
\end{array}
if B < -1.44999999999999994e84Initial program 10.8%
associate-*l*10.8%
unpow210.8%
+-commutative10.8%
unpow210.8%
associate-*l*10.8%
unpow210.8%
Simplified10.8%
sqrt-prod13.2%
*-commutative13.2%
cancel-sign-sub-inv13.2%
fma-def13.2%
metadata-eval13.2%
*-commutative13.2%
+-commutative13.2%
unpow213.2%
hypot-udef13.2%
associate-+r+13.2%
Applied egg-rr13.2%
Taylor expanded in B around -inf 21.9%
Taylor expanded in A around 0 22.2%
*-commutative22.2%
*-commutative22.2%
+-commutative22.2%
unpow222.2%
unpow222.2%
hypot-def47.9%
Simplified47.9%
if -1.44999999999999994e84 < B < -4.60000000000000023e-143 or 6e-230 < B < 3.3e5 or 4.49999999999999998e55 < B < 6.50000000000000049e105Initial program 42.2%
associate-*l*42.2%
unpow242.2%
+-commutative42.2%
unpow242.2%
associate-*l*42.2%
unpow242.2%
Simplified42.2%
sqrt-prod46.3%
*-commutative46.3%
cancel-sign-sub-inv46.3%
fma-def46.3%
metadata-eval46.3%
*-commutative46.3%
+-commutative46.3%
unpow246.3%
hypot-udef59.6%
associate-+r+60.6%
Applied egg-rr60.6%
if -4.60000000000000023e-143 < B < 6e-230Initial program 20.0%
Simplified24.0%
sqrt-prod24.0%
associate-*l*26.4%
Applied egg-rr26.4%
Taylor expanded in A around -inf 25.5%
if 3.3e5 < B < 4.49999999999999998e55Initial program 11.9%
associate-*l*11.9%
unpow211.9%
+-commutative11.9%
unpow211.9%
associate-*l*11.9%
unpow211.9%
Simplified11.9%
Taylor expanded in A around -inf 33.0%
fma-def33.0%
unpow233.0%
Simplified33.0%
if 6.50000000000000049e105 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
sqrt-prod18.0%
hypot-udef77.1%
Applied egg-rr77.1%
hypot-def18.0%
unpow218.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
unpow218.0%
hypot-def77.1%
Simplified77.1%
Final simplification52.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma C (* A -4.0) (* B B)))
(t_1 (* -0.5 (/ (* B B) A)))
(t_2 (- (* B B) (* 4.0 (* A C))))
(t_3 (/ (sqrt 2.0) B))
(t_4 (+ C (hypot C B))))
(if (<= B -9.4e-7)
(* t_3 (sqrt (* F t_4)))
(if (<= B 1.15e-69)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ C (+ C t_1)))))
t_2)
(if (<= B 680000.0)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ C (+ A (hypot B (- A C))))))))) t_0)
(if (<= B 2.1e+55)
(/ (- (sqrt (* (* 2.0 (* F t_2)) (fma 2.0 C t_1)))) t_2)
(* t_3 (* (sqrt F) (- (sqrt t_4))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(C, (A * -4.0), (B * B));
double t_1 = -0.5 * ((B * B) / A);
double t_2 = (B * B) - (4.0 * (A * C));
double t_3 = sqrt(2.0) / B;
double t_4 = C + hypot(C, B);
double tmp;
if (B <= -9.4e-7) {
tmp = t_3 * sqrt((F * t_4));
} else if (B <= 1.15e-69) {
tmp = (sqrt((2.0 * (F * fma(B, B, (-4.0 * (A * C)))))) * -sqrt((C + (C + t_1)))) / t_2;
} else if (B <= 680000.0) {
tmp = -sqrt((2.0 * (t_0 * (F * (C + (A + hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.1e+55) {
tmp = -sqrt(((2.0 * (F * t_2)) * fma(2.0, C, t_1))) / t_2;
} else {
tmp = t_3 * (sqrt(F) * -sqrt(t_4));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(C, Float64(A * -4.0), Float64(B * B)) t_1 = Float64(-0.5 * Float64(Float64(B * B) / A)) t_2 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_3 = Float64(sqrt(2.0) / B) t_4 = Float64(C + hypot(C, B)) tmp = 0.0 if (B <= -9.4e-7) tmp = Float64(t_3 * sqrt(Float64(F * t_4))); elseif (B <= 1.15e-69) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(C + Float64(C + t_1))))) / t_2); elseif (B <= 680000.0) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(C + Float64(A + hypot(B, Float64(A - C))))))))) / t_0); elseif (B <= 2.1e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_2)) * fma(2.0, C, t_1)))) / t_2); else tmp = Float64(t_3 * Float64(sqrt(F) * Float64(-sqrt(t_4)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$4 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -9.4e-7], N[(t$95$3 * N[Sqrt[N[(F * t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.15e-69], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 680000.0], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.1e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(t$95$3 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$4], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_1 := -0.5 \cdot \frac{B \cdot B}{A}\\
t_2 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{\sqrt{2}}{B}\\
t_4 := C + \mathsf{hypot}\left(C, B\right)\\
\mathbf{if}\;B \leq -9.4 \cdot 10^{-7}:\\
\;\;\;\;t_3 \cdot \sqrt{F \cdot t_4}\\
\mathbf{elif}\;B \leq 1.15 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \left(C + t_1\right)}\right)}{t_2}\\
\mathbf{elif}\;B \leq 680000:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.1 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_2\right)\right) \cdot \mathsf{fma}\left(2, C, t_1\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_4}\right)\right)\\
\end{array}
\end{array}
if B < -9.4e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -9.4e-7 < B < 1.15e-69Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod28.4%
*-commutative28.4%
cancel-sign-sub-inv28.4%
fma-def28.4%
metadata-eval28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
hypot-udef40.2%
associate-+r+41.2%
Applied egg-rr41.2%
Taylor expanded in A around -inf 30.1%
unpow230.1%
Simplified30.1%
if 1.15e-69 < B < 6.8e5Initial program 59.6%
Simplified65.9%
distribute-frac-neg65.9%
associate-*l*66.1%
Applied egg-rr66.1%
if 6.8e5 < B < 2.1000000000000001e55Initial program 13.2%
associate-*l*13.2%
unpow213.2%
+-commutative13.2%
unpow213.2%
associate-*l*13.2%
unpow213.2%
Simplified13.2%
Taylor expanded in A around -inf 35.9%
fma-def35.9%
unpow235.9%
Simplified35.9%
if 2.1000000000000001e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
sqrt-prod26.4%
hypot-udef72.5%
Applied egg-rr72.5%
hypot-def26.4%
unpow226.4%
unpow226.4%
+-commutative26.4%
unpow226.4%
unpow226.4%
hypot-def72.5%
Simplified72.5%
Final simplification46.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma C (* A -4.0) (* B B)))
(t_1 (* -0.5 (/ (* B B) A)))
(t_2 (- (* B B) (* 4.0 (* A C))))
(t_3 (/ (sqrt 2.0) B))
(t_4 (+ C (hypot C B))))
(if (<= B -1.82e-6)
(* t_3 (sqrt (* F t_4)))
(if (<= B 6.6e-69)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ C (+ C t_1)))))
t_2)
(if (<= B 1.6e+42)
(/ (* (sqrt (* t_0 (* F (+ C C)))) (- (sqrt 2.0))) t_0)
(if (<= B 2.6e+55)
(/ (- (sqrt (* (* 2.0 (* F t_2)) (fma 2.0 C t_1)))) t_2)
(* t_3 (* (sqrt F) (- (sqrt t_4))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(C, (A * -4.0), (B * B));
double t_1 = -0.5 * ((B * B) / A);
double t_2 = (B * B) - (4.0 * (A * C));
double t_3 = sqrt(2.0) / B;
double t_4 = C + hypot(C, B);
double tmp;
if (B <= -1.82e-6) {
tmp = t_3 * sqrt((F * t_4));
} else if (B <= 6.6e-69) {
tmp = (sqrt((2.0 * (F * fma(B, B, (-4.0 * (A * C)))))) * -sqrt((C + (C + t_1)))) / t_2;
} else if (B <= 1.6e+42) {
tmp = (sqrt((t_0 * (F * (C + C)))) * -sqrt(2.0)) / t_0;
} else if (B <= 2.6e+55) {
tmp = -sqrt(((2.0 * (F * t_2)) * fma(2.0, C, t_1))) / t_2;
} else {
tmp = t_3 * (sqrt(F) * -sqrt(t_4));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(C, Float64(A * -4.0), Float64(B * B)) t_1 = Float64(-0.5 * Float64(Float64(B * B) / A)) t_2 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_3 = Float64(sqrt(2.0) / B) t_4 = Float64(C + hypot(C, B)) tmp = 0.0 if (B <= -1.82e-6) tmp = Float64(t_3 * sqrt(Float64(F * t_4))); elseif (B <= 6.6e-69) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(C + Float64(C + t_1))))) / t_2); elseif (B <= 1.6e+42) tmp = Float64(Float64(sqrt(Float64(t_0 * Float64(F * Float64(C + C)))) * Float64(-sqrt(2.0))) / t_0); elseif (B <= 2.6e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_2)) * fma(2.0, C, t_1)))) / t_2); else tmp = Float64(t_3 * Float64(sqrt(F) * Float64(-sqrt(t_4)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(C * N[(A * -4.0), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$4 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.82e-6], N[(t$95$3 * N[Sqrt[N[(F * t$95$4), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.6e-69], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B, 1.6e+42], N[(N[(N[Sqrt[N[(t$95$0 * N[(F * N[(C + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 2.6e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], N[(t$95$3 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$4], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(C, A \cdot -4, B \cdot B\right)\\
t_1 := -0.5 \cdot \frac{B \cdot B}{A}\\
t_2 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{\sqrt{2}}{B}\\
t_4 := C + \mathsf{hypot}\left(C, B\right)\\
\mathbf{if}\;B \leq -1.82 \cdot 10^{-6}:\\
\;\;\;\;t_3 \cdot \sqrt{F \cdot t_4}\\
\mathbf{elif}\;B \leq 6.6 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \left(C + t_1\right)}\right)}{t_2}\\
\mathbf{elif}\;B \leq 1.6 \cdot 10^{+42}:\\
\;\;\;\;\frac{\sqrt{t_0 \cdot \left(F \cdot \left(C + C\right)\right)} \cdot \left(-\sqrt{2}\right)}{t_0}\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_2\right)\right) \cdot \mathsf{fma}\left(2, C, t_1\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_4}\right)\right)\\
\end{array}
\end{array}
if B < -1.8199999999999999e-6Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -1.8199999999999999e-6 < B < 6.6000000000000001e-69Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod28.4%
*-commutative28.4%
cancel-sign-sub-inv28.4%
fma-def28.4%
metadata-eval28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
hypot-udef40.2%
associate-+r+41.2%
Applied egg-rr41.2%
Taylor expanded in A around -inf 30.1%
unpow230.1%
Simplified30.1%
if 6.6000000000000001e-69 < B < 1.60000000000000001e42Initial program 50.9%
Simplified60.0%
sqrt-prod59.9%
associate-*l*60.1%
Applied egg-rr60.1%
Taylor expanded in A around -inf 30.3%
if 1.60000000000000001e42 < B < 2.6e55Initial program 2.0%
associate-*l*2.0%
unpow22.0%
+-commutative2.0%
unpow22.0%
associate-*l*2.0%
unpow22.0%
Simplified2.0%
Taylor expanded in A around -inf 35.4%
fma-def35.4%
unpow235.4%
Simplified35.4%
if 2.6e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
sqrt-prod26.4%
hypot-udef72.5%
Applied egg-rr72.5%
hypot-def26.4%
unpow226.4%
unpow226.4%
+-commutative26.4%
unpow226.4%
unpow226.4%
hypot-def72.5%
Simplified72.5%
Final simplification42.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)) (t_1 (+ C (hypot C B))))
(if (<= B -5e-7)
(* t_0 (sqrt (* F t_1)))
(if (<= B 1.95e-30)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
(- (* B B) (* 4.0 (* A C))))
(* t_0 (* (sqrt F) (- (sqrt t_1))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double t_1 = C + hypot(C, B);
double tmp;
if (B <= -5e-7) {
tmp = t_0 * sqrt((F * t_1));
} else if (B <= 1.95e-30) {
tmp = (sqrt((2.0 * (F * fma(B, B, (-4.0 * (A * C)))))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = t_0 * (sqrt(F) * -sqrt(t_1));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) t_1 = Float64(C + hypot(C, B)) tmp = 0.0 if (B <= -5e-7) tmp = Float64(t_0 * sqrt(Float64(F * t_1))); elseif (B <= 1.95e-30) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(t_0 * Float64(sqrt(F) * Float64(-sqrt(t_1)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5e-7], N[(t$95$0 * N[Sqrt[N[(F * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.95e-30], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[t$95$1], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
t_1 := C + \mathsf{hypot}\left(C, B\right)\\
\mathbf{if}\;B \leq -5 \cdot 10^{-7}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot t_1}\\
\mathbf{elif}\;B \leq 1.95 \cdot 10^{-30}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{t_1}\right)\right)\\
\end{array}
\end{array}
if B < -4.99999999999999977e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -4.99999999999999977e-7 < B < 1.9500000000000002e-30Initial program 29.3%
associate-*l*29.3%
unpow229.3%
+-commutative29.3%
unpow229.3%
associate-*l*29.3%
unpow229.3%
Simplified29.3%
sqrt-prod31.3%
*-commutative31.3%
cancel-sign-sub-inv31.3%
fma-def31.3%
metadata-eval31.3%
*-commutative31.3%
+-commutative31.3%
unpow231.3%
hypot-udef42.7%
associate-+r+43.7%
Applied egg-rr43.7%
Taylor expanded in A around -inf 30.5%
unpow230.5%
Simplified30.5%
if 1.9500000000000002e-30 < B Initial program 21.4%
Simplified25.4%
Taylor expanded in A around 0 27.2%
mul-1-neg27.2%
*-commutative27.2%
unpow227.2%
unpow227.2%
Simplified27.2%
sqrt-prod30.0%
hypot-udef63.3%
Applied egg-rr63.3%
hypot-def30.0%
unpow230.0%
unpow230.0%
+-commutative30.0%
unpow230.0%
unpow230.0%
hypot-def63.3%
Simplified63.3%
Final simplification43.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)))
(if (<= B -1.7e-6)
(* t_0 (sqrt (* F (+ C (hypot C B)))))
(if (<= B 2.15e+55)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* -4.0 (* A C))))))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
(- (* B B) (* 4.0 (* A C))))
(* t_0 (- (* (sqrt F) (sqrt (+ B C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double tmp;
if (B <= -1.7e-6) {
tmp = t_0 * sqrt((F * (C + hypot(C, B))));
} else if (B <= 2.15e+55) {
tmp = (sqrt((2.0 * (F * fma(B, B, (-4.0 * (A * C)))))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = t_0 * -(sqrt(F) * sqrt((B + C)));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -1.7e-6) tmp = Float64(t_0 * sqrt(Float64(F * Float64(C + hypot(C, B))))); elseif (B <= 2.15e+55) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(t_0 * Float64(-Float64(sqrt(F) * sqrt(Float64(B + C))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -1.7e-6], N[(t$95$0 * N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.15e+55], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B + C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -1.7 \cdot 10^{-6}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\\
\mathbf{elif}\;B \leq 2.15 \cdot 10^{+55}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F} \cdot \sqrt{B + C}\right)\\
\end{array}
\end{array}
if B < -1.70000000000000003e-6Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -1.70000000000000003e-6 < B < 2.1499999999999999e55Initial program 30.4%
associate-*l*30.4%
unpow230.4%
+-commutative30.4%
unpow230.4%
associate-*l*30.4%
unpow230.4%
Simplified30.4%
sqrt-prod32.2%
*-commutative32.2%
cancel-sign-sub-inv32.2%
fma-def32.2%
metadata-eval32.2%
*-commutative32.2%
+-commutative32.2%
unpow232.2%
hypot-udef43.5%
associate-+r+44.7%
Applied egg-rr44.7%
Taylor expanded in A around -inf 30.2%
unpow230.2%
Simplified30.2%
if 2.1499999999999999e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
Taylor expanded in B around inf 43.8%
sqrt-prod65.7%
+-commutative65.7%
Applied egg-rr65.7%
Final simplification41.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (/ (sqrt 2.0) B)))
(if (<= B -9.5e-8)
(* t_1 (sqrt (* F (+ C (hypot C B)))))
(if (<= B 0.0005)
(/
(*
(sqrt (* 2.0 (* F (fma B B (* A (* C -4.0))))))
(- (sqrt (* 2.0 C))))
t_0)
(if (<= B 4.5e+57)
(/
(- (sqrt (* (* 2.0 (* F t_0)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_0)
(if (<= B 2.5e+158)
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))
(* t_1 (- (* (sqrt F) (sqrt (+ B C)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = sqrt(2.0) / B;
double tmp;
if (B <= -9.5e-8) {
tmp = t_1 * sqrt((F * (C + hypot(C, B))));
} else if (B <= 0.0005) {
tmp = (sqrt((2.0 * (F * fma(B, B, (A * (C * -4.0)))))) * -sqrt((2.0 * C))) / t_0;
} else if (B <= 4.5e+57) {
tmp = -sqrt(((2.0 * (F * t_0)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else if (B <= 2.5e+158) {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
} else {
tmp = t_1 * -(sqrt(F) * sqrt((B + C)));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -9.5e-8) tmp = Float64(t_1 * sqrt(Float64(F * Float64(C + hypot(C, B))))); elseif (B <= 0.0005) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(A * Float64(C * -4.0)))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_0); elseif (B <= 4.5e+57) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); elseif (B <= 2.5e+158) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); else tmp = Float64(t_1 * Float64(-Float64(sqrt(F) * sqrt(Float64(B + C))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -9.5e-8], N[(t$95$1 * N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 0.0005], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 4.5e+57], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.5e+158], 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], N[(t$95$1 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B + C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -9.5 \cdot 10^{-8}:\\
\;\;\;\;t_1 \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\\
\mathbf{elif}\;B \leq 0.0005:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+158}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-\sqrt{F} \cdot \sqrt{B + C}\right)\\
\end{array}
\end{array}
if B < -9.50000000000000036e-8Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -9.50000000000000036e-8 < B < 5.0000000000000001e-4Initial program 30.8%
associate-*l*30.8%
unpow230.8%
+-commutative30.8%
unpow230.8%
associate-*l*30.8%
unpow230.8%
Simplified30.8%
Taylor expanded in A around -inf 26.3%
sqrt-prod30.5%
cancel-sign-sub-inv30.5%
metadata-eval30.5%
*-commutative30.5%
fma-udef30.5%
*-commutative30.5%
Applied egg-rr30.5%
associate-*r*30.5%
Simplified30.5%
if 5.0000000000000001e-4 < B < 4.49999999999999996e57Initial program 26.4%
associate-*l*26.4%
unpow226.4%
+-commutative26.4%
unpow226.4%
associate-*l*26.4%
unpow226.4%
Simplified26.4%
Taylor expanded in A around -inf 28.2%
fma-def28.2%
unpow228.2%
Simplified28.2%
if 4.49999999999999996e57 < B < 2.4999999999999998e158Initial program 33.4%
Simplified38.6%
Taylor expanded in A around 0 51.7%
mul-1-neg51.7%
*-commutative51.7%
distribute-rgt-neg-in51.7%
*-commutative51.7%
unpow251.7%
unpow251.7%
hypot-def56.7%
Simplified56.7%
if 2.4999999999999998e158 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around 0 2.4%
mul-1-neg2.4%
*-commutative2.4%
unpow22.4%
unpow22.4%
Simplified2.4%
Taylor expanded in B around inf 39.4%
sqrt-prod74.9%
+-commutative74.9%
Applied egg-rr74.9%
Final simplification41.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= B -5.1e-8)
(/ (- (sqrt (* t_1 (+ (+ A C) (hypot B (- A C)))))) t_0)
(if (<= B 1.65e+55)
(/ (- (sqrt (* t_1 (fma 2.0 C (* -0.5 (/ (* B B) A)))))) t_0)
(* (/ (sqrt 2.0) B) (- (* (sqrt F) (sqrt (+ B C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= -5.1e-8) {
tmp = -sqrt((t_1 * ((A + C) + hypot(B, (A - C))))) / t_0;
} else if (B <= 1.65e+55) {
tmp = -sqrt((t_1 * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -(sqrt(F) * sqrt((B + C)));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= -5.1e-8) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + hypot(B, Float64(A - C)))))) / t_0); elseif (B <= 1.65e+55) tmp = Float64(Float64(-sqrt(Float64(t_1 * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-Float64(sqrt(F) * sqrt(Float64(B + C))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5.1e-8], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.65e+55], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B + C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq -5.1 \cdot 10^{-8}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.65 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F} \cdot \sqrt{B + C}\right)\\
\end{array}
\end{array}
if B < -5.10000000000000001e-8Initial program 24.6%
associate-*l*24.6%
unpow224.6%
+-commutative24.6%
unpow224.6%
associate-*l*24.6%
unpow224.6%
Simplified24.6%
+-commutative24.6%
*-un-lft-identity24.6%
fma-def24.6%
unpow224.6%
hypot-udef26.2%
+-commutative26.2%
Applied egg-rr26.2%
fma-udef26.2%
*-lft-identity26.2%
+-commutative26.2%
Simplified26.2%
if -5.10000000000000001e-8 < B < 1.65e55Initial program 30.6%
associate-*l*30.6%
unpow230.6%
+-commutative30.6%
unpow230.6%
associate-*l*30.6%
unpow230.6%
Simplified30.6%
Taylor expanded in A around -inf 26.1%
fma-def26.1%
unpow226.1%
Simplified26.1%
if 1.65e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
Taylor expanded in B around inf 43.8%
sqrt-prod65.7%
+-commutative65.7%
Applied egg-rr65.7%
Final simplification33.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.9e+52)
(* t_0 (sqrt (* F (+ A (hypot A B)))))
(if (<= B 1.6e+55)
(/
(- (sqrt (* (* 2.0 (* F t_1)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_1)
(* t_0 (- (* (sqrt F) (sqrt (+ B C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.9e+52) {
tmp = t_0 * sqrt((F * (A + hypot(A, B))));
} else if (B <= 1.6e+55) {
tmp = -sqrt(((2.0 * (F * t_1)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_1;
} else {
tmp = t_0 * -(sqrt(F) * sqrt((B + C)));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.9e+52) tmp = Float64(t_0 * sqrt(Float64(F * Float64(A + hypot(A, B))))); elseif (B <= 1.6e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_1); else tmp = Float64(t_0 * Float64(-Float64(sqrt(F) * sqrt(Float64(B + C))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.9e+52], N[(t$95$0 * N[Sqrt[N[(F * N[(A + N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.6e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(t$95$0 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B + C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.9 \cdot 10^{+52}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A + \mathsf{hypot}\left(A, B\right)\right)}\\
\mathbf{elif}\;B \leq 1.6 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F} \cdot \sqrt{B + C}\right)\\
\end{array}
\end{array}
if B < -2.9e52Initial program 20.3%
associate-*l*20.3%
unpow220.3%
+-commutative20.3%
unpow220.3%
associate-*l*20.3%
unpow220.3%
Simplified20.3%
sqrt-prod22.2%
*-commutative22.2%
cancel-sign-sub-inv22.2%
fma-def22.2%
metadata-eval22.2%
*-commutative22.2%
+-commutative22.2%
unpow222.2%
hypot-udef27.8%
associate-+r+27.8%
Applied egg-rr27.8%
Taylor expanded in B around -inf 32.3%
Taylor expanded in C around 0 27.2%
*-commutative27.2%
+-commutative27.2%
unpow227.2%
unpow227.2%
hypot-def46.9%
Simplified46.9%
if -2.9e52 < B < 1.6000000000000001e55Initial program 31.6%
associate-*l*31.6%
unpow231.6%
+-commutative31.6%
unpow231.6%
associate-*l*31.6%
unpow231.6%
Simplified31.6%
Taylor expanded in A around -inf 25.0%
fma-def25.0%
unpow225.0%
Simplified25.0%
if 1.6000000000000001e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
Taylor expanded in B around inf 43.8%
sqrt-prod65.7%
+-commutative65.7%
Applied egg-rr65.7%
Final simplification37.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B)) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.35e-7)
(* t_0 (sqrt (* F (+ C (hypot C B)))))
(if (<= B 1.8e+55)
(/
(- (sqrt (* (* 2.0 (* F t_1)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_1)
(* t_0 (- (* (sqrt F) (sqrt (+ B C)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.35e-7) {
tmp = t_0 * sqrt((F * (C + hypot(C, B))));
} else if (B <= 1.8e+55) {
tmp = -sqrt(((2.0 * (F * t_1)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_1;
} else {
tmp = t_0 * -(sqrt(F) * sqrt((B + C)));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.35e-7) tmp = Float64(t_0 * sqrt(Float64(F * Float64(C + hypot(C, B))))); elseif (B <= 1.8e+55) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_1); else tmp = Float64(t_0 * Float64(-Float64(sqrt(F) * sqrt(Float64(B + C))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.35e-7], N[(t$95$0 * N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.8e+55], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(t$95$0 * (-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B + C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.35 \cdot 10^{-7}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}\\
\mathbf{elif}\;B \leq 1.8 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F} \cdot \sqrt{B + C}\right)\\
\end{array}
\end{array}
if B < -2.35e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
sqrt-prod28.1%
*-commutative28.1%
cancel-sign-sub-inv28.1%
fma-def28.1%
metadata-eval28.1%
*-commutative28.1%
+-commutative28.1%
unpow228.1%
hypot-udef32.7%
associate-+r+32.7%
Applied egg-rr32.7%
Taylor expanded in B around -inf 34.9%
Taylor expanded in A around 0 31.5%
*-commutative31.5%
*-commutative31.5%
+-commutative31.5%
unpow231.5%
unpow231.5%
hypot-def49.3%
Simplified49.3%
if -2.35e-7 < B < 1.79999999999999994e55Initial program 30.4%
associate-*l*30.4%
unpow230.4%
+-commutative30.4%
unpow230.4%
associate-*l*30.4%
unpow230.4%
Simplified30.4%
Taylor expanded in A around -inf 26.0%
fma-def26.0%
unpow226.0%
Simplified26.0%
if 1.79999999999999994e55 < B Initial program 15.0%
Simplified17.3%
Taylor expanded in A around 0 24.5%
mul-1-neg24.5%
*-commutative24.5%
unpow224.5%
unpow224.5%
Simplified24.5%
Taylor expanded in B around inf 43.8%
sqrt-prod65.7%
+-commutative65.7%
Applied egg-rr65.7%
Final simplification39.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= B -2e-8)
(/ (- (sqrt (* t_1 (+ (+ A C) (hypot B (- A C)))))) t_0)
(if (<= B 1.7e+55)
(/ (- (sqrt (* t_1 (fma 2.0 C (* -0.5 (/ (* B B) A)))))) t_0)
(if (<= B 4e+224)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ B C))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= -2e-8) {
tmp = -sqrt((t_1 * ((A + C) + hypot(B, (A - C))))) / t_0;
} else if (B <= 1.7e+55) {
tmp = -sqrt((t_1 * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else if (B <= 4e+224) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= -2e-8) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(Float64(A + C) + hypot(B, Float64(A - C)))))) / t_0); elseif (B <= 1.7e+55) tmp = Float64(Float64(-sqrt(Float64(t_1 * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); elseif (B <= 4e+224) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(B + C)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2e-8], N[((-N[Sqrt[N[(t$95$1 * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.7e+55], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 4e+224], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq -2 \cdot 10^{-8}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.7 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4 \cdot 10^{+224}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(B + C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -2e-8Initial program 24.6%
associate-*l*24.6%
unpow224.6%
+-commutative24.6%
unpow224.6%
associate-*l*24.6%
unpow224.6%
Simplified24.6%
+-commutative24.6%
*-un-lft-identity24.6%
fma-def24.6%
unpow224.6%
hypot-udef26.2%
+-commutative26.2%
Applied egg-rr26.2%
fma-udef26.2%
*-lft-identity26.2%
+-commutative26.2%
Simplified26.2%
if -2e-8 < B < 1.6999999999999999e55Initial program 30.6%
associate-*l*30.6%
unpow230.6%
+-commutative30.6%
unpow230.6%
associate-*l*30.6%
unpow230.6%
Simplified30.6%
Taylor expanded in A around -inf 26.1%
fma-def26.1%
unpow226.1%
Simplified26.1%
if 1.6999999999999999e55 < B < 3.99999999999999988e224Initial program 19.9%
Simplified22.9%
Taylor expanded in A around 0 31.7%
mul-1-neg31.7%
*-commutative31.7%
unpow231.7%
unpow231.7%
Simplified31.7%
Taylor expanded in B around inf 49.2%
if 3.99999999999999988e224 < B Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around 0 0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification31.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -8.2e-8)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ (+ A C) (hypot B (- A C)))))) t_0)
(if (<= B 1.35e+55)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)
(if (<= B 1e+224)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ B C))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -8.2e-8) {
tmp = -sqrt(((2.0 * (F * t_0)) * ((A + C) + hypot(B, (A - C))))) / t_0;
} else if (B <= 1.35e+55) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else if (B <= 1e+224) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -8.2e-8) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * ((A + C) + Math.hypot(B, (A - C))))) / t_0;
} else if (B <= 1.35e+55) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else if (B <= 1e+224) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * (B + C)));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -8.2e-8: tmp = -math.sqrt(((2.0 * (F * t_0)) * ((A + C) + math.hypot(B, (A - C))))) / t_0 elif B <= 1.35e+55: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 elif B <= 1e+224: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * (B + C))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -8.2e-8) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(Float64(A + C) + hypot(B, Float64(A - C)))))) / t_0); elseif (B <= 1.35e+55) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0); elseif (B <= 1e+224) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(B + C)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -8.2e-8)
tmp = -sqrt(((2.0 * (F * t_0)) * ((A + C) + hypot(B, (A - C))))) / t_0;
elseif (B <= 1.35e+55)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
elseif (B <= 1e+224)
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -8.2e-8], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1e+224], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -8.2 \cdot 10^{-8}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B, A - C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 10^{+224}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(B + C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -8.20000000000000063e-8Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
+-commutative25.0%
*-un-lft-identity25.0%
fma-def25.0%
unpow225.0%
hypot-udef26.6%
+-commutative26.6%
Applied egg-rr26.6%
fma-udef26.6%
*-lft-identity26.6%
+-commutative26.6%
Simplified26.6%
if -8.20000000000000063e-8 < B < 1.34999999999999988e55Initial program 30.6%
associate-*l*30.6%
unpow230.6%
+-commutative30.6%
unpow230.6%
associate-*l*30.6%
unpow230.6%
Simplified30.6%
Taylor expanded in A around -inf 26.4%
Taylor expanded in F around 0 26.4%
cancel-sign-sub-inv26.4%
metadata-eval26.4%
unpow226.4%
Simplified26.4%
if 1.34999999999999988e55 < B < 9.9999999999999997e223Initial program 19.4%
Simplified22.4%
Taylor expanded in A around 0 31.0%
mul-1-neg31.0%
*-commutative31.0%
unpow231.0%
unpow231.0%
Simplified31.0%
Taylor expanded in B around inf 47.9%
if 9.9999999999999997e223 < B Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around 0 0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification31.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.35e-14)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (+ C (hypot B C)))) t_0))
(if (<= B 1.5e+55)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)
(if (<= B 6.4e+222)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ B C))))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.35e-14) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (C + hypot(B, C)))) / t_0);
} else if (B <= 1.5e+55) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else if (B <= 6.4e+222) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.35e-14) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (C + Math.hypot(B, C)))) / t_0);
} else if (B <= 1.5e+55) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else if (B <= 6.4e+222) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * (B + C)));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -2.35e-14: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (C + math.hypot(B, C)))) / t_0) elif B <= 1.5e+55: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 elif B <= 6.4e+222: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * (B + C))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.35e-14) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C + hypot(B, C)))) / t_0)); elseif (B <= 1.5e+55) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0); elseif (B <= 6.4e+222) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(B + C)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -2.35e-14)
tmp = -(sqrt(((2.0 * (F * t_0)) * (C + hypot(B, C)))) / t_0);
elseif (B <= 1.5e+55)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
elseif (B <= 6.4e+222)
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.35e-14], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 1.5e+55], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 6.4e+222], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.35 \cdot 10^{-14}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.5 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 6.4 \cdot 10^{+222}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(B + C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -2.3500000000000001e-14Initial program 24.0%
associate-*l*24.0%
unpow224.0%
+-commutative24.0%
unpow224.0%
associate-*l*24.0%
unpow224.0%
Simplified24.0%
Taylor expanded in A around 0 23.5%
unpow223.5%
unpow223.5%
hypot-def23.5%
Simplified23.5%
if -2.3500000000000001e-14 < B < 1.50000000000000008e55Initial program 31.2%
associate-*l*31.2%
unpow231.2%
+-commutative31.2%
unpow231.2%
associate-*l*31.2%
unpow231.2%
Simplified31.2%
Taylor expanded in A around -inf 26.9%
Taylor expanded in F around 0 26.9%
cancel-sign-sub-inv26.9%
metadata-eval26.9%
unpow226.9%
Simplified26.9%
if 1.50000000000000008e55 < B < 6.4000000000000003e222Initial program 19.4%
Simplified22.4%
Taylor expanded in A around 0 31.0%
mul-1-neg31.0%
*-commutative31.0%
unpow231.0%
unpow231.0%
Simplified31.0%
Taylor expanded in B around inf 47.9%
if 6.4000000000000003e222 < B Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around 0 0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification31.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -1e-21)
(/ (- (sqrt (* 2.0 (* (+ C (hypot C B)) (* F (* B B)))))) t_0)
(if (<= B 1.35e+55)
t_1
(if (<= B 8.8e+100)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(if (<= B 1.7e+106)
t_1
(if (<= B 3.1e+128)
(/ (* (* (sqrt F) (sqrt C)) (- 2.0)) B)
(if (<= B 2.6e+223)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ B C))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1e-21) {
tmp = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else if (B <= 1.7e+106) {
tmp = t_1;
} else if (B <= 3.1e+128) {
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
} else if (B <= 2.6e+223) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1e-21) {
tmp = -Math.sqrt((2.0 * ((C + Math.hypot(C, B)) * (F * (B * B))))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else if (B <= 1.7e+106) {
tmp = t_1;
} else if (B <= 3.1e+128) {
tmp = ((Math.sqrt(F) * Math.sqrt(C)) * -2.0) / B;
} else if (B <= 2.6e+223) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * (B + C)));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -1e-21: tmp = -math.sqrt((2.0 * ((C + math.hypot(C, B)) * (F * (B * B))))) / t_0 elif B <= 1.35e+55: tmp = t_1 elif B <= 8.8e+100: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) elif B <= 1.7e+106: tmp = t_1 elif B <= 3.1e+128: tmp = ((math.sqrt(F) * math.sqrt(C)) * -2.0) / B elif B <= 2.6e+223: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * (B + C))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -1e-21) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + hypot(C, B)) * Float64(F * Float64(B * B)))))) / t_0); elseif (B <= 1.35e+55) tmp = t_1; elseif (B <= 8.8e+100) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); elseif (B <= 1.7e+106) tmp = t_1; elseif (B <= 3.1e+128) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(C)) * Float64(-2.0)) / B); elseif (B <= 2.6e+223) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(B + C)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -1e-21)
tmp = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
elseif (B <= 1.35e+55)
tmp = t_1;
elseif (B <= 8.8e+100)
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
elseif (B <= 1.7e+106)
tmp = t_1;
elseif (B <= 3.1e+128)
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
elseif (B <= 2.6e+223)
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1e-21], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], t$95$1, If[LessEqual[B, 8.8e+100], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 1.7e+106], t$95$1, If[LessEqual[B, 3.1e+128], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * (-2.0)), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[B, 2.6e+223], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -1 \cdot 10^{-21}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 8.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{elif}\;B \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.1 \cdot 10^{+128}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \left(-2\right)}{B}\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{+223}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(B + C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -9.99999999999999908e-22Initial program 23.3%
associate-*l*23.3%
unpow223.3%
+-commutative23.3%
unpow223.3%
associate-*l*23.3%
unpow223.3%
Simplified23.3%
Taylor expanded in A around 0 22.8%
unpow222.8%
unpow222.8%
hypot-def22.8%
Simplified22.8%
Taylor expanded in A around 0 21.2%
+-commutative21.2%
unpow221.2%
unpow221.2%
hypot-def21.5%
unpow221.5%
Simplified21.5%
if -9.99999999999999908e-22 < B < 1.34999999999999988e55 or 8.8000000000000003e100 < B < 1.69999999999999997e106Initial program 31.2%
associate-*l*31.2%
unpow231.2%
+-commutative31.2%
unpow231.2%
associate-*l*31.2%
unpow231.2%
Simplified31.2%
Taylor expanded in A around -inf 28.3%
Taylor expanded in F around 0 28.3%
cancel-sign-sub-inv28.3%
metadata-eval28.3%
unpow228.3%
Simplified28.3%
if 1.34999999999999988e55 < B < 8.8000000000000003e100Initial program 51.3%
Simplified51.0%
Taylor expanded in A around 0 60.8%
mul-1-neg60.8%
*-commutative60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Taylor expanded in C around 0 61.1%
if 1.69999999999999997e106 < B < 3.10000000000000004e128Initial program 2.7%
Simplified2.7%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
*-commutative20.4%
unpow220.4%
unpow220.4%
Simplified20.4%
Taylor expanded in B around 0 18.1%
unpow218.1%
rem-square-sqrt18.5%
Simplified18.5%
associate-*l/18.5%
*-commutative18.5%
Applied egg-rr18.5%
sqrt-prod34.6%
Applied egg-rr34.6%
if 3.10000000000000004e128 < B < 2.6000000000000002e223Initial program 10.3%
Simplified10.3%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
*-commutative21.9%
unpow221.9%
unpow221.9%
Simplified21.9%
Taylor expanded in B around inf 57.8%
if 2.6000000000000002e223 < B Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around 0 0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification32.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -1.02e-7)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B 1.35e+55)
t_1
(if (<= B 7.8e+100)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(if (<= B 4.5e+105)
t_1
(if (<= B 2.9e+128)
(/ (* (* (sqrt F) (sqrt C)) (- 2.0)) B)
(if (<= B 2.6e+223)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (+ B C))))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1.02e-7) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 7.8e+100) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else if (B <= 4.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
} else if (B <= 2.6e+223) {
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
if (b <= (-1.02d-7)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= 1.35d+55) then
tmp = t_1
else if (b <= 7.8d+100) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else if (b <= 4.5d+105) then
tmp = t_1
else if (b <= 2.9d+128) then
tmp = ((sqrt(f) * sqrt(c)) * -2.0d0) / b
else if (b <= 2.6d+223) then
tmp = (-sqrt(2.0d0) / b) * sqrt((f * (b + c)))
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1.02e-7) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 7.8e+100) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else if (B <= 4.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = ((Math.sqrt(F) * Math.sqrt(C)) * -2.0) / B;
} else if (B <= 2.6e+223) {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * (B + C)));
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -1.02e-7: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= 1.35e+55: tmp = t_1 elif B <= 7.8e+100: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) elif B <= 4.5e+105: tmp = t_1 elif B <= 2.9e+128: tmp = ((math.sqrt(F) * math.sqrt(C)) * -2.0) / B elif B <= 2.6e+223: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * (B + C))) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -1.02e-7) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.35e+55) tmp = t_1; elseif (B <= 7.8e+100) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); elseif (B <= 4.5e+105) tmp = t_1; elseif (B <= 2.9e+128) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(C)) * Float64(-2.0)) / B); elseif (B <= 2.6e+223) tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(B + C)))); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -1.02e-7)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= 1.35e+55)
tmp = t_1;
elseif (B <= 7.8e+100)
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
elseif (B <= 4.5e+105)
tmp = t_1;
elseif (B <= 2.9e+128)
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
elseif (B <= 2.6e+223)
tmp = (-sqrt(2.0) / B) * sqrt((F * (B + C)));
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.02e-7], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], t$95$1, If[LessEqual[B, 7.8e+100], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 4.5e+105], t$95$1, If[LessEqual[B, 2.9e+128], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * (-2.0)), $MachinePrecision] / B), $MachinePrecision], If[LessEqual[B, 2.6e+223], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * N[(B + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -1.02 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 7.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 2.9 \cdot 10^{+128}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \left(-2\right)}{B}\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{+223}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(B + C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -1.02e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -1.02e-7 < B < 1.34999999999999988e55 or 7.8e100 < B < 4.5000000000000001e105Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in A around -inf 27.4%
Taylor expanded in F around 0 27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
if 1.34999999999999988e55 < B < 7.8e100Initial program 51.3%
Simplified51.0%
Taylor expanded in A around 0 60.8%
mul-1-neg60.8%
*-commutative60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Taylor expanded in C around 0 61.1%
if 4.5000000000000001e105 < B < 2.9e128Initial program 2.7%
Simplified2.7%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
*-commutative20.4%
unpow220.4%
unpow220.4%
Simplified20.4%
Taylor expanded in B around 0 18.1%
unpow218.1%
rem-square-sqrt18.5%
Simplified18.5%
associate-*l/18.5%
*-commutative18.5%
Applied egg-rr18.5%
sqrt-prod34.6%
Applied egg-rr34.6%
if 2.9e128 < B < 2.6000000000000002e223Initial program 10.3%
Simplified10.3%
Taylor expanded in A around 0 21.9%
mul-1-neg21.9%
*-commutative21.9%
unpow221.9%
unpow221.9%
Simplified21.9%
Taylor expanded in B around inf 57.8%
if 2.6000000000000002e223 < B Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around 0 0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 74.8%
mul-1-neg74.8%
Simplified74.8%
Final simplification32.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (* 2.0 (* F t_0)))
(t_2
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -2.25e-7)
(/ (- (sqrt (* t_1 (+ A (- C B))))) t_0)
(if (<= B 1.55e+55)
t_2
(if (<= B 3.8e+100)
(/ (- (sqrt (* t_1 (+ B (+ A C))))) t_0)
(if (<= B 2.7e+107)
t_2
(if (<= B 2.8e+133)
(* (* (sqrt F) (sqrt C)) (/ (- 2.0) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double t_2 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -2.25e-7) {
tmp = -sqrt((t_1 * (A + (C - B)))) / t_0;
} else if (B <= 1.55e+55) {
tmp = t_2;
} else if (B <= 3.8e+100) {
tmp = -sqrt((t_1 * (B + (A + C)))) / t_0;
} else if (B <= 2.7e+107) {
tmp = t_2;
} else if (B <= 2.8e+133) {
tmp = (sqrt(F) * sqrt(C)) * (-2.0 / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
t_2 = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
if (b <= (-2.25d-7)) then
tmp = -sqrt((t_1 * (a + (c - b)))) / t_0
else if (b <= 1.55d+55) then
tmp = t_2
else if (b <= 3.8d+100) then
tmp = -sqrt((t_1 * (b + (a + c)))) / t_0
else if (b <= 2.7d+107) then
tmp = t_2
else if (b <= 2.8d+133) then
tmp = (sqrt(f) * sqrt(c)) * (-2.0d0 / b)
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double t_2 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -2.25e-7) {
tmp = -Math.sqrt((t_1 * (A + (C - B)))) / t_0;
} else if (B <= 1.55e+55) {
tmp = t_2;
} else if (B <= 3.8e+100) {
tmp = -Math.sqrt((t_1 * (B + (A + C)))) / t_0;
} else if (B <= 2.7e+107) {
tmp = t_2;
} else if (B <= 2.8e+133) {
tmp = (Math.sqrt(F) * Math.sqrt(C)) * (-2.0 / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) t_2 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -2.25e-7: tmp = -math.sqrt((t_1 * (A + (C - B)))) / t_0 elif B <= 1.55e+55: tmp = t_2 elif B <= 3.8e+100: tmp = -math.sqrt((t_1 * (B + (A + C)))) / t_0 elif B <= 2.7e+107: tmp = t_2 elif B <= 2.8e+133: tmp = (math.sqrt(F) * math.sqrt(C)) * (-2.0 / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) t_2 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -2.25e-7) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.55e+55) tmp = t_2; elseif (B <= 3.8e+100) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(B + Float64(A + C))))) / t_0); elseif (B <= 2.7e+107) tmp = t_2; elseif (B <= 2.8e+133) tmp = Float64(Float64(sqrt(F) * sqrt(C)) * Float64(Float64(-2.0) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = 2.0 * (F * t_0);
t_2 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -2.25e-7)
tmp = -sqrt((t_1 * (A + (C - B)))) / t_0;
elseif (B <= 1.55e+55)
tmp = t_2;
elseif (B <= 3.8e+100)
tmp = -sqrt((t_1 * (B + (A + C)))) / t_0;
elseif (B <= 2.7e+107)
tmp = t_2;
elseif (B <= 2.8e+133)
tmp = (sqrt(F) * sqrt(C)) * (-2.0 / B);
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -2.25e-7], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.55e+55], t$95$2, If[LessEqual[B, 3.8e+100], N[((-N[Sqrt[N[(t$95$1 * N[(B + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.7e+107], t$95$2, If[LessEqual[B, 2.8e+133], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
t_2 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -2.25 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.55 \cdot 10^{+55}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(B + \left(A + C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.7 \cdot 10^{+107}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 2.8 \cdot 10^{+133}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \frac{-2}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -2.2499999999999999e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -2.2499999999999999e-7 < B < 1.54999999999999997e55 or 3.79999999999999963e100 < B < 2.7000000000000001e107Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in A around -inf 27.4%
Taylor expanded in F around 0 27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
if 1.54999999999999997e55 < B < 3.79999999999999963e100Initial program 51.3%
associate-*l*51.3%
unpow251.3%
+-commutative51.3%
unpow251.3%
associate-*l*51.3%
unpow251.3%
Simplified51.3%
Taylor expanded in B around inf 50.6%
associate-+r+50.6%
Simplified50.6%
if 2.7000000000000001e107 < B < 2.80000000000000016e133Initial program 2.7%
Simplified2.7%
Taylor expanded in A around 0 31.7%
mul-1-neg31.7%
*-commutative31.7%
unpow231.7%
unpow231.7%
Simplified31.7%
Taylor expanded in B around 0 16.2%
unpow216.2%
rem-square-sqrt16.5%
Simplified16.5%
sqrt-prod30.1%
Applied egg-rr30.1%
*-commutative30.1%
Simplified30.1%
if 2.80000000000000016e133 < B Initial program 6.5%
associate-*l*6.5%
unpow26.5%
+-commutative6.5%
unpow26.5%
associate-*l*6.5%
unpow26.5%
Simplified6.5%
Taylor expanded in A around 0 6.5%
unpow26.5%
unpow26.5%
hypot-def6.5%
Simplified6.5%
Taylor expanded in C around 0 54.4%
mul-1-neg54.4%
Simplified54.4%
Final simplification30.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -1.05e-7)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B 1.35e+55)
t_1
(if (<= B 8.8e+100)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(if (<= B 6.5e+105)
t_1
(if (<= B 2.9e+128)
(* (* (sqrt F) (sqrt C)) (/ (- 2.0) B))
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1.05e-7) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else if (B <= 6.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = (sqrt(F) * sqrt(C)) * (-2.0 / B);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
if (b <= (-1.05d-7)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= 1.35d+55) then
tmp = t_1
else if (b <= 8.8d+100) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else if (b <= 6.5d+105) then
tmp = t_1
else if (b <= 2.9d+128) then
tmp = (sqrt(f) * sqrt(c)) * (-2.0d0 / b)
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -1.05e-7) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else if (B <= 6.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = (Math.sqrt(F) * Math.sqrt(C)) * (-2.0 / B);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -1.05e-7: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= 1.35e+55: tmp = t_1 elif B <= 8.8e+100: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) elif B <= 6.5e+105: tmp = t_1 elif B <= 2.9e+128: tmp = (math.sqrt(F) * math.sqrt(C)) * (-2.0 / B) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -1.05e-7) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.35e+55) tmp = t_1; elseif (B <= 8.8e+100) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); elseif (B <= 6.5e+105) tmp = t_1; elseif (B <= 2.9e+128) tmp = Float64(Float64(sqrt(F) * sqrt(C)) * Float64(Float64(-2.0) / B)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -1.05e-7)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= 1.35e+55)
tmp = t_1;
elseif (B <= 8.8e+100)
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
elseif (B <= 6.5e+105)
tmp = t_1;
elseif (B <= 2.9e+128)
tmp = (sqrt(F) * sqrt(C)) * (-2.0 / B);
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.05e-7], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], t$95$1, If[LessEqual[B, 8.8e+100], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 6.5e+105], t$95$1, If[LessEqual[B, 2.9e+128], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * N[((-2.0) / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -1.05 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 8.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 2.9 \cdot 10^{+128}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \frac{-2}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -1.05e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -1.05e-7 < B < 1.34999999999999988e55 or 8.8000000000000003e100 < B < 6.50000000000000049e105Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in A around -inf 27.4%
Taylor expanded in F around 0 27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
if 1.34999999999999988e55 < B < 8.8000000000000003e100Initial program 51.3%
Simplified51.0%
Taylor expanded in A around 0 60.8%
mul-1-neg60.8%
*-commutative60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Taylor expanded in C around 0 61.1%
if 6.50000000000000049e105 < B < 2.9e128Initial program 2.7%
Simplified2.7%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
*-commutative20.4%
unpow220.4%
unpow220.4%
Simplified20.4%
Taylor expanded in B around 0 18.1%
unpow218.1%
rem-square-sqrt18.5%
Simplified18.5%
sqrt-prod34.3%
Applied egg-rr34.3%
*-commutative34.3%
Simplified34.3%
if 2.9e128 < B Initial program 6.4%
associate-*l*6.4%
unpow26.4%
+-commutative6.4%
unpow26.4%
associate-*l*6.4%
unpow26.4%
Simplified6.4%
Taylor expanded in A around 0 6.4%
unpow26.4%
unpow26.4%
hypot-def6.4%
Simplified6.4%
Taylor expanded in C around 0 55.8%
mul-1-neg55.8%
Simplified55.8%
Final simplification31.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -6.2e-7)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B 1.35e+55)
t_1
(if (<= B 8.8e+100)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(if (<= B 4.5e+105)
t_1
(if (<= B 2.9e+128)
(/ (* (* (sqrt F) (sqrt C)) (- 2.0)) B)
(* (sqrt 2.0) (- (sqrt (/ F B)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -6.2e-7) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} else if (B <= 4.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
if (b <= (-6.2d-7)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= 1.35d+55) then
tmp = t_1
else if (b <= 8.8d+100) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
else if (b <= 4.5d+105) then
tmp = t_1
else if (b <= 2.9d+128) then
tmp = ((sqrt(f) * sqrt(c)) * -2.0d0) / b
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -6.2e-7) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_1;
} else if (B <= 8.8e+100) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} else if (B <= 4.5e+105) {
tmp = t_1;
} else if (B <= 2.9e+128) {
tmp = ((Math.sqrt(F) * Math.sqrt(C)) * -2.0) / B;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -6.2e-7: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= 1.35e+55: tmp = t_1 elif B <= 8.8e+100: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) elif B <= 4.5e+105: tmp = t_1 elif B <= 2.9e+128: tmp = ((math.sqrt(F) * math.sqrt(C)) * -2.0) / B else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -6.2e-7) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.35e+55) tmp = t_1; elseif (B <= 8.8e+100) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); elseif (B <= 4.5e+105) tmp = t_1; elseif (B <= 2.9e+128) tmp = Float64(Float64(Float64(sqrt(F) * sqrt(C)) * Float64(-2.0)) / B); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -6.2e-7)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= 1.35e+55)
tmp = t_1;
elseif (B <= 8.8e+100)
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
elseif (B <= 4.5e+105)
tmp = t_1;
elseif (B <= 2.9e+128)
tmp = ((sqrt(F) * sqrt(C)) * -2.0) / B;
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -6.2e-7], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], t$95$1, If[LessEqual[B, 8.8e+100], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 4.5e+105], t$95$1, If[LessEqual[B, 2.9e+128], N[(N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * (-2.0)), $MachinePrecision] / B), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -6.2 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 8.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{+105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 2.9 \cdot 10^{+128}:\\
\;\;\;\;\frac{\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \left(-2\right)}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -6.1999999999999999e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -6.1999999999999999e-7 < B < 1.34999999999999988e55 or 8.8000000000000003e100 < B < 4.5000000000000001e105Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in A around -inf 27.4%
Taylor expanded in F around 0 27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
if 1.34999999999999988e55 < B < 8.8000000000000003e100Initial program 51.3%
Simplified51.0%
Taylor expanded in A around 0 60.8%
mul-1-neg60.8%
*-commutative60.8%
unpow260.8%
unpow260.8%
Simplified60.8%
Taylor expanded in C around 0 61.1%
if 4.5000000000000001e105 < B < 2.9e128Initial program 2.7%
Simplified2.7%
Taylor expanded in A around 0 20.4%
mul-1-neg20.4%
*-commutative20.4%
unpow220.4%
unpow220.4%
Simplified20.4%
Taylor expanded in B around 0 18.1%
unpow218.1%
rem-square-sqrt18.5%
Simplified18.5%
associate-*l/18.5%
*-commutative18.5%
Applied egg-rr18.5%
sqrt-prod34.6%
Applied egg-rr34.6%
if 2.9e128 < B Initial program 6.4%
associate-*l*6.4%
unpow26.4%
+-commutative6.4%
unpow26.4%
associate-*l*6.4%
unpow26.4%
Simplified6.4%
Taylor expanded in A around 0 6.4%
unpow26.4%
unpow26.4%
hypot-def6.4%
Simplified6.4%
Taylor expanded in C around 0 55.8%
mul-1-neg55.8%
Simplified55.8%
Final simplification31.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -4.5e-7)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B 1.35e+55)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)
(* (sqrt 2.0) (- (sqrt (/ F B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4.5e-7) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= (-4.5d-7)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= 1.35d+55) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4.5e-7) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -4.5e-7: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= 1.35e+55: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -4.5e-7) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.35e+55) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -4.5e-7)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= 1.35e+55)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.5e-7], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -4.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -4.4999999999999998e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -4.4999999999999998e-7 < B < 1.34999999999999988e55Initial program 30.6%
associate-*l*30.6%
unpow230.6%
+-commutative30.6%
unpow230.6%
associate-*l*30.6%
unpow230.6%
Simplified30.6%
Taylor expanded in A around -inf 26.4%
Taylor expanded in F around 0 26.4%
cancel-sign-sub-inv26.4%
metadata-eval26.4%
unpow226.4%
Simplified26.4%
if 1.34999999999999988e55 < B Initial program 14.8%
associate-*l*14.8%
unpow214.8%
+-commutative14.8%
unpow214.8%
associate-*l*14.8%
unpow214.8%
Simplified14.8%
Taylor expanded in A around 0 15.0%
unpow215.0%
unpow215.0%
hypot-def17.0%
Simplified17.0%
Taylor expanded in C around 0 47.2%
mul-1-neg47.2%
Simplified47.2%
Final simplification29.5%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (* 2.0 (* F t_0)))
(t_2
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)))
(if (<= B -9.5e-7)
(/ (- (sqrt (* t_1 (+ A (- C B))))) t_0)
(if (<= B 1.35e+55)
t_2
(if (<= B 8.8e+100)
(/ (- (sqrt (* t_1 (+ B (+ A C))))) t_0)
(if (<= B 5.5e+105) t_2 (/ (* 2.0 (- (sqrt (* C F)))) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double t_2 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -9.5e-7) {
tmp = -sqrt((t_1 * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_2;
} else if (B <= 8.8e+100) {
tmp = -sqrt((t_1 * (B + (A + C)))) / t_0;
} else if (B <= 5.5e+105) {
tmp = t_2;
} else {
tmp = (2.0 * -sqrt((C * F))) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = 2.0d0 * (f * t_0)
t_2 = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
if (b <= (-9.5d-7)) then
tmp = -sqrt((t_1 * (a + (c - b)))) / t_0
else if (b <= 1.35d+55) then
tmp = t_2
else if (b <= 8.8d+100) then
tmp = -sqrt((t_1 * (b + (a + c)))) / t_0
else if (b <= 5.5d+105) then
tmp = t_2
else
tmp = (2.0d0 * -sqrt((c * f))) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (F * t_0);
double t_2 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
double tmp;
if (B <= -9.5e-7) {
tmp = -Math.sqrt((t_1 * (A + (C - B)))) / t_0;
} else if (B <= 1.35e+55) {
tmp = t_2;
} else if (B <= 8.8e+100) {
tmp = -Math.sqrt((t_1 * (B + (A + C)))) / t_0;
} else if (B <= 5.5e+105) {
tmp = t_2;
} else {
tmp = (2.0 * -Math.sqrt((C * F))) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) t_2 = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 tmp = 0 if B <= -9.5e-7: tmp = -math.sqrt((t_1 * (A + (C - B)))) / t_0 elif B <= 1.35e+55: tmp = t_2 elif B <= 8.8e+100: tmp = -math.sqrt((t_1 * (B + (A + C)))) / t_0 elif B <= 5.5e+105: tmp = t_2 else: tmp = (2.0 * -math.sqrt((C * F))) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(2.0 * Float64(F * t_0)) t_2 = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0) tmp = 0.0 if (B <= -9.5e-7) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 1.35e+55) tmp = t_2; elseif (B <= 8.8e+100) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(B + Float64(A + C))))) / t_0); elseif (B <= 5.5e+105) tmp = t_2; else tmp = Float64(Float64(2.0 * Float64(-sqrt(Float64(C * F)))) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = 2.0 * (F * t_0);
t_2 = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
tmp = 0.0;
if (B <= -9.5e-7)
tmp = -sqrt((t_1 * (A + (C - B)))) / t_0;
elseif (B <= 1.35e+55)
tmp = t_2;
elseif (B <= 8.8e+100)
tmp = -sqrt((t_1 * (B + (A + C)))) / t_0;
elseif (B <= 5.5e+105)
tmp = t_2;
else
tmp = (2.0 * -sqrt((C * F))) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -9.5e-7], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.35e+55], t$95$2, If[LessEqual[B, 8.8e+100], N[((-N[Sqrt[N[(t$95$1 * N[(B + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 5.5e+105], t$95$2, N[(N[(2.0 * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
t_2 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -9.5 \cdot 10^{-7}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+55}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 8.8 \cdot 10^{+100}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(B + \left(A + C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 5.5 \cdot 10^{+105}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(-\sqrt{C \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < -9.5000000000000001e-7Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -9.5000000000000001e-7 < B < 1.34999999999999988e55 or 8.8000000000000003e100 < B < 5.49999999999999979e105Initial program 30.2%
associate-*l*30.2%
unpow230.2%
+-commutative30.2%
unpow230.2%
associate-*l*30.2%
unpow230.2%
Simplified30.2%
Taylor expanded in A around -inf 27.4%
Taylor expanded in F around 0 27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
unpow227.4%
Simplified27.4%
if 1.34999999999999988e55 < B < 8.8000000000000003e100Initial program 51.3%
associate-*l*51.3%
unpow251.3%
+-commutative51.3%
unpow251.3%
associate-*l*51.3%
unpow251.3%
Simplified51.3%
Taylor expanded in B around inf 50.6%
associate-+r+50.6%
Simplified50.6%
if 5.49999999999999979e105 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
Taylor expanded in B around 0 9.3%
unpow29.3%
rem-square-sqrt9.3%
Simplified9.3%
associate-*l/9.3%
*-commutative9.3%
Applied egg-rr9.3%
Final simplification24.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.7e-6)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A (- C B))))) t_0)
(if (<= B 2.2e+110)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C)))))))) t_0)
(/ (* 2.0 (- (sqrt (* C F)))) B)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.7e-6) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 2.2e+110) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else {
tmp = (2.0 * -sqrt((C * F))) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= (-1.7d-6)) then
tmp = -sqrt(((2.0d0 * (f * t_0)) * (a + (c - b)))) / t_0
else if (b <= 2.2d+110) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / t_0
else
tmp = (2.0d0 * -sqrt((c * f))) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.7e-6) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
} else if (B <= 2.2e+110) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
} else {
tmp = (2.0 * -Math.sqrt((C * F))) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -1.7e-6: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0 elif B <= 2.2e+110: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0 else: tmp = (2.0 * -math.sqrt((C * F))) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -1.7e-6) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + Float64(C - B))))) / t_0); elseif (B <= 2.2e+110) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0); else tmp = Float64(Float64(2.0 * Float64(-sqrt(Float64(C * F)))) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -1.7e-6)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + (C - B)))) / t_0;
elseif (B <= 2.2e+110)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
else
tmp = (2.0 * -sqrt((C * F))) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.7e-6], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.2e+110], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(2.0 * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.2 \cdot 10^{+110}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(-\sqrt{C \cdot F}\right)}{B}\\
\end{array}
\end{array}
if B < -1.70000000000000003e-6Initial program 25.0%
associate-*l*25.0%
unpow225.0%
+-commutative25.0%
unpow225.0%
associate-*l*25.0%
unpow225.0%
Simplified25.0%
Taylor expanded in B around -inf 22.3%
mul-1-neg22.3%
unsub-neg22.3%
Simplified22.3%
if -1.70000000000000003e-6 < B < 2.19999999999999992e110Initial program 31.6%
associate-*l*31.6%
unpow231.6%
+-commutative31.6%
unpow231.6%
associate-*l*31.6%
unpow231.6%
Simplified31.6%
Taylor expanded in A around -inf 25.9%
Taylor expanded in F around 0 25.9%
cancel-sign-sub-inv25.9%
metadata-eval25.9%
unpow225.9%
Simplified25.9%
if 2.19999999999999992e110 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
Taylor expanded in B around 0 9.3%
unpow29.3%
rem-square-sqrt9.3%
Simplified9.3%
associate-*l/9.3%
*-commutative9.3%
Applied egg-rr9.3%
Final simplification22.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* C F))))
(if (<= B -2.5e+77)
(* (* 2.0 t_0) (/ 1.0 B))
(if (<= B 2.9e+112)
(/
(- (sqrt (* 4.0 (* C (* F (+ (* B B) (* -4.0 (* A C))))))))
(- (* B B) (* 4.0 (* A C))))
(/ (* 2.0 (- t_0)) B)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -2.5e+77) {
tmp = (2.0 * t_0) * (1.0 / B);
} else if (B <= 2.9e+112) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (2.0 * -t_0) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-2.5d+77)) then
tmp = (2.0d0 * t_0) * (1.0d0 / b)
else if (b <= 2.9d+112) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + ((-4.0d0) * (a * c))))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (2.0d0 * -t_0) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -2.5e+77) {
tmp = (2.0 * t_0) * (1.0 / B);
} else if (B <= 2.9e+112) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (2.0 * -t_0) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -2.5e+77: tmp = (2.0 * t_0) * (1.0 / B) elif B <= 2.9e+112: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - (4.0 * (A * C))) else: tmp = (2.0 * -t_0) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -2.5e+77) tmp = Float64(Float64(2.0 * t_0) * Float64(1.0 / B)); elseif (B <= 2.9e+112) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(2.0 * Float64(-t_0)) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -2.5e+77)
tmp = (2.0 * t_0) * (1.0 / B);
elseif (B <= 2.9e+112)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (-4.0 * (A * C))))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = (2.0 * -t_0) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2.5e+77], N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.9e+112], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * (-t$95$0)), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -2.5 \cdot 10^{+77}:\\
\;\;\;\;\left(2 \cdot t_0\right) \cdot \frac{1}{B}\\
\mathbf{elif}\;B \leq 2.9 \cdot 10^{+112}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(-t_0\right)}{B}\\
\end{array}
\end{array}
if B < -2.50000000000000002e77Initial program 12.5%
associate-*l*12.5%
unpow212.5%
+-commutative12.5%
unpow212.5%
associate-*l*12.5%
unpow212.5%
Simplified12.5%
Taylor expanded in A around -inf 3.1%
Taylor expanded in B around -inf 9.8%
associate-*r*9.8%
Simplified9.8%
if -2.50000000000000002e77 < B < 2.9000000000000002e112Initial program 33.8%
associate-*l*33.8%
unpow233.8%
+-commutative33.8%
unpow233.8%
associate-*l*33.8%
unpow233.8%
Simplified33.8%
Taylor expanded in A around -inf 23.8%
Taylor expanded in F around 0 23.8%
cancel-sign-sub-inv23.8%
metadata-eval23.8%
unpow223.8%
Simplified23.8%
if 2.9000000000000002e112 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
Taylor expanded in B around 0 9.3%
unpow29.3%
rem-square-sqrt9.3%
Simplified9.3%
associate-*l/9.3%
*-commutative9.3%
Applied egg-rr9.3%
Final simplification19.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* C F))))
(if (<= B -2.6e+77)
(* (* 2.0 t_0) (/ 1.0 B))
(if (<= B 8.5e+105)
(/ (- (sqrt (* -16.0 (* A (* F (* C C)))))) (- (* B B) (* 4.0 (* A C))))
(/ (* 2.0 (- t_0)) B)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -2.6e+77) {
tmp = (2.0 * t_0) * (1.0 / B);
} else if (B <= 8.5e+105) {
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (2.0 * -t_0) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-2.6d+77)) then
tmp = (2.0d0 * t_0) * (1.0d0 / b)
else if (b <= 8.5d+105) then
tmp = -sqrt(((-16.0d0) * (a * (f * (c * c))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (2.0d0 * -t_0) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -2.6e+77) {
tmp = (2.0 * t_0) * (1.0 / B);
} else if (B <= 8.5e+105) {
tmp = -Math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = (2.0 * -t_0) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -2.6e+77: tmp = (2.0 * t_0) * (1.0 / B) elif B <= 8.5e+105: tmp = -math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C))) else: tmp = (2.0 * -t_0) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -2.6e+77) tmp = Float64(Float64(2.0 * t_0) * Float64(1.0 / B)); elseif (B <= 8.5e+105) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * C)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(Float64(2.0 * Float64(-t_0)) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -2.6e+77)
tmp = (2.0 * t_0) * (1.0 / B);
elseif (B <= 8.5e+105)
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = (2.0 * -t_0) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2.6e+77], N[(N[(2.0 * t$95$0), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 8.5e+105], N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * (-t$95$0)), $MachinePrecision] / B), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -2.6 \cdot 10^{+77}:\\
\;\;\;\;\left(2 \cdot t_0\right) \cdot \frac{1}{B}\\
\mathbf{elif}\;B \leq 8.5 \cdot 10^{+105}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(-t_0\right)}{B}\\
\end{array}
\end{array}
if B < -2.6000000000000002e77Initial program 12.5%
associate-*l*12.5%
unpow212.5%
+-commutative12.5%
unpow212.5%
associate-*l*12.5%
unpow212.5%
Simplified12.5%
Taylor expanded in A around -inf 3.1%
Taylor expanded in B around -inf 9.8%
associate-*r*9.8%
Simplified9.8%
if -2.6000000000000002e77 < B < 8.49999999999999986e105Initial program 33.8%
associate-*l*33.8%
unpow233.8%
+-commutative33.8%
unpow233.8%
associate-*l*33.8%
unpow233.8%
Simplified33.8%
Taylor expanded in A around -inf 23.8%
Taylor expanded in B around 0 16.0%
unpow216.0%
Simplified16.0%
if 8.49999999999999986e105 < B Initial program 5.8%
Simplified5.8%
Taylor expanded in A around 0 15.5%
mul-1-neg15.5%
*-commutative15.5%
unpow215.5%
unpow215.5%
Simplified15.5%
Taylor expanded in B around 0 9.3%
unpow29.3%
rem-square-sqrt9.3%
Simplified9.3%
associate-*l/9.3%
*-commutative9.3%
Applied egg-rr9.3%
Final simplification14.0%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -1.5e-296) (* (* 2.0 (sqrt (* C F))) (/ 1.0 B)) (/ (* 2.0 (- (pow (* C F) 0.5))) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.5e-296) {
tmp = (2.0 * sqrt((C * F))) * (1.0 / B);
} else {
tmp = (2.0 * -pow((C * F), 0.5)) / B;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-1.5d-296)) then
tmp = (2.0d0 * sqrt((c * f))) * (1.0d0 / b)
else
tmp = (2.0d0 * -((c * f) ** 0.5d0)) / b
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.5e-296) {
tmp = (2.0 * Math.sqrt((C * F))) * (1.0 / B);
} else {
tmp = (2.0 * -Math.pow((C * F), 0.5)) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -1.5e-296: tmp = (2.0 * math.sqrt((C * F))) * (1.0 / B) else: tmp = (2.0 * -math.pow((C * F), 0.5)) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -1.5e-296) tmp = Float64(Float64(2.0 * sqrt(Float64(C * F))) * Float64(1.0 / B)); else tmp = Float64(Float64(2.0 * Float64(-(Float64(C * F) ^ 0.5))) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.5e-296)
tmp = (2.0 * sqrt((C * F))) * (1.0 / B);
else
tmp = (2.0 * -((C * F) ^ 0.5)) / B;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -1.5e-296], N[(N[(2.0 * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 * (-N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.5 \cdot 10^{-296}:\\
\;\;\;\;\left(2 \cdot \sqrt{C \cdot F}\right) \cdot \frac{1}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \left(-{\left(C \cdot F\right)}^{0.5}\right)}{B}\\
\end{array}
\end{array}
if B < -1.4999999999999999e-296Initial program 25.9%
associate-*l*25.9%
unpow225.9%
+-commutative25.9%
unpow225.9%
associate-*l*25.9%
unpow225.9%
Simplified25.9%
Taylor expanded in A around -inf 15.7%
Taylor expanded in B around -inf 5.3%
associate-*r*5.3%
Simplified5.3%
if -1.4999999999999999e-296 < B Initial program 26.4%
Simplified30.5%
Taylor expanded in A around 0 17.1%
mul-1-neg17.1%
*-commutative17.1%
unpow217.1%
unpow217.1%
Simplified17.1%
Taylor expanded in B around 0 4.9%
unpow24.9%
rem-square-sqrt4.9%
Simplified4.9%
associate-*l/4.9%
*-commutative4.9%
Applied egg-rr4.9%
pow1/25.1%
Applied egg-rr5.1%
Final simplification5.1%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (pow (* C F) 0.5))))
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -pow((C * F), 0.5);
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (2.0d0 / b) * -((c * f) ** 0.5d0)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.pow((C * F), 0.5);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 / B) * -math.pow((C * F), 0.5)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-(Float64(C * F) ^ 0.5))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 / B) * -((C * F) ^ 0.5);
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2}{B} \cdot \left(-{\left(C \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 26.2%
Simplified30.0%
Taylor expanded in A around 0 9.5%
mul-1-neg9.5%
*-commutative9.5%
unpow29.5%
unpow29.5%
Simplified9.5%
Taylor expanded in B around 0 3.0%
unpow23.0%
rem-square-sqrt3.0%
Simplified3.0%
pow1/23.2%
*-commutative3.2%
Applied egg-rr3.2%
Final simplification3.2%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (* 2.0 (- (pow (* C F) 0.5))) B))
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 * -pow((C * F), 0.5)) / B;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (2.0d0 * -((c * f) ** 0.5d0)) / b
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 * -Math.pow((C * F), 0.5)) / B;
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 * -math.pow((C * F), 0.5)) / B
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 * Float64(-(Float64(C * F) ^ 0.5))) / B) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 * -((C * F) ^ 0.5)) / B;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 * (-N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2 \cdot \left(-{\left(C \cdot F\right)}^{0.5}\right)}{B}
\end{array}
Initial program 26.2%
Simplified30.0%
Taylor expanded in A around 0 9.5%
mul-1-neg9.5%
*-commutative9.5%
unpow29.5%
unpow29.5%
Simplified9.5%
Taylor expanded in B around 0 3.0%
unpow23.0%
rem-square-sqrt3.0%
Simplified3.0%
associate-*l/3.0%
*-commutative3.0%
Applied egg-rr3.0%
pow1/23.2%
Applied egg-rr3.2%
Final simplification3.2%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (sqrt (* C F)))))
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -sqrt((C * F));
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (2.0d0 / b) * -sqrt((c * f))
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.sqrt((C * F));
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 / B) * -math.sqrt((C * F))
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-sqrt(Float64(C * F)))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 / B) * -sqrt((C * F));
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2}{B} \cdot \left(-\sqrt{C \cdot F}\right)
\end{array}
Initial program 26.2%
Simplified30.0%
Taylor expanded in A around 0 9.5%
mul-1-neg9.5%
*-commutative9.5%
unpow29.5%
unpow29.5%
Simplified9.5%
Taylor expanded in B around 0 3.0%
unpow23.0%
rem-square-sqrt3.0%
Simplified3.0%
Final simplification3.0%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (* 2.0 (- (sqrt (* C F)))) B))
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 * -sqrt((C * F))) / B;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (2.0d0 * -sqrt((c * f))) / b
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 * -Math.sqrt((C * F))) / B;
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 * -math.sqrt((C * F))) / B
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 * Float64(-sqrt(Float64(C * F)))) / B) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 * -sqrt((C * F))) / B;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 * (-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2 \cdot \left(-\sqrt{C \cdot F}\right)}{B}
\end{array}
Initial program 26.2%
Simplified30.0%
Taylor expanded in A around 0 9.5%
mul-1-neg9.5%
*-commutative9.5%
unpow29.5%
unpow29.5%
Simplified9.5%
Taylor expanded in B around 0 3.0%
unpow23.0%
rem-square-sqrt3.0%
Simplified3.0%
associate-*l/3.0%
*-commutative3.0%
Applied egg-rr3.0%
Final simplification3.0%
herbie shell --seed 2023189
(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))))