
(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 22 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 (- (* B B) (* 4.0 (* A C)))))
(if (<= (pow B 2.0) 5e-141)
(/ (- (sqrt (* 2.0 (* (* t_0 F) (* 2.0 A))))) t_0)
(if (<= (pow B 2.0) 1e+305)
(/
(*
(sqrt (* 2.0 (* F (+ A (- C (hypot (- A C) B))))))
(- (sqrt (fma B B (* C (* A -4.0))))))
(fma B B (* A (* C -4.0))))
(/ (* (sqrt (* F (- A (hypot B A)))) (- (sqrt 2.0))) 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 (pow(B, 2.0) <= 5e-141) {
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else if (pow(B, 2.0) <= 1e+305) {
tmp = (sqrt((2.0 * (F * (A + (C - hypot((A - C), B)))))) * -sqrt(fma(B, B, (C * (A * -4.0))))) / fma(B, B, (A * (C * -4.0)));
} else {
tmp = (sqrt((F * (A - hypot(B, A)))) * -sqrt(2.0)) / 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.0) <= 5e-141) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(2.0 * A))))) / t_0); elseif ((B ^ 2.0) <= 1e+305) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(A + Float64(C - hypot(Float64(A - C), B)))))) * Float64(-sqrt(fma(B, B, Float64(C * Float64(A * -4.0)))))) / fma(B, B, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(-sqrt(2.0))) / 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]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 5e-141], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e+305], N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(A + N[(C - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $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}^{2} \leq 5 \cdot 10^{-141}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 10^{+305}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)} \cdot \left(-\sqrt{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \left(-\sqrt{2}\right)}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.9999999999999999e-141Initial program 18.3%
Simplified18.3%
Taylor expanded in A around -inf 29.6%
*-commutative29.6%
Simplified29.6%
if 4.9999999999999999e-141 < (pow.f64 B 2) < 9.9999999999999994e304Initial program 39.5%
Simplified44.7%
sqrt-prod55.8%
associate-*r*55.8%
*-commutative55.8%
associate-*l*55.8%
associate--r-56.3%
+-commutative56.3%
Applied egg-rr56.3%
hypot-def49.9%
unpow249.9%
unpow249.9%
+-commutative49.9%
unpow249.9%
unpow249.9%
hypot-def56.3%
Simplified56.3%
if 9.9999999999999994e304 < (pow.f64 B 2) Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
+-commutative0.0%
unpow20.0%
unpow20.0%
hypot-def0.0%
Simplified0.0%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
unpow21.7%
unpow21.7%
hypot-def23.4%
Simplified23.4%
associate-*l/23.5%
*-commutative23.5%
Applied egg-rr23.5%
Final simplification36.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 (sqrt (* F (- A (hypot B A))))))
(if (<= B -8e-71)
(*
(* (sqrt 2.0) (* t_1 (sqrt (fma B B (* A (* C -4.0))))))
(/ -1.0 (+ (* B B) (* (* A C) -4.0))))
(if (<= B 5.6e-76)
(/ (- (sqrt (* 2.0 (* (* t_0 F) (* 2.0 A))))) t_0)
(/ (* t_1 (- (sqrt 2.0))) 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((F * (A - hypot(B, A))));
double tmp;
if (B <= -8e-71) {
tmp = (sqrt(2.0) * (t_1 * sqrt(fma(B, B, (A * (C * -4.0)))))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
} else if (B <= 5.6e-76) {
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else {
tmp = (t_1 * -sqrt(2.0)) / 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 = sqrt(Float64(F * Float64(A - hypot(B, A)))) tmp = 0.0 if (B <= -8e-71) tmp = Float64(Float64(sqrt(2.0) * Float64(t_1 * sqrt(fma(B, B, Float64(A * Float64(C * -4.0)))))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)))); elseif (B <= 5.6e-76) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(t_1 * Float64(-sqrt(2.0))) / 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[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -8e-71], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(t$95$1 * N[Sqrt[N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 5.6e-76], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(t$95$1 * (-N[Sqrt[2.0], $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 := \sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}\\
\mathbf{if}\;B \leq -8 \cdot 10^{-71}:\\
\;\;\;\;\left(\sqrt{2} \cdot \left(t_1 \cdot \sqrt{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\right)\right) \cdot \frac{-1}{B \cdot B + \left(A \cdot C\right) \cdot -4}\\
\mathbf{elif}\;B \leq 5.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_1 \cdot \left(-\sqrt{2}\right)}{B}\\
\end{array}
\end{array}
if B < -7.9999999999999993e-71Initial program 21.3%
Simplified21.3%
Taylor expanded in C around 0 18.0%
+-commutative18.0%
unpow218.0%
unpow218.0%
hypot-def19.3%
Simplified19.3%
div-inv19.4%
associate-*l*19.4%
cancel-sign-sub-inv19.4%
metadata-eval19.4%
cancel-sign-sub-inv19.4%
metadata-eval19.4%
Applied egg-rr19.4%
sqrt-prod19.4%
metadata-eval19.4%
cancel-sign-sub-inv19.4%
*-commutative19.4%
cancel-sign-sub-inv19.4%
metadata-eval19.4%
fma-def19.4%
Applied egg-rr19.4%
*-commutative19.4%
*-commutative19.4%
hypot-def18.0%
unpow218.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
unpow218.0%
hypot-def19.4%
Simplified19.4%
sqrt-prod23.3%
associate-*l*23.3%
Applied egg-rr23.3%
if -7.9999999999999993e-71 < B < 5.6000000000000002e-76Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 5.6000000000000002e-76 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
associate-*l/50.2%
*-commutative50.2%
Applied egg-rr50.2%
Final simplification33.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) (* (* A C) -4.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -3e+152)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -4e-92)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
(if (<= B 2.75e-75)
(/ (- (sqrt (* 2.0 (* (* t_1 F) (* 2.0 A))))) t_1)
(* (sqrt (* F (- A (hypot A B)))) (/ (- (sqrt 2.0)) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -3e+152) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -4e-92) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = sqrt((F * (A - hypot(A, B)))) * (-sqrt(2.0) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -3e+152) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -4e-92) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + (C - Math.hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -Math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = Math.sqrt((F * (A - Math.hypot(A, B)))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + ((A * C) * -4.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -3e+152: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -4e-92: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + (C - math.hypot(B, (A - C)))))))) / t_0 elif B <= 2.75e-75: tmp = -math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1 else: tmp = math.sqrt((F * (A - math.hypot(A, B)))) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -3e+152) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -4e-92) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0); elseif (B <= 2.75e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * F) * Float64(2.0 * A))))) / t_1); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + ((A * C) * -4.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -3e+152)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -4e-92)
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
elseif (B <= 2.75e-75)
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
else
tmp = sqrt((F * (A - hypot(A, B)))) * (-sqrt(2.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[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -3e+152], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -4e-92], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.75e-75], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + \left(A \cdot C\right) \cdot -4\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -3 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -4 \cdot 10^{-92}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_1 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -2.99999999999999991e152Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.99999999999999991e152 < B < -3.99999999999999995e-92Initial program 31.8%
Simplified31.7%
distribute-frac-neg31.7%
Applied egg-rr40.8%
if -3.99999999999999995e-92 < B < 2.75000000000000013e-75Initial program 19.2%
Simplified19.2%
Taylor expanded in A around -inf 30.9%
*-commutative30.9%
Simplified30.9%
if 2.75000000000000013e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
*-commutative31.6%
+-commutative31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Final simplification35.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 (+ (* B B) (* (* A C) -4.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -7e+142)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -4.8e-93)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
(if (<= B 2.4e-75)
(/ (- (sqrt (* 2.0 (* (* t_1 F) (* 2.0 A))))) t_1)
(/ (* (sqrt (* F (- A (hypot B A)))) (- (sqrt 2.0))) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -7e+142) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -4.8e-93) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.4e-75) {
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = (sqrt((F * (A - hypot(B, A)))) * -sqrt(2.0)) / B;
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -7e+142) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -4.8e-93) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + (C - Math.hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.4e-75) {
tmp = -Math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = (Math.sqrt((F * (A - Math.hypot(B, A)))) * -Math.sqrt(2.0)) / B;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + ((A * C) * -4.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -7e+142: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -4.8e-93: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + (C - math.hypot(B, (A - C)))))))) / t_0 elif B <= 2.4e-75: tmp = -math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1 else: tmp = (math.sqrt((F * (A - math.hypot(B, A)))) * -math.sqrt(2.0)) / B return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -7e+142) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -4.8e-93) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0); elseif (B <= 2.4e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * F) * Float64(2.0 * A))))) / t_1); else tmp = Float64(Float64(sqrt(Float64(F * Float64(A - hypot(B, A)))) * Float64(-sqrt(2.0))) / B); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + ((A * C) * -4.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -7e+142)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -4.8e-93)
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
elseif (B <= 2.4e-75)
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
else
tmp = (sqrt((F * (A - hypot(B, A)))) * -sqrt(2.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[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -7e+142], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -4.8e-93], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.4e-75], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[N[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision] / B), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + \left(A \cdot C\right) \cdot -4\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -7 \cdot 10^{+142}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -4.8 \cdot 10^{-93}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.4 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_1 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)} \cdot \left(-\sqrt{2}\right)}{B}\\
\end{array}
\end{array}
if B < -6.99999999999999995e142Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -6.99999999999999995e142 < B < -4.8000000000000002e-93Initial program 31.8%
Simplified31.7%
distribute-frac-neg31.7%
Applied egg-rr40.8%
if -4.8000000000000002e-93 < B < 2.40000000000000019e-75Initial program 19.2%
Simplified19.2%
Taylor expanded in A around -inf 30.9%
*-commutative30.9%
Simplified30.9%
if 2.40000000000000019e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
associate-*l/50.2%
*-commutative50.2%
Applied egg-rr50.2%
Final simplification35.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 (+ (* B B) (* (* A C) -4.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.4e+148)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -3.6e-92)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C))))))))) t_0)
(if (<= B 2.75e-75)
(/ (- (sqrt (* 2.0 (* (* t_1 F) (* 2.0 A))))) t_1)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A B))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.4e+148) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -3.6e-92) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - B)));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.4e+148) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -3.6e-92) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + (C - Math.hypot(B, (A - C)))))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -Math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + ((A * C) * -4.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -2.4e+148: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -3.6e-92: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + (C - math.hypot(B, (A - C)))))))) / t_0 elif B <= 2.75e-75: tmp = -math.sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - B))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.4e+148) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -3.6e-92) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_0); elseif (B <= 2.75e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_1 * F) * Float64(2.0 * A))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - B))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + ((A * C) * -4.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -2.4e+148)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -3.6e-92)
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / t_0;
elseif (B <= 2.75e-75)
tmp = -sqrt((2.0 * ((t_1 * F) * (2.0 * A)))) / t_1;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.4e+148], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -3.6e-92], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.75e-75], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$1 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + \left(A \cdot C\right) \cdot -4\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.4 \cdot 10^{+148}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -3.6 \cdot 10^{-92}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_1 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < -2.39999999999999995e148Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.39999999999999995e148 < B < -3.60000000000000016e-92Initial program 31.8%
Simplified31.7%
distribute-frac-neg31.7%
Applied egg-rr40.8%
if -3.60000000000000016e-92 < B < 2.75000000000000013e-75Initial program 19.2%
Simplified19.2%
Taylor expanded in A around -inf 30.9%
*-commutative30.9%
Simplified30.9%
if 2.75000000000000013e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.5%
mul-1-neg47.5%
unsub-neg47.5%
Simplified47.5%
Final simplification34.3%
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 (* t_0 F)))
(if (<= B -1.65e+152)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -7.5e-71)
(/ (- (sqrt (* 2.0 (* t_1 (- A (hypot A B)))))) t_0)
(if (<= B 2.75e-75)
(/ (- (sqrt (* 2.0 (* t_1 (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A 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 = t_0 * F;
double tmp;
if (B <= -1.65e+152) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -7.5e-71) {
tmp = -sqrt((2.0 * (t_1 * (A - hypot(A, B))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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 = t_0 * F;
double tmp;
if (B <= -1.65e+152) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -7.5e-71) {
tmp = -Math.sqrt((2.0 * (t_1 * (A - Math.hypot(A, B))))) / t_0;
} else if (B <= 2.75e-75) {
tmp = -Math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = t_0 * F tmp = 0 if B <= -1.65e+152: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -7.5e-71: tmp = -math.sqrt((2.0 * (t_1 * (A - math.hypot(A, B))))) / t_0 elif B <= 2.75e-75: tmp = -math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - 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(t_0 * F) tmp = 0.0 if (B <= -1.65e+152) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -7.5e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A - hypot(A, B)))))) / t_0); elseif (B <= 2.75e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - 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 = t_0 * F;
tmp = 0.0;
if (B <= -1.65e+152)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -7.5e-71)
tmp = -sqrt((2.0 * (t_1 * (A - hypot(A, B))))) / t_0;
elseif (B <= 2.75e-75)
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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[(t$95$0 * F), $MachinePrecision]}, If[LessEqual[B, -1.65e+152], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7.5e-71], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.75e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $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 := t_0 \cdot F\\
\mathbf{if}\;B \leq -1.65 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -7.5 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < -1.6500000000000001e152Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -1.6500000000000001e152 < B < -7.5000000000000004e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in C around 0 32.1%
+-commutative32.1%
unpow232.1%
unpow232.1%
hypot-def34.5%
Simplified34.5%
if -7.5000000000000004e-71 < B < 2.75000000000000013e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 2.75000000000000013e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.5%
mul-1-neg47.5%
unsub-neg47.5%
Simplified47.5%
Final simplification32.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 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.5e+152)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.5e-71)
(*
(sqrt (* 2.0 (* (- A (hypot B A)) (* (* B B) F))))
(/ -1.0 (+ (* B B) (* (* A C) -4.0))))
(if (<= B 1.7e-75)
(/ (- (sqrt (* 2.0 (* (* t_0 F) (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A 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.5e+152) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = sqrt((2.0 * ((A - hypot(B, A)) * ((B * B) * F)))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
} else if (B <= 1.7e-75) {
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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.5e+152) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = Math.sqrt((2.0 * ((A - Math.hypot(B, A)) * ((B * B) * F)))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
} else if (B <= 1.7e-75) {
tmp = -Math.sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - 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.5e+152: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.5e-71: tmp = math.sqrt((2.0 * ((A - math.hypot(B, A)) * ((B * B) * F)))) * (-1.0 / ((B * B) + ((A * C) * -4.0))) elif B <= 1.7e-75: tmp = -math.sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - 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.5e+152) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.5e-71) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(A - hypot(B, A)) * Float64(Float64(B * B) * F)))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)))); elseif (B <= 1.7e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - 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.5e+152)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.5e-71)
tmp = sqrt((2.0 * ((A - hypot(B, A)) * ((B * B) * F)))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
elseif (B <= 1.7e-75)
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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.5e+152], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e-71], N[(N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.7e-75], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $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)\\
\mathbf{if}\;B \leq -2.5 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-71}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(\left(B \cdot B\right) \cdot F\right)\right)} \cdot \frac{-1}{B \cdot B + \left(A \cdot C\right) \cdot -4}\\
\mathbf{elif}\;B \leq 1.7 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < -2.5e152Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.5e152 < B < -8.49999999999999988e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in C around 0 32.1%
+-commutative32.1%
unpow232.1%
unpow232.1%
hypot-def34.5%
Simplified34.5%
div-inv34.6%
associate-*l*34.6%
cancel-sign-sub-inv34.6%
metadata-eval34.6%
cancel-sign-sub-inv34.6%
metadata-eval34.6%
Applied egg-rr34.6%
Taylor expanded in C around 0 32.3%
*-commutative32.3%
unpow232.3%
unpow232.3%
unpow232.3%
hypot-def35.0%
Simplified35.0%
if -8.49999999999999988e-71 < B < 1.70000000000000008e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 1.70000000000000008e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.5%
mul-1-neg47.5%
unsub-neg47.5%
Simplified47.5%
Final simplification32.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 -5.7e+144)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.5e-71)
(/ (- (sqrt (* 2.0 (* (- A (hypot A B)) (* (* B B) F))))) t_0)
(if (<= B 1.25e-75)
(/ (- (sqrt (* 2.0 (* (* t_0 F) (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A 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 <= -5.7e+144) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * ((B * B) * F)))) / t_0;
} else if (B <= 1.25e-75) {
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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 <= -5.7e+144) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -Math.sqrt((2.0 * ((A - Math.hypot(A, B)) * ((B * B) * F)))) / t_0;
} else if (B <= 1.25e-75) {
tmp = -Math.sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - 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 <= -5.7e+144: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.5e-71: tmp = -math.sqrt((2.0 * ((A - math.hypot(A, B)) * ((B * B) * F)))) / t_0 elif B <= 1.25e-75: tmp = -math.sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - 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 <= -5.7e+144) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.5e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(A, B)) * Float64(Float64(B * B) * F))))) / t_0); elseif (B <= 1.25e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - 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 <= -5.7e+144)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.5e-71)
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * ((B * B) * F)))) / t_0;
elseif (B <= 1.25e-75)
tmp = -sqrt((2.0 * ((t_0 * F) * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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, -5.7e+144], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e-71], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.25e-75], N[((-N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $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)\\
\mathbf{if}\;B \leq -5.7 \cdot 10^{+144}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(\left(B \cdot B\right) \cdot F\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.25 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < -5.70000000000000005e144Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -5.70000000000000005e144 < B < -8.49999999999999988e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in C around 0 32.1%
+-commutative32.1%
unpow232.1%
unpow232.1%
hypot-def34.5%
Simplified34.5%
Taylor expanded in B around inf 34.9%
unpow234.9%
Simplified34.9%
if -8.49999999999999988e-71 < B < 1.24999999999999995e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 1.24999999999999995e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.5%
mul-1-neg47.5%
unsub-neg47.5%
Simplified47.5%
Final simplification32.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)))) (t_1 (* t_0 F)))
(if (<= B -1.9e+147)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.5e-71)
(- (/ (sqrt (* 2.0 (* t_1 (+ A (+ B C))))) t_0))
(if (<= B 2.4e-75)
(/ (- (sqrt (* 2.0 (* t_1 (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A 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 = t_0 * F;
double tmp;
if (B <= -1.9e+147) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 2.4e-75) {
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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 = t_0 * f
if (b <= (-1.9d+147)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-8.5d-71)) then
tmp = -(sqrt((2.0d0 * (t_1 * (a + (b + c))))) / t_0)
else if (b <= 2.4d-75) then
tmp = -sqrt((2.0d0 * (t_1 * (2.0d0 * a)))) / t_0
else
tmp = (sqrt(2.0d0) / b) * -sqrt((f * (a - 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 = t_0 * F;
double tmp;
if (B <= -1.9e+147) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 2.4e-75) {
tmp = -Math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = t_0 * F tmp = 0 if B <= -1.9e+147: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.5e-71: tmp = -(math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0) elif B <= 2.4e-75: tmp = -math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - 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(t_0 * F) tmp = 0.0 if (B <= -1.9e+147) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.5e-71) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C))))) / t_0)); elseif (B <= 2.4e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - 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 = t_0 * F;
tmp = 0.0;
if (B <= -1.9e+147)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.5e-71)
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
elseif (B <= 2.4e-75)
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - 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[(t$95$0 * F), $MachinePrecision]}, If[LessEqual[B, -1.9e+147], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e-71], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 2.4e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $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 := t_0 \cdot F\\
\mathbf{if}\;B \leq -1.9 \cdot 10^{+147}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-71}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.4 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < -1.89999999999999985e147Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -1.89999999999999985e147 < B < -8.49999999999999988e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in B around -inf 34.5%
if -8.49999999999999988e-71 < B < 2.40000000000000019e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 2.40000000000000019e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.5%
mul-1-neg47.5%
unsub-neg47.5%
Simplified47.5%
Final simplification32.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 (- (* B B) (* 4.0 (* A C)))) (t_1 (* t_0 F)))
(if (<= B -9.8e+151)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.5e-71)
(- (/ (sqrt (* 2.0 (* t_1 (+ A (+ B C))))) t_0))
(if (<= B 2.75e-75)
(/ (- (sqrt (* 2.0 (* t_1 (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* B (- F))))))))))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 = t_0 * F;
double tmp;
if (B <= -9.8e+151) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 2.75e-75) {
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * -F));
}
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 = t_0 * f
if (b <= (-9.8d+151)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-8.5d-71)) then
tmp = -(sqrt((2.0d0 * (t_1 * (a + (b + c))))) / t_0)
else if (b <= 2.75d-75) then
tmp = -sqrt((2.0d0 * (t_1 * (2.0d0 * a)))) / t_0
else
tmp = (sqrt(2.0d0) / b) * -sqrt((b * -f))
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 = t_0 * F;
double tmp;
if (B <= -9.8e+151) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 2.75e-75) {
tmp = -Math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * -F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = t_0 * F tmp = 0 if B <= -9.8e+151: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.5e-71: tmp = -(math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0) elif B <= 2.75e-75: tmp = -math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * -F)) 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(t_0 * F) tmp = 0.0 if (B <= -9.8e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.5e-71) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C))))) / t_0)); elseif (B <= 2.75e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * Float64(-F))))); 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 = t_0 * F;
tmp = 0.0;
if (B <= -9.8e+151)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.5e-71)
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
elseif (B <= 2.75e-75)
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((B * -F));
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[(t$95$0 * F), $MachinePrecision]}, If[LessEqual[B, -9.8e+151], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e-71], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 2.75e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * (-F)), $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 := t_0 \cdot F\\
\mathbf{if}\;B \leq -9.8 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-71}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot \left(-F\right)}\right)\\
\end{array}
\end{array}
if B < -9.7999999999999998e151Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -9.7999999999999998e151 < B < -8.49999999999999988e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in B around -inf 34.5%
if -8.49999999999999988e-71 < B < 2.75000000000000013e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 2.75000000000000013e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in C around 0 24.0%
+-commutative24.0%
unpow224.0%
unpow224.0%
hypot-def23.9%
Simplified23.9%
Taylor expanded in C around 0 31.6%
mul-1-neg31.6%
unpow231.6%
unpow231.6%
hypot-def50.1%
Simplified50.1%
Taylor expanded in A around 0 47.8%
mul-1-neg47.8%
Simplified47.8%
Final simplification32.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)))) (t_1 (* t_0 F)))
(if (<= B -2.7e+152)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.2e-71)
(- (/ (sqrt (* 2.0 (* t_1 (+ A (+ B C))))) t_0))
(if (<= B 5.6e-76)
(/ (- (sqrt (* 2.0 (* t_1 (* 2.0 A))))) t_0)
(/ (- (sqrt (* 2.0 (* t_1 (- (+ A C) B))))) t_0))))))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 = t_0 * F;
double tmp;
if (B <= -2.7e+152) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.2e-71) {
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 5.6e-76) {
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = -sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
}
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 = t_0 * f
if (b <= (-2.7d+152)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-8.2d-71)) then
tmp = -(sqrt((2.0d0 * (t_1 * (a + (b + c))))) / t_0)
else if (b <= 5.6d-76) then
tmp = -sqrt((2.0d0 * (t_1 * (2.0d0 * a)))) / t_0
else
tmp = -sqrt((2.0d0 * (t_1 * ((a + c) - b)))) / t_0
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 = t_0 * F;
double tmp;
if (B <= -2.7e+152) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.2e-71) {
tmp = -(Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
} else if (B <= 5.6e-76) {
tmp = -Math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = t_0 * F tmp = 0 if B <= -2.7e+152: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.2e-71: tmp = -(math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0) elif B <= 5.6e-76: tmp = -math.sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0 else: tmp = -math.sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0 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(t_0 * F) tmp = 0.0 if (B <= -2.7e+152) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.2e-71) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C))))) / t_0)); elseif (B <= 5.6e-76) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(Float64(A + C) - B))))) / t_0); 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 = t_0 * F;
tmp = 0.0;
if (B <= -2.7e+152)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.2e-71)
tmp = -(sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0);
elseif (B <= 5.6e-76)
tmp = -sqrt((2.0 * (t_1 * (2.0 * A)))) / t_0;
else
tmp = -sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
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[(t$95$0 * F), $MachinePrecision]}, If[LessEqual[B, -2.7e+152], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.2e-71], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 5.6e-76], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(N[(A + C), $MachinePrecision] - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $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 := t_0 \cdot F\\
\mathbf{if}\;B \leq -2.7 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.2 \cdot 10^{-71}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 5.6 \cdot 10^{-76}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(\left(A + C\right) - B\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -2.70000000000000015e152Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.70000000000000015e152 < B < -8.19999999999999987e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in B around -inf 34.5%
if -8.19999999999999987e-71 < B < 5.6000000000000002e-76Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 5.6000000000000002e-76 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in B around inf 21.9%
Final simplification25.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 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)) (t_2 (* t_1 F)))
(if (<= B -5.1e+144)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -6.8e-71)
(/ (- (sqrt (* 2.0 (* B t_2)))) t_1)
(if (<= B 1.85e-75)
(/ (- (sqrt (* 2.0 (* t_2 (* 2.0 A))))) t_1)
(- (/ (sqrt (* 2.0 (* B (* F (- t_0 (* B B)))))) t_1)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -5.1e+144) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -sqrt((2.0 * (B * t_2))) / t_1;
} else if (B <= 1.85e-75) {
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
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 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
t_2 = t_1 * f
if (b <= (-5.1d+144)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-6.8d-71)) then
tmp = -sqrt((2.0d0 * (b * t_2))) / t_1
else if (b <= 1.85d-75) then
tmp = -sqrt((2.0d0 * (t_2 * (2.0d0 * a)))) / t_1
else
tmp = -(sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -5.1e+144) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -Math.sqrt((2.0 * (B * t_2))) / t_1;
} else if (B <= 1.85e-75) {
tmp = -Math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 t_2 = t_1 * F tmp = 0 if B <= -5.1e+144: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -6.8e-71: tmp = -math.sqrt((2.0 * (B * t_2))) / t_1 elif B <= 1.85e-75: tmp = -math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1 else: tmp = -(math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) t_2 = Float64(t_1 * F) tmp = 0.0 if (B <= -5.1e+144) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -6.8e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * t_2)))) / t_1); elseif (B <= 1.85e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * A))))) / t_1); else tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B)))))) / t_1)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
t_2 = t_1 * F;
tmp = 0.0;
if (B <= -5.1e+144)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -6.8e-71)
tmp = -sqrt((2.0 * (B * t_2))) / t_1;
elseif (B <= 1.85e-75)
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
else
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * F), $MachinePrecision]}, If[LessEqual[B, -5.1e+144], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -6.8e-71], N[((-N[Sqrt[N[(2.0 * N[(B * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.85e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
t_2 := t_1 \cdot F\\
\mathbf{if}\;B \leq -5.1 \cdot 10^{+144}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -6.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot t_2\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.85 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -5.0999999999999999e144Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -5.0999999999999999e144 < B < -6.80000000000000007e-71Initial program 37.2%
Simplified37.2%
Taylor expanded in A around 0 37.4%
+-commutative37.4%
unpow237.4%
unpow237.4%
hypot-def37.6%
Simplified37.6%
Taylor expanded in B around -inf 31.7%
if -6.80000000000000007e-71 < B < 1.85000000000000012e-75Initial program 17.9%
Simplified17.9%
Taylor expanded in A around -inf 30.6%
*-commutative30.6%
Simplified30.6%
if 1.85000000000000012e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in A around 0 21.2%
+-commutative21.2%
unpow221.2%
unpow221.2%
hypot-def25.4%
Simplified25.4%
Taylor expanded in C around 0 21.5%
mul-1-neg21.5%
Simplified21.5%
Final simplification25.0%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)) (t_2 (* t_1 F)))
(if (<= B -3.55e+143)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -6.8e-71)
(/ (- (sqrt (* 2.0 (* t_2 (+ B C))))) t_1)
(if (<= B 2.75e-75)
(/ (- (sqrt (* 2.0 (* t_2 (* 2.0 A))))) t_1)
(- (/ (sqrt (* 2.0 (* B (* F (- t_0 (* B B)))))) t_1)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -3.55e+143) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -sqrt((2.0 * (t_2 * (B + C)))) / t_1;
} else if (B <= 2.75e-75) {
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
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 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
t_2 = t_1 * f
if (b <= (-3.55d+143)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-6.8d-71)) then
tmp = -sqrt((2.0d0 * (t_2 * (b + c)))) / t_1
else if (b <= 2.75d-75) then
tmp = -sqrt((2.0d0 * (t_2 * (2.0d0 * a)))) / t_1
else
tmp = -(sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -3.55e+143) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -Math.sqrt((2.0 * (t_2 * (B + C)))) / t_1;
} else if (B <= 2.75e-75) {
tmp = -Math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 t_2 = t_1 * F tmp = 0 if B <= -3.55e+143: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -6.8e-71: tmp = -math.sqrt((2.0 * (t_2 * (B + C)))) / t_1 elif B <= 2.75e-75: tmp = -math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1 else: tmp = -(math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) t_2 = Float64(t_1 * F) tmp = 0.0 if (B <= -3.55e+143) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -6.8e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(B + C))))) / t_1); elseif (B <= 2.75e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * A))))) / t_1); else tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B)))))) / t_1)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
t_2 = t_1 * F;
tmp = 0.0;
if (B <= -3.55e+143)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -6.8e-71)
tmp = -sqrt((2.0 * (t_2 * (B + C)))) / t_1;
elseif (B <= 2.75e-75)
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
else
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * F), $MachinePrecision]}, If[LessEqual[B, -3.55e+143], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -6.8e-71], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 2.75e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
t_2 := t_1 \cdot F\\
\mathbf{if}\;B \leq -3.55 \cdot 10^{+143}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -6.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(B + C\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.75 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -3.55000000000000021e143Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -3.55000000000000021e143 < B < -6.80000000000000007e-71Initial program 37.2%
Simplified37.2%
Taylor expanded in A around 0 37.4%
+-commutative37.4%
unpow237.4%
unpow237.4%
hypot-def37.6%
Simplified37.6%
Taylor expanded in B around -inf 33.8%
if -6.80000000000000007e-71 < B < 2.75000000000000013e-75Initial program 17.9%
Simplified17.9%
Taylor expanded in A around -inf 30.6%
*-commutative30.6%
Simplified30.6%
if 2.75000000000000013e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in A around 0 21.2%
+-commutative21.2%
unpow221.2%
unpow221.2%
hypot-def25.4%
Simplified25.4%
Taylor expanded in C around 0 21.5%
mul-1-neg21.5%
Simplified21.5%
Final simplification25.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 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)) (t_2 (* t_1 F)))
(if (<= B -2.1e+152)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -8.5e-71)
(- (/ (sqrt (* 2.0 (* t_2 (+ A (+ B C))))) t_1))
(if (<= B 1.25e-75)
(/ (- (sqrt (* 2.0 (* t_2 (* 2.0 A))))) t_1)
(- (/ (sqrt (* 2.0 (* B (* F (- t_0 (* B B)))))) t_1)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -2.1e+152) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(sqrt((2.0 * (t_2 * (A + (B + C))))) / t_1);
} else if (B <= 1.25e-75) {
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
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 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
t_2 = t_1 * f
if (b <= (-2.1d+152)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-8.5d-71)) then
tmp = -(sqrt((2.0d0 * (t_2 * (a + (b + c))))) / t_1)
else if (b <= 1.25d-75) then
tmp = -sqrt((2.0d0 * (t_2 * (2.0d0 * a)))) / t_1
else
tmp = -(sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = t_1 * F;
double tmp;
if (B <= -2.1e+152) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -8.5e-71) {
tmp = -(Math.sqrt((2.0 * (t_2 * (A + (B + C))))) / t_1);
} else if (B <= 1.25e-75) {
tmp = -Math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
} else {
tmp = -(Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 t_2 = t_1 * F tmp = 0 if B <= -2.1e+152: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -8.5e-71: tmp = -(math.sqrt((2.0 * (t_2 * (A + (B + C))))) / t_1) elif B <= 1.25e-75: tmp = -math.sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1 else: tmp = -(math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) t_2 = Float64(t_1 * F) tmp = 0.0 if (B <= -2.1e+152) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -8.5e-71) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(A + Float64(B + C))))) / t_1)); elseif (B <= 1.25e-75) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * A))))) / t_1); else tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B)))))) / t_1)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
t_2 = t_1 * F;
tmp = 0.0;
if (B <= -2.1e+152)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -8.5e-71)
tmp = -(sqrt((2.0 * (t_2 * (A + (B + C))))) / t_1);
elseif (B <= 1.25e-75)
tmp = -sqrt((2.0 * (t_2 * (2.0 * A)))) / t_1;
else
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 * F), $MachinePrecision]}, If[LessEqual[B, -2.1e+152], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e-71], (-N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[B, 1.25e-75], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
t_2 := t_1 \cdot F\\
\mathbf{if}\;B \leq -2.1 \cdot 10^{+152}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-71}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_2 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.25 \cdot 10^{-75}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -2.1000000000000002e152Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.1000000000000002e152 < B < -8.49999999999999988e-71Initial program 38.0%
Simplified38.0%
Taylor expanded in B around -inf 34.5%
if -8.49999999999999988e-71 < B < 1.24999999999999995e-75Initial program 17.8%
Simplified17.8%
Taylor expanded in A around -inf 30.3%
*-commutative30.3%
Simplified30.3%
if 1.24999999999999995e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in A around 0 21.2%
+-commutative21.2%
unpow221.2%
unpow221.2%
hypot-def25.4%
Simplified25.4%
Taylor expanded in C around 0 21.5%
mul-1-neg21.5%
Simplified21.5%
Final simplification25.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 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)))
(if (<= B -2.4e+148)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -6.8e-71)
(/ (- (sqrt (* 2.0 (* B (* t_1 F))))) t_1)
(if (<= B 2.5e-75)
(- (/ (sqrt (* 2.0 (* (* 2.0 A) (* F (* (* A C) -4.0))))) t_1))
(- (/ (sqrt (* 2.0 (* B (* F (- t_0 (* B B)))))) t_1)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -2.4e+148) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -sqrt((2.0 * (B * (t_1 * F)))) / t_1;
} else if (B <= 2.5e-75) {
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_1);
} else {
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
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 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
if (b <= (-2.4d+148)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-6.8d-71)) then
tmp = -sqrt((2.0d0 * (b * (t_1 * f)))) / t_1
else if (b <= 2.5d-75) then
tmp = -(sqrt((2.0d0 * ((2.0d0 * a) * (f * ((a * c) * (-4.0d0)))))) / t_1)
else
tmp = -(sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -2.4e+148) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -6.8e-71) {
tmp = -Math.sqrt((2.0 * (B * (t_1 * F)))) / t_1;
} else if (B <= 2.5e-75) {
tmp = -(Math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_1);
} else {
tmp = -(Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 tmp = 0 if B <= -2.4e+148: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -6.8e-71: tmp = -math.sqrt((2.0 * (B * (t_1 * F)))) / t_1 elif B <= 2.5e-75: tmp = -(math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_1) else: tmp = -(math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (B <= -2.4e+148) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -6.8e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(t_1 * F))))) / t_1); elseif (B <= 2.5e-75) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(F * Float64(Float64(A * C) * -4.0))))) / t_1)); else tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B)))))) / t_1)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
tmp = 0.0;
if (B <= -2.4e+148)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -6.8e-71)
tmp = -sqrt((2.0 * (B * (t_1 * F)))) / t_1;
elseif (B <= 2.5e-75)
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_1);
else
tmp = -(sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1);
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[B, -2.4e+148], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -6.8e-71], N[((-N[Sqrt[N[(2.0 * N[(B * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 2.5e-75], (-N[(N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(F * N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;B \leq -2.4 \cdot 10^{+148}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -6.8 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(t_1 \cdot F\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-75}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(F \cdot \left(\left(A \cdot C\right) \cdot -4\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -2.39999999999999995e148Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -2.39999999999999995e148 < B < -6.80000000000000007e-71Initial program 37.2%
Simplified37.2%
Taylor expanded in A around 0 37.4%
+-commutative37.4%
unpow237.4%
unpow237.4%
hypot-def37.6%
Simplified37.6%
Taylor expanded in B around -inf 31.7%
if -6.80000000000000007e-71 < B < 2.49999999999999989e-75Initial program 17.9%
Simplified17.9%
Taylor expanded in A around -inf 30.6%
*-commutative30.6%
Simplified30.6%
Taylor expanded in B around 0 29.8%
if 2.49999999999999989e-75 < B Initial program 23.7%
Simplified23.7%
Taylor expanded in A around 0 21.2%
+-commutative21.2%
unpow221.2%
unpow221.2%
hypot-def25.4%
Simplified25.4%
Taylor expanded in C around 0 21.5%
mul-1-neg21.5%
Simplified21.5%
Final simplification24.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 (- (* B B) (* 4.0 (* A C)))) (t_1 (sqrt (* A F))))
(if (<= B -1.7e+149)
(* 2.0 (* t_1 (/ 1.0 B)))
(if (<= B -5.9e-71)
(/ (- (sqrt (* 2.0 (* B (* t_0 F))))) t_0)
(if (<= B 1.66e+22)
(- (/ (sqrt (* 2.0 (* (* 2.0 A) (* F (* (* A C) -4.0))))) t_0))
(* -2.0 (/ t_1 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((A * F));
double tmp;
if (B <= -1.7e+149) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= -5.9e-71) {
tmp = -sqrt((2.0 * (B * (t_0 * F)))) / t_0;
} else if (B <= 1.66e+22) {
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_0);
} else {
tmp = -2.0 * (t_1 / 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((a * f))
if (b <= (-1.7d+149)) then
tmp = 2.0d0 * (t_1 * (1.0d0 / b))
else if (b <= (-5.9d-71)) then
tmp = -sqrt((2.0d0 * (b * (t_0 * f)))) / t_0
else if (b <= 1.66d+22) then
tmp = -(sqrt((2.0d0 * ((2.0d0 * a) * (f * ((a * c) * (-4.0d0)))))) / t_0)
else
tmp = (-2.0d0) * (t_1 / 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((A * F));
double tmp;
if (B <= -1.7e+149) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= -5.9e-71) {
tmp = -Math.sqrt((2.0 * (B * (t_0 * F)))) / t_0;
} else if (B <= 1.66e+22) {
tmp = -(Math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_0);
} else {
tmp = -2.0 * (t_1 / 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((A * F)) tmp = 0 if B <= -1.7e+149: tmp = 2.0 * (t_1 * (1.0 / B)) elif B <= -5.9e-71: tmp = -math.sqrt((2.0 * (B * (t_0 * F)))) / t_0 elif B <= 1.66e+22: tmp = -(math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_0) else: tmp = -2.0 * (t_1 / 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 = sqrt(Float64(A * F)) tmp = 0.0 if (B <= -1.7e+149) tmp = Float64(2.0 * Float64(t_1 * Float64(1.0 / B))); elseif (B <= -5.9e-71) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(t_0 * F))))) / t_0); elseif (B <= 1.66e+22) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(F * Float64(Float64(A * C) * -4.0))))) / t_0)); else tmp = Float64(-2.0 * Float64(t_1 / 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((A * F));
tmp = 0.0;
if (B <= -1.7e+149)
tmp = 2.0 * (t_1 * (1.0 / B));
elseif (B <= -5.9e-71)
tmp = -sqrt((2.0 * (B * (t_0 * F)))) / t_0;
elseif (B <= 1.66e+22)
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / t_0);
else
tmp = -2.0 * (t_1 / 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[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.7e+149], N[(2.0 * N[(t$95$1 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -5.9e-71], N[((-N[Sqrt[N[(2.0 * N[(B * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.66e+22], (-N[(N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(F * N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(-2.0 * N[(t$95$1 / B), $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 := \sqrt{A \cdot F}\\
\mathbf{if}\;B \leq -1.7 \cdot 10^{+149}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -5.9 \cdot 10^{-71}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(t_0 \cdot F\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.66 \cdot 10^{+22}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(F \cdot \left(\left(A \cdot C\right) \cdot -4\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_1}{B}\\
\end{array}
\end{array}
if B < -1.6999999999999999e149Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.1%
*-commutative0.1%
Simplified0.1%
Taylor expanded in B around -inf 6.0%
if -1.6999999999999999e149 < B < -5.90000000000000002e-71Initial program 37.2%
Simplified37.2%
Taylor expanded in A around 0 37.4%
+-commutative37.4%
unpow237.4%
unpow237.4%
hypot-def37.6%
Simplified37.6%
Taylor expanded in B around -inf 31.7%
if -5.90000000000000002e-71 < B < 1.66e22Initial program 20.4%
Simplified20.4%
Taylor expanded in A around -inf 28.9%
*-commutative28.9%
Simplified28.9%
Taylor expanded in B around 0 27.5%
if 1.66e22 < B Initial program 20.0%
Simplified20.0%
Taylor expanded in A around -inf 1.0%
*-commutative1.0%
Simplified1.0%
add-cbrt-cube1.0%
add-sqr-sqrt1.0%
associate-*r*1.0%
cancel-sign-sub-inv1.0%
metadata-eval1.0%
*-commutative1.0%
associate-*r*1.0%
Applied egg-rr1.0%
associate-*l*1.0%
fma-def1.0%
associate-*l*1.0%
associate-*r*1.2%
fma-def1.2%
associate-*r*1.2%
Simplified1.2%
Taylor expanded in B around inf 3.2%
associate-*r/3.2%
*-rgt-identity3.2%
Simplified3.2%
Final simplification20.0%
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 (* A F))))
(if (<= B -8.2e+44)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B 1.9e+23)
(-
(/
(sqrt (* 2.0 (* (* 2.0 A) (* F (* (* A C) -4.0)))))
(- (* 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((A * F));
double tmp;
if (B <= -8.2e+44) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 1.9e+23) {
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / ((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((a * f))
if (b <= (-8.2d+44)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= 1.9d+23) then
tmp = -(sqrt((2.0d0 * ((2.0d0 * a) * (f * ((a * c) * (-4.0d0)))))) / ((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((A * F));
double tmp;
if (B <= -8.2e+44) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 1.9e+23) {
tmp = -(Math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / ((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((A * F)) tmp = 0 if B <= -8.2e+44: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= 1.9e+23: tmp = -(math.sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / ((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(A * F)) tmp = 0.0 if (B <= -8.2e+44) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= 1.9e+23) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(F * Float64(Float64(A * C) * -4.0))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); else tmp = 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((A * F));
tmp = 0.0;
if (B <= -8.2e+44)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= 1.9e+23)
tmp = -(sqrt((2.0 * ((2.0 * A) * (F * ((A * C) * -4.0))))) / ((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[(A * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -8.2e+44], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.9e+23], (-N[(N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(F * N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(-2.0 * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{A \cdot F}\\
\mathbf{if}\;B \leq -8.2 \cdot 10^{+44}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 1.9 \cdot 10^{+23}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(F \cdot \left(\left(A \cdot C\right) \cdot -4\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -8.1999999999999993e44Initial program 9.9%
Simplified9.9%
Taylor expanded in A around -inf 4.3%
*-commutative4.3%
Simplified4.3%
Taylor expanded in B around -inf 7.4%
if -8.1999999999999993e44 < B < 1.89999999999999987e23Initial program 24.6%
Simplified24.6%
Taylor expanded in A around -inf 25.6%
*-commutative25.6%
Simplified25.6%
Taylor expanded in B around 0 24.5%
if 1.89999999999999987e23 < B Initial program 20.0%
Simplified20.0%
Taylor expanded in A around -inf 1.0%
*-commutative1.0%
Simplified1.0%
add-cbrt-cube1.0%
add-sqr-sqrt1.0%
associate-*r*1.0%
cancel-sign-sub-inv1.0%
metadata-eval1.0%
*-commutative1.0%
associate-*r*1.0%
Applied egg-rr1.0%
associate-*l*1.0%
fma-def1.0%
associate-*l*1.0%
associate-*r*1.2%
fma-def1.2%
associate-*r*1.2%
Simplified1.2%
Taylor expanded in B around inf 3.2%
associate-*r/3.2%
*-rgt-identity3.2%
Simplified3.2%
Final simplification16.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 (sqrt (* A F))))
(if (<= B -8.8e+30)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B 1.55e-40)
(*
(sqrt (* 2.0 (* (* (* A A) (* C F)) -8.0)))
(/ -1.0 (+ (* B B) (* (* A C) -4.0))))
(* -2.0 (/ t_0 B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((A * F));
double tmp;
if (B <= -8.8e+30) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 1.55e-40) {
tmp = sqrt((2.0 * (((A * A) * (C * F)) * -8.0))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
} 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((a * f))
if (b <= (-8.8d+30)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= 1.55d-40) then
tmp = sqrt((2.0d0 * (((a * a) * (c * f)) * (-8.0d0)))) * ((-1.0d0) / ((b * b) + ((a * c) * (-4.0d0))))
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((A * F));
double tmp;
if (B <= -8.8e+30) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 1.55e-40) {
tmp = Math.sqrt((2.0 * (((A * A) * (C * F)) * -8.0))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((A * F)) tmp = 0 if B <= -8.8e+30: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= 1.55e-40: tmp = math.sqrt((2.0 * (((A * A) * (C * F)) * -8.0))) * (-1.0 / ((B * B) + ((A * C) * -4.0))) else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(A * F)) tmp = 0.0 if (B <= -8.8e+30) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= 1.55e-40) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(Float64(A * A) * Float64(C * F)) * -8.0))) * Float64(-1.0 / Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)))); else tmp = 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((A * F));
tmp = 0.0;
if (B <= -8.8e+30)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= 1.55e-40)
tmp = sqrt((2.0 * (((A * A) * (C * F)) * -8.0))) * (-1.0 / ((B * B) + ((A * C) * -4.0)));
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[(A * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -8.8e+30], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.55e-40], N[(N[Sqrt[N[(2.0 * N[(N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * -8.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{A \cdot F}\\
\mathbf{if}\;B \leq -8.8 \cdot 10^{+30}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 1.55 \cdot 10^{-40}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right) \cdot -8\right)} \cdot \frac{-1}{B \cdot B + \left(A \cdot C\right) \cdot -4}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -8.7999999999999999e30Initial program 12.9%
Simplified12.9%
Taylor expanded in A around -inf 4.1%
*-commutative4.1%
Simplified4.1%
Taylor expanded in B around -inf 7.2%
if -8.7999999999999999e30 < B < 1.55000000000000005e-40Initial program 22.6%
Simplified22.6%
Taylor expanded in C around 0 17.6%
+-commutative17.6%
unpow217.6%
unpow217.6%
hypot-def24.8%
Simplified24.8%
div-inv24.2%
associate-*l*22.9%
cancel-sign-sub-inv22.9%
metadata-eval22.9%
cancel-sign-sub-inv22.9%
metadata-eval22.9%
Applied egg-rr22.9%
Taylor expanded in A around -inf 13.8%
*-commutative13.8%
unpow213.8%
*-commutative13.8%
Simplified13.8%
if 1.55000000000000005e-40 < B Initial program 22.9%
Simplified22.9%
Taylor expanded in A around -inf 4.4%
*-commutative4.4%
Simplified4.4%
add-cbrt-cube4.3%
add-sqr-sqrt4.3%
associate-*r*4.3%
cancel-sign-sub-inv4.3%
metadata-eval4.3%
*-commutative4.3%
associate-*r*4.3%
Applied egg-rr4.3%
associate-*l*4.3%
fma-def4.3%
associate-*l*4.3%
associate-*r*4.5%
fma-def4.5%
associate-*r*4.5%
Simplified4.5%
Taylor expanded in B around inf 4.8%
associate-*r/4.8%
*-rgt-identity4.8%
Simplified4.8%
Final simplification10.0%
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 (* A F)))) (if (<= B -2e-310) (* 2.0 (* t_0 (/ 1.0 B))) (* -2.0 (/ t_0 B)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((A * F));
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (t_0 * (1.0 / B));
} 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((a * f))
if (b <= (-2d-310)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
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((A * F));
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((A * F)) tmp = 0 if B <= -2e-310: tmp = 2.0 * (t_0 * (1.0 / B)) else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(A * F)) tmp = 0.0 if (B <= -2e-310) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); else tmp = 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((A * F));
tmp = 0.0;
if (B <= -2e-310)
tmp = 2.0 * (t_0 * (1.0 / B));
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[(A * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2e-310], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{A \cdot F}\\
\mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -1.999999999999994e-310Initial program 17.1%
Simplified17.1%
Taylor expanded in A around -inf 14.4%
*-commutative14.4%
Simplified14.4%
Taylor expanded in B around -inf 4.3%
if -1.999999999999994e-310 < B Initial program 23.9%
Simplified23.9%
Taylor expanded in A around -inf 16.9%
*-commutative16.9%
Simplified16.9%
add-cbrt-cube14.4%
add-sqr-sqrt14.4%
associate-*r*14.4%
cancel-sign-sub-inv14.4%
metadata-eval14.4%
*-commutative14.4%
associate-*r*14.4%
Applied egg-rr14.4%
associate-*l*13.6%
fma-def13.6%
associate-*l*13.6%
associate-*r*13.7%
fma-def13.7%
associate-*r*13.7%
Simplified13.7%
Taylor expanded in B around inf 4.9%
associate-*r/4.9%
*-rgt-identity4.9%
Simplified4.9%
Final simplification4.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 (* A F)) B))) (if (<= B -2e-310) (* 2.0 t_0) (* -2.0 t_0))))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((A * F)) / B;
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * t_0;
} else {
tmp = -2.0 * t_0;
}
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((a * f)) / b
if (b <= (-2d-310)) then
tmp = 2.0d0 * t_0
else
tmp = (-2.0d0) * t_0
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((A * F)) / B;
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * t_0;
} else {
tmp = -2.0 * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((A * F)) / B tmp = 0 if B <= -2e-310: tmp = 2.0 * t_0 else: tmp = -2.0 * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(Float64(A * F)) / B) tmp = 0.0 if (B <= -2e-310) tmp = Float64(2.0 * t_0); else tmp = Float64(-2.0 * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((A * F)) / B;
tmp = 0.0;
if (B <= -2e-310)
tmp = 2.0 * t_0;
else
tmp = -2.0 * t_0;
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[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -2e-310], N[(2.0 * t$95$0), $MachinePrecision], N[(-2.0 * t$95$0), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{A \cdot F}}{B}\\
\mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot t_0\\
\end{array}
\end{array}
if B < -1.999999999999994e-310Initial program 17.1%
Simplified17.1%
Taylor expanded in A around -inf 14.4%
*-commutative14.4%
Simplified14.4%
add-cbrt-cube11.4%
add-sqr-sqrt11.4%
associate-*r*11.4%
cancel-sign-sub-inv11.4%
metadata-eval11.4%
*-commutative11.4%
associate-*r*11.4%
Applied egg-rr11.4%
associate-*l*9.9%
fma-def9.9%
associate-*l*9.9%
associate-*r*10.0%
fma-def10.0%
associate-*r*10.0%
Simplified10.0%
Taylor expanded in B around -inf 4.3%
associate-*r/4.3%
*-rgt-identity4.3%
Simplified4.3%
if -1.999999999999994e-310 < B Initial program 23.9%
Simplified23.9%
Taylor expanded in A around -inf 16.9%
*-commutative16.9%
Simplified16.9%
add-cbrt-cube14.4%
add-sqr-sqrt14.4%
associate-*r*14.4%
cancel-sign-sub-inv14.4%
metadata-eval14.4%
*-commutative14.4%
associate-*r*14.4%
Applied egg-rr14.4%
associate-*l*13.6%
fma-def13.6%
associate-*l*13.6%
associate-*r*13.7%
fma-def13.7%
associate-*r*13.7%
Simplified13.7%
Taylor expanded in B around inf 4.9%
associate-*r/4.9%
*-rgt-identity4.9%
Simplified4.9%
Final simplification4.6%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* A F)) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((A * 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((a * f)) / b)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((A * F)) / B);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.sqrt((A * F)) / B)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B)) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (sqrt((A * F)) / B);
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B}
\end{array}
Initial program 20.5%
Simplified20.5%
Taylor expanded in A around -inf 15.6%
*-commutative15.6%
Simplified15.6%
add-cbrt-cube12.9%
add-sqr-sqrt12.9%
associate-*r*12.9%
cancel-sign-sub-inv12.9%
metadata-eval12.9%
*-commutative12.9%
associate-*r*12.9%
Applied egg-rr12.9%
associate-*l*11.7%
fma-def11.7%
associate-*l*11.7%
associate-*r*11.8%
fma-def11.8%
associate-*r*11.8%
Simplified11.8%
Taylor expanded in B around inf 3.0%
associate-*r/3.0%
*-rgt-identity3.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 (/ (sqrt (* A F)) C))
assert(A < C);
double code(double A, double B, double C, double F) {
return sqrt((A * F)) / C;
}
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 = sqrt((a * f)) / c
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return Math.sqrt((A * F)) / C;
}
[A, C] = sort([A, C]) def code(A, B, C, F): return math.sqrt((A * F)) / C
A, C = sort([A, C]) function code(A, B, C, F) return Float64(sqrt(Float64(A * F)) / C) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = sqrt((A * F)) / C;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / C), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{\sqrt{A \cdot F}}{C}
\end{array}
Initial program 20.5%
Simplified21.2%
Taylor expanded in C around -inf 4.7%
fma-def4.7%
distribute-lft-out4.7%
unpow24.7%
associate-/l*4.8%
unpow24.8%
unpow24.8%
Simplified4.8%
Taylor expanded in C around 0 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt1.6%
Simplified1.6%
Taylor expanded in C around 0 1.6%
mul-1-neg1.6%
associate-*r/1.6%
*-rgt-identity1.6%
distribute-neg-frac1.6%
Simplified1.6%
Final simplification1.6%
herbie shell --seed 2023181
(FPCore (A B C F)
:name "ABCF->ab-angle b"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))