
(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 18 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) (* (* A C) 4.0)))
(t_1 (- (sqrt (* F (- A (hypot A B)))))))
(if (<= B -1.2e+145)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B -1.52e-55)
(/ (* (sqrt 2.0) (* (sqrt (fma B B (* -4.0 (* A C)))) t_1)) t_0)
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) t_1))))))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 = -sqrt((F * (A - hypot(A, B))));
double tmp;
if (B <= -1.2e+145) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= -1.52e-55) {
tmp = (sqrt(2.0) * (sqrt(fma(B, B, (-4.0 * (A * C)))) * t_1)) / t_0;
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * t_1;
}
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(-sqrt(Float64(F * Float64(A - hypot(A, B))))) tmp = 0.0 if (B <= -1.2e+145) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= -1.52e-55) tmp = Float64(Float64(sqrt(2.0) * Float64(sqrt(fma(B, B, Float64(-4.0 * Float64(A * C)))) * t_1)) / t_0); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * t_1); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])}, If[LessEqual[B, -1.2e+145], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, -1.52e-55], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * t$95$1), $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 := -\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\\
\mathbf{if}\;B \leq -1.2 \cdot 10^{+145}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq -1.52 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(\sqrt{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)} \cdot t_1\right)}{t_0}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot t_1\\
\end{array}
\end{array}
if B < -1.19999999999999996e145Initial 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 B around -inf 0.0%
Taylor expanded in A around 0 49.5%
mul-1-neg49.5%
distribute-rgt-neg-in49.5%
Simplified49.5%
if -1.19999999999999996e145 < B < -1.5200000000000001e-55Initial program 36.4%
Simplified36.4%
Taylor expanded in C around 0 35.1%
+-commutative35.1%
unpow235.1%
unpow235.1%
hypot-def37.0%
Simplified37.0%
sqrt-prod37.0%
associate-*l*37.1%
cancel-sign-sub-inv37.1%
metadata-eval37.1%
Applied egg-rr37.1%
sqrt-prod38.4%
fma-def38.4%
Applied egg-rr38.4%
if -1.5200000000000001e-55 < B < 2.49999999999999997e-96Initial program 15.1%
Simplified15.1%
Taylor expanded in A around -inf 22.3%
if 2.49999999999999997e-96 < B Initial program 21.2%
Simplified21.2%
Taylor expanded in C around 0 22.7%
mul-1-neg22.7%
+-commutative22.7%
unpow222.7%
unpow222.7%
hypot-def49.4%
Simplified49.4%
Final simplification38.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* C (* -4.0 A)))) (t_1 (- (* B B) (* (* A C) 4.0))))
(if (<= B -7.6e+78)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B -1.32e-55)
(/ (- (sqrt (* 2.0 (* (* F t_0) (- A (- (hypot B (- A C)) C)))))) t_0)
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* F t_1) (* 2.0 A))))) t_1)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A (hypot A B)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (C * (-4.0 * A)));
double t_1 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= -7.6e+78) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= -1.32e-55) {
tmp = -sqrt((2.0 * ((F * t_0) * (A - (hypot(B, (A - C)) - C))))) / t_0;
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(A, B))));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(C * Float64(-4.0 * A))) t_1 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (B <= -7.6e+78) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= -1.32e-55) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A - Float64(hypot(B, Float64(A - C)) - C)))))) / t_0); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(2.0 * A))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B)))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(C * N[(-4.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -7.6e+78], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, -1.32e-55], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A - N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $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 - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, C \cdot \left(-4 \cdot A\right)\right)\\
t_1 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;B \leq -7.6 \cdot 10^{+78}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq -1.32 \cdot 10^{-55}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)\\
\end{array}
\end{array}
if B < -7.5999999999999998e78Initial program 14.3%
Simplified14.3%
Taylor expanded in C around 0 14.4%
+-commutative14.4%
unpow214.4%
unpow214.4%
hypot-def14.4%
Simplified14.4%
Taylor expanded in B around -inf 6.6%
Taylor expanded in A around 0 49.6%
mul-1-neg49.6%
distribute-rgt-neg-in49.6%
Simplified49.6%
if -7.5999999999999998e78 < B < -1.31999999999999993e-55Initial program 33.5%
Simplified40.8%
if -1.31999999999999993e-55 < B < 2.49999999999999997e-96Initial program 15.1%
Simplified15.1%
Taylor expanded in A around -inf 22.3%
if 2.49999999999999997e-96 < B Initial program 21.2%
Simplified21.2%
Taylor expanded in C around 0 22.7%
mul-1-neg22.7%
+-commutative22.7%
unpow222.7%
unpow222.7%
hypot-def49.4%
Simplified49.4%
Final simplification39.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= B -2e+79)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B -1.5e-55)
(/
(*
(sqrt 2.0)
(-
(sqrt
(*
(+ (* -4.0 (* A C)) (* B B))
(* F (- A (- (hypot B (- A C)) C)))))))
t_0)
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* 2.0 A))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A (hypot 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 tmp;
if (B <= -2e+79) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= -1.5e-55) {
tmp = (sqrt(2.0) * -sqrt((((-4.0 * (A * C)) + (B * B)) * (F * (A - (hypot(B, (A - C)) - C)))))) / t_0;
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(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 tmp;
if (B <= -2e+79) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
} else if (B <= -1.5e-55) {
tmp = (Math.sqrt(2.0) * -Math.sqrt((((-4.0 * (A * C)) + (B * B)) * (F * (A - (Math.hypot(B, (A - C)) - C)))))) / t_0;
} else if (B <= 2.5e-96) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - Math.hypot(A, B))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if B <= -2e+79: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) elif B <= -1.5e-55: tmp = (math.sqrt(2.0) * -math.sqrt((((-4.0 * (A * C)) + (B * B)) * (F * (A - (math.hypot(B, (A - C)) - C)))))) / t_0 elif B <= 2.5e-96: tmp = -math.sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - math.hypot(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)) tmp = 0.0 if (B <= -2e+79) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= -1.5e-55) tmp = Float64(Float64(sqrt(2.0) * Float64(-sqrt(Float64(Float64(Float64(-4.0 * Float64(A * C)) + Float64(B * B)) * Float64(F * Float64(A - Float64(hypot(B, Float64(A - C)) - C))))))) / t_0); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - hypot(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);
tmp = 0.0;
if (B <= -2e+79)
tmp = sqrt(2.0) * -sqrt((F / B));
elseif (B <= -1.5e-55)
tmp = (sqrt(2.0) * -sqrt((((-4.0 * (A * C)) + (B * B)) * (F * (A - (hypot(B, (A - C)) - C)))))) / t_0;
elseif (B <= 2.5e-96)
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(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]}, If[LessEqual[B, -2e+79], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, -1.5e-55], N[(N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(N[(N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision] * N[(F * N[(A - N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $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 - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $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\\
\mathbf{if}\;B \leq -2 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq -1.5 \cdot 10^{-55}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \left(-\sqrt{\left(-4 \cdot \left(A \cdot C\right) + B \cdot B\right) \cdot \left(F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)\\
\end{array}
\end{array}
if B < -1.99999999999999993e79Initial program 14.3%
Simplified14.3%
Taylor expanded in C around 0 14.4%
+-commutative14.4%
unpow214.4%
unpow214.4%
hypot-def14.4%
Simplified14.4%
Taylor expanded in B around -inf 6.6%
Taylor expanded in A around 0 49.6%
mul-1-neg49.6%
distribute-rgt-neg-in49.6%
Simplified49.6%
if -1.99999999999999993e79 < B < -1.50000000000000008e-55Initial program 33.5%
Simplified33.5%
sqrt-prod33.5%
associate-*l*33.4%
cancel-sign-sub-inv33.4%
metadata-eval33.4%
associate--l+33.4%
unpow233.4%
hypot-udef40.9%
Applied egg-rr40.9%
if -1.50000000000000008e-55 < B < 2.49999999999999997e-96Initial program 15.1%
Simplified15.1%
Taylor expanded in A around -inf 22.3%
if 2.49999999999999997e-96 < B Initial program 21.2%
Simplified21.2%
Taylor expanded in C around 0 22.7%
mul-1-neg22.7%
+-commutative22.7%
unpow222.7%
unpow222.7%
hypot-def49.4%
Simplified49.4%
Final simplification39.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* -4.0 (* A C)) (* B B))) (t_1 (- (* B B) (* (* A C) 4.0))))
(if (<= B -1.85e+79)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B -2.1e-55)
(/ (- (sqrt (* 2.0 (* t_0 (* F (- A (- (hypot B (- A C)) C))))))) t_0)
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* F t_1) (* 2.0 A))))) t_1)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A (hypot A B)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (-4.0 * (A * C)) + (B * B);
double t_1 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= -1.85e+79) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= -2.1e-55) {
tmp = -sqrt((2.0 * (t_0 * (F * (A - (hypot(B, (A - C)) - C)))))) / t_0;
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(A, B))));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (-4.0 * (A * C)) + (B * B);
double t_1 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= -1.85e+79) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
} else if (B <= -2.1e-55) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A - (Math.hypot(B, (A - C)) - C)))))) / t_0;
} else if (B <= 2.5e-96) {
tmp = -Math.sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - Math.hypot(A, B))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (-4.0 * (A * C)) + (B * B) t_1 = (B * B) - ((A * C) * 4.0) tmp = 0 if B <= -1.85e+79: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) elif B <= -2.1e-55: tmp = -math.sqrt((2.0 * (t_0 * (F * (A - (math.hypot(B, (A - C)) - C)))))) / t_0 elif B <= 2.5e-96: tmp = -math.sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - math.hypot(A, B)))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(-4.0 * Float64(A * C)) + Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) tmp = 0.0 if (B <= -1.85e+79) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= -2.1e-55) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A - Float64(hypot(B, Float64(A - C)) - C))))))) / t_0); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(2.0 * A))))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - hypot(A, B)))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (-4.0 * (A * C)) + (B * B);
t_1 = (B * B) - ((A * C) * 4.0);
tmp = 0.0;
if (B <= -1.85e+79)
tmp = sqrt(2.0) * -sqrt((F / B));
elseif (B <= -2.1e-55)
tmp = -sqrt((2.0 * (t_0 * (F * (A - (hypot(B, (A - C)) - C)))))) / t_0;
elseif (B <= 2.5e-96)
tmp = -sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - hypot(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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.85e+79], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, -2.1e-55], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A - N[(N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision] - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $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 - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -4 \cdot \left(A \cdot C\right) + B \cdot B\\
t_1 := B \cdot B - \left(A \cdot C\right) \cdot 4\\
\mathbf{if}\;B \leq -1.85 \cdot 10^{+79}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq -2.1 \cdot 10^{-55}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A - \left(\mathsf{hypot}\left(B, A - C\right) - C\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)}\right)\\
\end{array}
\end{array}
if B < -1.85000000000000005e79Initial program 14.3%
Simplified14.3%
Taylor expanded in C around 0 14.4%
+-commutative14.4%
unpow214.4%
unpow214.4%
hypot-def14.4%
Simplified14.4%
Taylor expanded in B around -inf 6.6%
Taylor expanded in A around 0 49.6%
mul-1-neg49.6%
distribute-rgt-neg-in49.6%
Simplified49.6%
if -1.85000000000000005e79 < B < -2.1000000000000002e-55Initial program 33.5%
Simplified33.5%
distribute-frac-neg33.5%
Applied egg-rr40.9%
if -2.1000000000000002e-55 < B < 2.49999999999999997e-96Initial program 15.1%
Simplified15.1%
Taylor expanded in A around -inf 22.3%
if 2.49999999999999997e-96 < B Initial program 21.2%
Simplified21.2%
Taylor expanded in C around 0 22.7%
mul-1-neg22.7%
+-commutative22.7%
unpow222.7%
unpow222.7%
hypot-def49.4%
Simplified49.4%
Final simplification39.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0)))
(t_1 (* F t_0))
(t_2 (- (* A A) (* A A))))
(if (<= C 6.6e-9)
(/ (- (sqrt (* 2.0 (* (- A (hypot A B)) t_1)))) t_0)
(-
(/
(sqrt
(*
2.0
(*
t_1
(+
A
(+
A
(*
-0.5
(- (/ (+ (* B B) t_2) C) (* (/ A C) (/ (- t_2 (* B B)) C)))))))))
t_0)))))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 = F * t_0;
double t_2 = (A * A) - (A * A);
double tmp;
if (C <= 6.6e-9) {
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * t_1))) / t_0;
} else {
tmp = -(sqrt((2.0 * (t_1 * (A + (A + (-0.5 * ((((B * B) + t_2) / C) - ((A / C) * ((t_2 - (B * B)) / C))))))))) / t_0);
}
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 = F * t_0;
double t_2 = (A * A) - (A * A);
double tmp;
if (C <= 6.6e-9) {
tmp = -Math.sqrt((2.0 * ((A - Math.hypot(A, B)) * t_1))) / t_0;
} else {
tmp = -(Math.sqrt((2.0 * (t_1 * (A + (A + (-0.5 * ((((B * B) + t_2) / C) - ((A / C) * ((t_2 - (B * B)) / C))))))))) / t_0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) t_1 = F * t_0 t_2 = (A * A) - (A * A) tmp = 0 if C <= 6.6e-9: tmp = -math.sqrt((2.0 * ((A - math.hypot(A, B)) * t_1))) / t_0 else: tmp = -(math.sqrt((2.0 * (t_1 * (A + (A + (-0.5 * ((((B * B) + t_2) / C) - ((A / C) * ((t_2 - (B * B)) / C))))))))) / t_0) 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(F * t_0) t_2 = Float64(Float64(A * A) - Float64(A * A)) tmp = 0.0 if (C <= 6.6e-9) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(A, B)) * t_1)))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(Float64(Float64(B * B) + t_2) / C) - Float64(Float64(A / C) * Float64(Float64(t_2 - Float64(B * B)) / C))))))))) / t_0)); 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 = F * t_0;
t_2 = (A * A) - (A * A);
tmp = 0.0;
if (C <= 6.6e-9)
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * t_1))) / t_0;
else
tmp = -(sqrt((2.0 * (t_1 * (A + (A + (-0.5 * ((((B * B) + t_2) / C) - ((A / C) * ((t_2 - (B * B)) / C))))))))) / 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[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(A * A), $MachinePrecision] - N[(A * A), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, 6.6e-9], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(A + N[(-0.5 * N[(N[(N[(N[(B * B), $MachinePrecision] + t$95$2), $MachinePrecision] / C), $MachinePrecision] - N[(N[(A / C), $MachinePrecision] * N[(N[(t$95$2 - N[(B * B), $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - \left(A \cdot C\right) \cdot 4\\
t_1 := F \cdot t_0\\
t_2 := A \cdot A - A \cdot A\\
\mathbf{if}\;C \leq 6.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot t_1\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(A + -0.5 \cdot \left(\frac{B \cdot B + t_2}{C} - \frac{A}{C} \cdot \frac{t_2 - B \cdot B}{C}\right)\right)\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < 6.60000000000000037e-9Initial program 25.2%
Simplified25.2%
Taylor expanded in C around 0 22.3%
+-commutative22.3%
unpow222.3%
unpow222.3%
hypot-def25.5%
Simplified25.5%
if 6.60000000000000037e-9 < C Initial program 1.1%
Simplified1.1%
Taylor expanded in C around inf 29.1%
associate--l+29.1%
Simplified29.1%
Final simplification26.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* A C) 4.0))))
(if (<= B -5.5e-10)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* 2.0 A))))) t_0)
(if (<= B 3.5e+149)
(/ (- (sqrt (* 2.0 (* (- A (hypot B A)) (* F (* B B)))))) t_0)
(* -2.0 (/ (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 tmp;
if (B <= -5.5e-10) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else if (B <= 3.5e+149) {
tmp = -sqrt((2.0 * ((A - hypot(B, A)) * (F * (B * B))))) / t_0;
} else {
tmp = -2.0 * (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 tmp;
if (B <= -5.5e-10) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
} else if (B <= 2.5e-96) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else if (B <= 3.5e+149) {
tmp = -Math.sqrt((2.0 * ((A - Math.hypot(B, A)) * (F * (B * B))))) / t_0;
} else {
tmp = -2.0 * (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) tmp = 0 if B <= -5.5e-10: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) elif B <= 2.5e-96: tmp = -math.sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0 elif B <= 3.5e+149: tmp = -math.sqrt((2.0 * ((A - math.hypot(B, A)) * (F * (B * B))))) / t_0 else: tmp = -2.0 * (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)) tmp = 0.0 if (B <= -5.5e-10) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * A))))) / t_0); elseif (B <= 3.5e+149) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(B, A)) * Float64(F * Float64(B * B)))))) / t_0); else tmp = Float64(-2.0 * Float64(sqrt(Float64(F * 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);
tmp = 0.0;
if (B <= -5.5e-10)
tmp = sqrt(2.0) * -sqrt((F / B));
elseif (B <= 2.5e-96)
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
elseif (B <= 3.5e+149)
tmp = -sqrt((2.0 * ((A - hypot(B, A)) * (F * (B * B))))) / t_0;
else
tmp = -2.0 * (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]}, If[LessEqual[B, -5.5e-10], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.5e+149], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $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\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{-10}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{+149}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{F \cdot A}}{B}\\
\end{array}
\end{array}
if B < -5.4999999999999996e-10Initial program 19.6%
Simplified19.6%
Taylor expanded in C around 0 19.8%
+-commutative19.8%
unpow219.8%
unpow219.8%
hypot-def21.0%
Simplified21.0%
Taylor expanded in B around -inf 14.1%
Taylor expanded in A around 0 41.6%
mul-1-neg41.6%
distribute-rgt-neg-in41.6%
Simplified41.6%
if -5.4999999999999996e-10 < B < 2.49999999999999997e-96Initial program 18.1%
Simplified18.1%
Taylor expanded in A around -inf 21.8%
if 2.49999999999999997e-96 < B < 3.50000000000000011e149Initial program 39.1%
Simplified39.1%
Taylor expanded in C around 0 36.3%
+-commutative36.3%
unpow236.3%
unpow236.3%
hypot-def38.5%
Simplified38.5%
Taylor expanded in C around 0 36.7%
unpow236.7%
unpow236.7%
hypot-def37.0%
unpow237.0%
Simplified37.0%
if 3.50000000000000011e149 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification28.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) (* (* A C) 4.0))))
(if (<= B -1.9e-9)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B 7.5e-65)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* 2.0 A))))) t_0)
(if (<= B 4.9e+148)
(/
(- (sqrt (* 2.0 (* (* B F) (- (* B B))))))
(fma B B (* A (* -4.0 C))))
(* -2.0 (/ (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 tmp;
if (B <= -1.9e-9) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= 7.5e-65) {
tmp = -sqrt((2.0 * ((F * t_0) * (2.0 * A)))) / t_0;
} else if (B <= 4.9e+148) {
tmp = -sqrt((2.0 * ((B * F) * -(B * B)))) / fma(B, B, (A * (-4.0 * C)));
} else {
tmp = -2.0 * (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)) tmp = 0.0 if (B <= -1.9e-9) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= 7.5e-65) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * A))))) / t_0); elseif (B <= 4.9e+148) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(B * F) * Float64(-Float64(B * B)))))) / fma(B, B, Float64(A * Float64(-4.0 * C)))); else tmp = Float64(-2.0 * Float64(sqrt(Float64(F * A)) / 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[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.9e-9], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 7.5e-65], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 4.9e+148], N[((-N[Sqrt[N[(2.0 * N[(N[(B * F), $MachinePrecision] * (-N[(B * B), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B + N[(A * N[(-4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $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\\
\mathbf{if}\;B \leq -1.9 \cdot 10^{-9}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4.9 \cdot 10^{+148}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(B \cdot F\right) \cdot \left(-B \cdot B\right)\right)}}{\mathsf{fma}\left(B, B, A \cdot \left(-4 \cdot C\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{F \cdot A}}{B}\\
\end{array}
\end{array}
if B < -1.90000000000000006e-9Initial program 19.6%
Simplified19.6%
Taylor expanded in C around 0 19.8%
+-commutative19.8%
unpow219.8%
unpow219.8%
hypot-def21.0%
Simplified21.0%
Taylor expanded in B around -inf 14.1%
Taylor expanded in A around 0 41.6%
mul-1-neg41.6%
distribute-rgt-neg-in41.6%
Simplified41.6%
if -1.90000000000000006e-9 < B < 7.5000000000000002e-65Initial program 20.1%
Simplified20.1%
Taylor expanded in A around -inf 21.6%
if 7.5000000000000002e-65 < B < 4.9e148Initial program 37.3%
Simplified33.4%
Taylor expanded in C around 0 37.9%
associate-*r*38.0%
+-commutative38.0%
unpow238.0%
unpow238.0%
hypot-def38.2%
unpow238.2%
Simplified38.2%
Taylor expanded in A around 0 38.7%
mul-1-neg38.7%
Simplified38.7%
if 4.9e148 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification28.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 (* (* A C) 4.0)) (t_1 (- (* B B) t_0)))
(if (<= B -1.5e-9)
(* (sqrt 2.0) (- (sqrt (/ F B))))
(if (<= B 3.8e-65)
(/ (- (sqrt (* 2.0 (* (* F t_1) (* 2.0 A))))) t_1)
(if (<= B 1.32e+154)
(/ (- (sqrt (* 2.0 (* B (* F (- t_0 (* B B))))))) t_1)
(* -2.0 (/ (sqrt (* F A)) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -1.5e-9) {
tmp = sqrt(2.0) * -sqrt((F / B));
} else if (B <= 3.8e-65) {
tmp = -sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
} else if (B <= 1.32e+154) {
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -2.0 * (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 = (a * c) * 4.0d0
t_1 = (b * b) - t_0
if (b <= (-1.5d-9)) then
tmp = sqrt(2.0d0) * -sqrt((f / b))
else if (b <= 3.8d-65) then
tmp = -sqrt((2.0d0 * ((f * t_1) * (2.0d0 * a)))) / t_1
else if (b <= 1.32d+154) then
tmp = -sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1
else
tmp = (-2.0d0) * (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 = (A * C) * 4.0;
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -1.5e-9) {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
} else if (B <= 3.8e-65) {
tmp = -Math.sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
} else if (B <= 1.32e+154) {
tmp = -Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -2.0 * (Math.sqrt((F * A)) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (A * C) * 4.0 t_1 = (B * B) - t_0 tmp = 0 if B <= -1.5e-9: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) elif B <= 3.8e-65: tmp = -math.sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1 elif B <= 1.32e+154: tmp = -math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1 else: tmp = -2.0 * (math.sqrt((F * A)) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(A * C) * 4.0) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (B <= -1.5e-9) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / B)))); elseif (B <= 3.8e-65) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(2.0 * A))))) / t_1); elseif (B <= 1.32e+154) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); else tmp = Float64(-2.0 * Float64(sqrt(Float64(F * A)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (A * C) * 4.0;
t_1 = (B * B) - t_0;
tmp = 0.0;
if (B <= -1.5e-9)
tmp = sqrt(2.0) * -sqrt((F / B));
elseif (B <= 3.8e-65)
tmp = -sqrt((2.0 * ((F * t_1) * (2.0 * A)))) / t_1;
elseif (B <= 1.32e+154)
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
else
tmp = -2.0 * (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[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.5e-9], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 3.8e-65], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.32e+154], 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], N[(-2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \left(A \cdot C\right) \cdot 4\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;B \leq -1.5 \cdot 10^{-9}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{-65}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(2 \cdot A\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.32 \cdot 10^{+154}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{F \cdot A}}{B}\\
\end{array}
\end{array}
if B < -1.49999999999999999e-9Initial program 19.6%
Simplified19.6%
Taylor expanded in C around 0 19.8%
+-commutative19.8%
unpow219.8%
unpow219.8%
hypot-def21.0%
Simplified21.0%
Taylor expanded in B around -inf 14.1%
Taylor expanded in A around 0 41.6%
mul-1-neg41.6%
distribute-rgt-neg-in41.6%
Simplified41.6%
if -1.49999999999999999e-9 < B < 3.8000000000000002e-65Initial program 20.1%
Simplified20.1%
Taylor expanded in A around -inf 21.6%
if 3.8000000000000002e-65 < B < 1.31999999999999998e154Initial program 37.3%
Simplified37.3%
Taylor expanded in A around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def38.0%
Simplified38.0%
Taylor expanded in C around 0 37.9%
neg-mul-137.9%
Simplified37.9%
if 1.31999999999999998e154 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification28.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 (* F A))) (t_1 (* (* A C) 4.0)) (t_2 (- (* B B) t_1)))
(if (<= B -5.4e+148)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B -2.2e-55)
(- (/ (sqrt (* 2.0 (* B (* F t_2)))) t_2))
(if (<= B 2.5e-96)
(/ (- (sqrt (* 2.0 (* (* 2.0 A) (* -4.0 (* A (* F C))))))) t_2)
(if (<= B 3.4e+153)
(/ (- (sqrt (* 2.0 (* B (* F (- t_1 (* B B))))))) t_2)
(* -2.0 (/ t_0 B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double tmp;
if (B <= -5.4e+148) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -2.2e-55) {
tmp = -(sqrt((2.0 * (B * (F * t_2)))) / t_2);
} else if (B <= 2.5e-96) {
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_2;
} else if (B <= 3.4e+153) {
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt((f * a))
t_1 = (a * c) * 4.0d0
t_2 = (b * b) - t_1
if (b <= (-5.4d+148)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= (-2.2d-55)) then
tmp = -(sqrt((2.0d0 * (b * (f * t_2)))) / t_2)
else if (b <= 2.5d-96) then
tmp = -sqrt((2.0d0 * ((2.0d0 * a) * ((-4.0d0) * (a * (f * c)))))) / t_2
else if (b <= 3.4d+153) then
tmp = -sqrt((2.0d0 * (b * (f * (t_1 - (b * b)))))) / t_2
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((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double tmp;
if (B <= -5.4e+148) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -2.2e-55) {
tmp = -(Math.sqrt((2.0 * (B * (F * t_2)))) / t_2);
} else if (B <= 2.5e-96) {
tmp = -Math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_2;
} else if (B <= 3.4e+153) {
tmp = -Math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((F * A)) t_1 = (A * C) * 4.0 t_2 = (B * B) - t_1 tmp = 0 if B <= -5.4e+148: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= -2.2e-55: tmp = -(math.sqrt((2.0 * (B * (F * t_2)))) / t_2) elif B <= 2.5e-96: tmp = -math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_2 elif B <= 3.4e+153: tmp = -math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2 else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(F * A)) t_1 = Float64(Float64(A * C) * 4.0) t_2 = Float64(Float64(B * B) - t_1) tmp = 0.0 if (B <= -5.4e+148) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= -2.2e-55) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * t_2)))) / t_2)); elseif (B <= 2.5e-96) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(-4.0 * Float64(A * Float64(F * C))))))) / t_2); elseif (B <= 3.4e+153) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_1 - Float64(B * B))))))) / t_2); 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((F * A));
t_1 = (A * C) * 4.0;
t_2 = (B * B) - t_1;
tmp = 0.0;
if (B <= -5.4e+148)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= -2.2e-55)
tmp = -(sqrt((2.0 * (B * (F * t_2)))) / t_2);
elseif (B <= 2.5e-96)
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_2;
elseif (B <= 3.4e+153)
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
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[(F * A), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$1), $MachinePrecision]}, If[LessEqual[B, -5.4e+148], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.2e-55], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]), If[LessEqual[B, 2.5e-96], N[((-N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(-4.0 * N[(A * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 3.4e+153], N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$1 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $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{F \cdot A}\\
t_1 := \left(A \cdot C\right) \cdot 4\\
t_2 := B \cdot B - t_1\\
\mathbf{if}\;B \leq -5.4 \cdot 10^{+148}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -2.2 \cdot 10^{-55}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot t_2\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{-96}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(-4 \cdot \left(A \cdot \left(F \cdot C\right)\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 3.4 \cdot 10^{+153}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_1 - B \cdot B\right)\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -5.40000000000000038e148Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 2.7%
if -5.40000000000000038e148 < B < -2.2e-55Initial program 36.4%
Simplified36.4%
Taylor expanded in A around 0 33.8%
+-commutative33.8%
unpow233.8%
unpow233.8%
hypot-def35.9%
Simplified35.9%
Taylor expanded in B around -inf 32.3%
if -2.2e-55 < B < 2.49999999999999997e-96Initial program 15.1%
Simplified15.1%
Taylor expanded in A around -inf 22.3%
Taylor expanded in B around 0 19.1%
if 2.49999999999999997e-96 < B < 3.3999999999999997e153Initial program 39.1%
Simplified39.1%
Taylor expanded in A around 0 39.5%
+-commutative39.5%
unpow239.5%
unpow239.5%
hypot-def39.8%
Simplified39.8%
Taylor expanded in C around 0 36.5%
neg-mul-136.5%
Simplified36.5%
if 3.3999999999999997e153 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification21.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)) (* B B)))
(t_1 (sqrt (* F A)))
(t_2 (* (* A C) 4.0))
(t_3 (- (* B B) t_2)))
(if (<= B -1.95e+146)
(* 2.0 (* t_1 (/ 1.0 B)))
(if (<= B -2.8e-8)
(- (/ (sqrt (* 2.0 (* B (* F t_3)))) t_3))
(if (<= B 5.6e-65)
(/ (- (sqrt (* 2.0 (* t_0 (* F (* 2.0 A)))))) t_0)
(if (<= B 1.28e+154)
(/ (- (sqrt (* 2.0 (* B (* F (- t_2 (* B B))))))) t_3)
(* -2.0 (/ t_1 B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (-4.0 * (A * C)) + (B * B);
double t_1 = sqrt((F * A));
double t_2 = (A * C) * 4.0;
double t_3 = (B * B) - t_2;
double tmp;
if (B <= -1.95e+146) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= -2.8e-8) {
tmp = -(sqrt((2.0 * (B * (F * t_3)))) / t_3);
} else if (B <= 5.6e-65) {
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * A))))) / t_0;
} else if (B <= 1.28e+154) {
tmp = -sqrt((2.0 * (B * (F * (t_2 - (B * B)))))) / t_3;
} 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) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = ((-4.0d0) * (a * c)) + (b * b)
t_1 = sqrt((f * a))
t_2 = (a * c) * 4.0d0
t_3 = (b * b) - t_2
if (b <= (-1.95d+146)) then
tmp = 2.0d0 * (t_1 * (1.0d0 / b))
else if (b <= (-2.8d-8)) then
tmp = -(sqrt((2.0d0 * (b * (f * t_3)))) / t_3)
else if (b <= 5.6d-65) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (2.0d0 * a))))) / t_0
else if (b <= 1.28d+154) then
tmp = -sqrt((2.0d0 * (b * (f * (t_2 - (b * b)))))) / t_3
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 = (-4.0 * (A * C)) + (B * B);
double t_1 = Math.sqrt((F * A));
double t_2 = (A * C) * 4.0;
double t_3 = (B * B) - t_2;
double tmp;
if (B <= -1.95e+146) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= -2.8e-8) {
tmp = -(Math.sqrt((2.0 * (B * (F * t_3)))) / t_3);
} else if (B <= 5.6e-65) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (2.0 * A))))) / t_0;
} else if (B <= 1.28e+154) {
tmp = -Math.sqrt((2.0 * (B * (F * (t_2 - (B * B)))))) / t_3;
} else {
tmp = -2.0 * (t_1 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (-4.0 * (A * C)) + (B * B) t_1 = math.sqrt((F * A)) t_2 = (A * C) * 4.0 t_3 = (B * B) - t_2 tmp = 0 if B <= -1.95e+146: tmp = 2.0 * (t_1 * (1.0 / B)) elif B <= -2.8e-8: tmp = -(math.sqrt((2.0 * (B * (F * t_3)))) / t_3) elif B <= 5.6e-65: tmp = -math.sqrt((2.0 * (t_0 * (F * (2.0 * A))))) / t_0 elif B <= 1.28e+154: tmp = -math.sqrt((2.0 * (B * (F * (t_2 - (B * B)))))) / t_3 else: tmp = -2.0 * (t_1 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(-4.0 * Float64(A * C)) + Float64(B * B)) t_1 = sqrt(Float64(F * A)) t_2 = Float64(Float64(A * C) * 4.0) t_3 = Float64(Float64(B * B) - t_2) tmp = 0.0 if (B <= -1.95e+146) tmp = Float64(2.0 * Float64(t_1 * Float64(1.0 / B))); elseif (B <= -2.8e-8) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * t_3)))) / t_3)); elseif (B <= 5.6e-65) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(2.0 * A)))))) / t_0); elseif (B <= 1.28e+154) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_2 - Float64(B * B))))))) / t_3); 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 = (-4.0 * (A * C)) + (B * B);
t_1 = sqrt((F * A));
t_2 = (A * C) * 4.0;
t_3 = (B * B) - t_2;
tmp = 0.0;
if (B <= -1.95e+146)
tmp = 2.0 * (t_1 * (1.0 / B));
elseif (B <= -2.8e-8)
tmp = -(sqrt((2.0 * (B * (F * t_3)))) / t_3);
elseif (B <= 5.6e-65)
tmp = -sqrt((2.0 * (t_0 * (F * (2.0 * A))))) / t_0;
elseif (B <= 1.28e+154)
tmp = -sqrt((2.0 * (B * (F * (t_2 - (B * B)))))) / t_3;
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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(B * B), $MachinePrecision] - t$95$2), $MachinePrecision]}, If[LessEqual[B, -1.95e+146], N[(2.0 * N[(t$95$1 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.8e-8], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision]), If[LessEqual[B, 5.6e-65], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.28e+154], N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$2 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$3), $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 := -4 \cdot \left(A \cdot C\right) + B \cdot B\\
t_1 := \sqrt{F \cdot A}\\
t_2 := \left(A \cdot C\right) \cdot 4\\
t_3 := B \cdot B - t_2\\
\mathbf{if}\;B \leq -1.95 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -2.8 \cdot 10^{-8}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot t_3\right)\right)}}{t_3}\\
\mathbf{elif}\;B \leq 5.6 \cdot 10^{-65}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(2 \cdot A\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.28 \cdot 10^{+154}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_2 - B \cdot B\right)\right)\right)}}{t_3}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_1}{B}\\
\end{array}
\end{array}
if B < -1.95e146Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 2.7%
if -1.95e146 < B < -2.7999999999999999e-8Initial program 34.0%
Simplified34.0%
Taylor expanded in A around 0 30.9%
+-commutative30.9%
unpow230.9%
unpow230.9%
hypot-def33.1%
Simplified33.1%
Taylor expanded in B around -inf 31.3%
if -2.7999999999999999e-8 < B < 5.6000000000000001e-65Initial program 20.1%
Simplified20.1%
Taylor expanded in A around -inf 21.6%
distribute-frac-neg21.6%
associate-*l*21.5%
cancel-sign-sub-inv21.5%
metadata-eval21.5%
cancel-sign-sub-inv21.5%
metadata-eval21.5%
Applied egg-rr21.5%
if 5.6000000000000001e-65 < B < 1.2800000000000001e154Initial program 37.3%
Simplified37.3%
Taylor expanded in A around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def38.0%
Simplified38.0%
Taylor expanded in C around 0 37.9%
neg-mul-137.9%
Simplified37.9%
if 1.2800000000000001e154 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification21.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* F A)))
(t_1 (* (* A C) 4.0))
(t_2 (- (* B B) t_1))
(t_3 (* F t_2)))
(if (<= B -4.1e+147)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B -1.8e-14)
(- (/ (sqrt (* 2.0 (* B t_3))) t_2))
(if (<= B 7.5e-65)
(/ (- (sqrt (* 2.0 (* t_3 (* 2.0 A))))) t_2)
(if (<= B 1.1e+150)
(/ (- (sqrt (* 2.0 (* B (* F (- t_1 (* B B))))))) t_2)
(* -2.0 (/ t_0 B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double t_3 = F * t_2;
double tmp;
if (B <= -4.1e+147) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -1.8e-14) {
tmp = -(sqrt((2.0 * (B * t_3))) / t_2);
} else if (B <= 7.5e-65) {
tmp = -sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
} else if (B <= 1.1e+150) {
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((f * a))
t_1 = (a * c) * 4.0d0
t_2 = (b * b) - t_1
t_3 = f * t_2
if (b <= (-4.1d+147)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= (-1.8d-14)) then
tmp = -(sqrt((2.0d0 * (b * t_3))) / t_2)
else if (b <= 7.5d-65) then
tmp = -sqrt((2.0d0 * (t_3 * (2.0d0 * a)))) / t_2
else if (b <= 1.1d+150) then
tmp = -sqrt((2.0d0 * (b * (f * (t_1 - (b * b)))))) / t_2
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((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double t_3 = F * t_2;
double tmp;
if (B <= -4.1e+147) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -1.8e-14) {
tmp = -(Math.sqrt((2.0 * (B * t_3))) / t_2);
} else if (B <= 7.5e-65) {
tmp = -Math.sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
} else if (B <= 1.1e+150) {
tmp = -Math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((F * A)) t_1 = (A * C) * 4.0 t_2 = (B * B) - t_1 t_3 = F * t_2 tmp = 0 if B <= -4.1e+147: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= -1.8e-14: tmp = -(math.sqrt((2.0 * (B * t_3))) / t_2) elif B <= 7.5e-65: tmp = -math.sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2 elif B <= 1.1e+150: tmp = -math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2 else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(F * A)) t_1 = Float64(Float64(A * C) * 4.0) t_2 = Float64(Float64(B * B) - t_1) t_3 = Float64(F * t_2) tmp = 0.0 if (B <= -4.1e+147) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= -1.8e-14) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * t_3))) / t_2)); elseif (B <= 7.5e-65) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_3 * Float64(2.0 * A))))) / t_2); elseif (B <= 1.1e+150) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_1 - Float64(B * B))))))) / t_2); 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((F * A));
t_1 = (A * C) * 4.0;
t_2 = (B * B) - t_1;
t_3 = F * t_2;
tmp = 0.0;
if (B <= -4.1e+147)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= -1.8e-14)
tmp = -(sqrt((2.0 * (B * t_3))) / t_2);
elseif (B <= 7.5e-65)
tmp = -sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
elseif (B <= 1.1e+150)
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
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[(F * A), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(F * t$95$2), $MachinePrecision]}, If[LessEqual[B, -4.1e+147], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.8e-14], (-N[(N[Sqrt[N[(2.0 * N[(B * t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision]), If[LessEqual[B, 7.5e-65], N[((-N[Sqrt[N[(2.0 * N[(t$95$3 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 1.1e+150], N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$1 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $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{F \cdot A}\\
t_1 := \left(A \cdot C\right) \cdot 4\\
t_2 := B \cdot B - t_1\\
t_3 := F \cdot t_2\\
\mathbf{if}\;B \leq -4.1 \cdot 10^{+147}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.8 \cdot 10^{-14}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot t_3\right)}}{t_2}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_3 \cdot \left(2 \cdot A\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{+150}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_1 - B \cdot B\right)\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -4.09999999999999966e147Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 2.7%
if -4.09999999999999966e147 < B < -1.7999999999999999e-14Initial program 34.0%
Simplified34.0%
Taylor expanded in A around 0 30.9%
+-commutative30.9%
unpow230.9%
unpow230.9%
hypot-def33.1%
Simplified33.1%
Taylor expanded in B around -inf 31.3%
if -1.7999999999999999e-14 < B < 7.5000000000000002e-65Initial program 20.1%
Simplified20.1%
Taylor expanded in A around -inf 21.6%
if 7.5000000000000002e-65 < B < 1.1e150Initial program 37.3%
Simplified37.3%
Taylor expanded in A around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def38.0%
Simplified38.0%
Taylor expanded in C around 0 37.9%
neg-mul-137.9%
Simplified37.9%
if 1.1e150 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification21.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* F A)))
(t_1 (* (* A C) 4.0))
(t_2 (- (* B B) t_1))
(t_3 (* F t_2)))
(if (<= B -5.7e+146)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B -2.7e-6)
(/ (- (sqrt (* 2.0 (* t_3 (+ A (+ B C)))))) t_2)
(if (<= B 7.5e-65)
(/ (- (sqrt (* 2.0 (* t_3 (* 2.0 A))))) t_2)
(if (<= B 7.6e+153)
(/ (- (sqrt (* 2.0 (* B (* F (- t_1 (* B B))))))) t_2)
(* -2.0 (/ t_0 B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double t_3 = F * t_2;
double tmp;
if (B <= -5.7e+146) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -2.7e-6) {
tmp = -sqrt((2.0 * (t_3 * (A + (B + C))))) / t_2;
} else if (B <= 7.5e-65) {
tmp = -sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
} else if (B <= 7.6e+153) {
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} 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) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = sqrt((f * a))
t_1 = (a * c) * 4.0d0
t_2 = (b * b) - t_1
t_3 = f * t_2
if (b <= (-5.7d+146)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= (-2.7d-6)) then
tmp = -sqrt((2.0d0 * (t_3 * (a + (b + c))))) / t_2
else if (b <= 7.5d-65) then
tmp = -sqrt((2.0d0 * (t_3 * (2.0d0 * a)))) / t_2
else if (b <= 7.6d+153) then
tmp = -sqrt((2.0d0 * (b * (f * (t_1 - (b * b)))))) / t_2
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((F * A));
double t_1 = (A * C) * 4.0;
double t_2 = (B * B) - t_1;
double t_3 = F * t_2;
double tmp;
if (B <= -5.7e+146) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= -2.7e-6) {
tmp = -Math.sqrt((2.0 * (t_3 * (A + (B + C))))) / t_2;
} else if (B <= 7.5e-65) {
tmp = -Math.sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
} else if (B <= 7.6e+153) {
tmp = -Math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((F * A)) t_1 = (A * C) * 4.0 t_2 = (B * B) - t_1 t_3 = F * t_2 tmp = 0 if B <= -5.7e+146: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= -2.7e-6: tmp = -math.sqrt((2.0 * (t_3 * (A + (B + C))))) / t_2 elif B <= 7.5e-65: tmp = -math.sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2 elif B <= 7.6e+153: tmp = -math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2 else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(F * A)) t_1 = Float64(Float64(A * C) * 4.0) t_2 = Float64(Float64(B * B) - t_1) t_3 = Float64(F * t_2) tmp = 0.0 if (B <= -5.7e+146) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= -2.7e-6) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_3 * Float64(A + Float64(B + C)))))) / t_2); elseif (B <= 7.5e-65) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_3 * Float64(2.0 * A))))) / t_2); elseif (B <= 7.6e+153) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_1 - Float64(B * B))))))) / t_2); 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((F * A));
t_1 = (A * C) * 4.0;
t_2 = (B * B) - t_1;
t_3 = F * t_2;
tmp = 0.0;
if (B <= -5.7e+146)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= -2.7e-6)
tmp = -sqrt((2.0 * (t_3 * (A + (B + C))))) / t_2;
elseif (B <= 7.5e-65)
tmp = -sqrt((2.0 * (t_3 * (2.0 * A)))) / t_2;
elseif (B <= 7.6e+153)
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / t_2;
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[(F * A), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(F * t$95$2), $MachinePrecision]}, If[LessEqual[B, -5.7e+146], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.7e-6], N[((-N[Sqrt[N[(2.0 * N[(t$95$3 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 7.5e-65], N[((-N[Sqrt[N[(2.0 * N[(t$95$3 * N[(2.0 * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 7.6e+153], N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$1 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $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{F \cdot A}\\
t_1 := \left(A \cdot C\right) \cdot 4\\
t_2 := B \cdot B - t_1\\
t_3 := F \cdot t_2\\
\mathbf{if}\;B \leq -5.7 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -2.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_3 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{-65}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_3 \cdot \left(2 \cdot A\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 7.6 \cdot 10^{+153}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_1 - B \cdot B\right)\right)\right)}}{t_2}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -5.6999999999999999e146Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 2.7%
if -5.6999999999999999e146 < B < -2.69999999999999998e-6Initial program 35.4%
Simplified35.4%
Taylor expanded in B around -inf 32.7%
if -2.69999999999999998e-6 < B < 7.5000000000000002e-65Initial program 19.8%
Simplified19.8%
Taylor expanded in A around -inf 21.2%
if 7.5000000000000002e-65 < B < 7.59999999999999933e153Initial program 37.3%
Simplified37.3%
Taylor expanded in A around 0 37.7%
+-commutative37.7%
unpow237.7%
unpow237.7%
hypot-def38.0%
Simplified38.0%
Taylor expanded in C around 0 37.9%
neg-mul-137.9%
Simplified37.9%
if 7.59999999999999933e153 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around inf 6.9%
un-div-inv6.9%
Applied egg-rr6.9%
Final simplification21.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))))
(if (<= B -5.8e+149)
(* 2.0 (* (sqrt (* F A)) (/ 1.0 B)))
(if (<= B -1.55e-55)
(- (/ (sqrt (* 2.0 (* B (* F t_0)))) t_0))
(if (<= B 6e-6)
(/ (- (sqrt (* 2.0 (* (* 2.0 A) (* -4.0 (* A (* F C))))))) t_0)
(* -2.0 (/ (pow (* F A) 0.5) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= -5.8e+149) {
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
} else if (B <= -1.55e-55) {
tmp = -(sqrt((2.0 * (B * (F * t_0)))) / t_0);
} else if (B <= 6e-6) {
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_0;
} else {
tmp = -2.0 * (pow((F * A), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((a * c) * 4.0d0)
if (b <= (-5.8d+149)) then
tmp = 2.0d0 * (sqrt((f * a)) * (1.0d0 / b))
else if (b <= (-1.55d-55)) then
tmp = -(sqrt((2.0d0 * (b * (f * t_0)))) / t_0)
else if (b <= 6d-6) then
tmp = -sqrt((2.0d0 * ((2.0d0 * a) * ((-4.0d0) * (a * (f * c)))))) / t_0
else
tmp = (-2.0d0) * (((f * a) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
double tmp;
if (B <= -5.8e+149) {
tmp = 2.0 * (Math.sqrt((F * A)) * (1.0 / B));
} else if (B <= -1.55e-55) {
tmp = -(Math.sqrt((2.0 * (B * (F * t_0)))) / t_0);
} else if (B <= 6e-6) {
tmp = -Math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_0;
} else {
tmp = -2.0 * (Math.pow((F * A), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) tmp = 0 if B <= -5.8e+149: tmp = 2.0 * (math.sqrt((F * A)) * (1.0 / B)) elif B <= -1.55e-55: tmp = -(math.sqrt((2.0 * (B * (F * t_0)))) / t_0) elif B <= 6e-6: tmp = -math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_0 else: tmp = -2.0 * (math.pow((F * A), 0.5) / 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)) tmp = 0.0 if (B <= -5.8e+149) tmp = Float64(2.0 * Float64(sqrt(Float64(F * A)) * Float64(1.0 / B))); elseif (B <= -1.55e-55) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(B * Float64(F * t_0)))) / t_0)); elseif (B <= 6e-6) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(-4.0 * Float64(A * Float64(F * C))))))) / t_0); else tmp = Float64(-2.0 * Float64((Float64(F * A) ^ 0.5) / 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);
tmp = 0.0;
if (B <= -5.8e+149)
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
elseif (B <= -1.55e-55)
tmp = -(sqrt((2.0 * (B * (F * t_0)))) / t_0);
elseif (B <= 6e-6)
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / t_0;
else
tmp = -2.0 * (((F * A) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5.8e+149], N[(2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.55e-55], (-N[(N[Sqrt[N[(2.0 * N[(B * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 6e-6], N[((-N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(-4.0 * N[(A * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(F * A), $MachinePrecision], 0.5], $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\\
\mathbf{if}\;B \leq -5.8 \cdot 10^{+149}:\\
\;\;\;\;2 \cdot \left(\sqrt{F \cdot A} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.55 \cdot 10^{-55}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(B \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 6 \cdot 10^{-6}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(-4 \cdot \left(A \cdot \left(F \cdot C\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(F \cdot A\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -5.8000000000000004e149Initial program 0.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 2.7%
if -5.8000000000000004e149 < B < -1.54999999999999998e-55Initial program 36.4%
Simplified36.4%
Taylor expanded in A around 0 33.8%
+-commutative33.8%
unpow233.8%
unpow233.8%
hypot-def35.9%
Simplified35.9%
Taylor expanded in B around -inf 32.3%
if -1.54999999999999998e-55 < B < 6.0000000000000002e-6Initial program 20.7%
Simplified20.7%
Taylor expanded in A around -inf 22.0%
Taylor expanded in B around 0 19.6%
if 6.0000000000000002e-6 < B Initial program 13.6%
Simplified13.6%
Taylor expanded in A around -inf 0.9%
Taylor expanded in B around inf 5.0%
un-div-inv5.0%
Applied egg-rr5.0%
pow1/25.1%
Applied egg-rr5.1%
Final simplification16.5%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -3.3e+74)
(* 2.0 (* (sqrt (* F A)) (/ 1.0 B)))
(if (<= B 5.7e-6)
(/
(- (sqrt (* 2.0 (* (* 2.0 A) (* -4.0 (* A (* F C)))))))
(- (* B B) (* (* A C) 4.0)))
(* -2.0 (/ (pow (* F A) 0.5) B)))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -3.3e+74) {
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
} else if (B <= 5.7e-6) {
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = -2.0 * (pow((F * A), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-3.3d+74)) then
tmp = 2.0d0 * (sqrt((f * a)) * (1.0d0 / b))
else if (b <= 5.7d-6) then
tmp = -sqrt((2.0d0 * ((2.0d0 * a) * ((-4.0d0) * (a * (f * c)))))) / ((b * b) - ((a * c) * 4.0d0))
else
tmp = (-2.0d0) * (((f * a) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -3.3e+74) {
tmp = 2.0 * (Math.sqrt((F * A)) * (1.0 / B));
} else if (B <= 5.7e-6) {
tmp = -Math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0));
} else {
tmp = -2.0 * (Math.pow((F * A), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -3.3e+74: tmp = 2.0 * (math.sqrt((F * A)) * (1.0 / B)) elif B <= 5.7e-6: tmp = -math.sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0)) else: tmp = -2.0 * (math.pow((F * A), 0.5) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -3.3e+74) tmp = Float64(2.0 * Float64(sqrt(Float64(F * A)) * Float64(1.0 / B))); elseif (B <= 5.7e-6) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(2.0 * A) * Float64(-4.0 * Float64(A * Float64(F * C))))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); else tmp = Float64(-2.0 * Float64((Float64(F * A) ^ 0.5) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -3.3e+74)
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
elseif (B <= 5.7e-6)
tmp = -sqrt((2.0 * ((2.0 * A) * (-4.0 * (A * (F * C)))))) / ((B * B) - ((A * C) * 4.0));
else
tmp = -2.0 * (((F * A) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -3.3e+74], N[(2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 5.7e-6], N[((-N[Sqrt[N[(2.0 * N[(N[(2.0 * A), $MachinePrecision] * N[(-4.0 * N[(A * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(F * A), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.3 \cdot 10^{+74}:\\
\;\;\;\;2 \cdot \left(\sqrt{F \cdot A} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 5.7 \cdot 10^{-6}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(2 \cdot A\right) \cdot \left(-4 \cdot \left(A \cdot \left(F \cdot C\right)\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(F \cdot A\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -3.3000000000000002e74Initial program 13.4%
Simplified13.4%
Taylor expanded in A around -inf 1.6%
Taylor expanded in B around -inf 3.1%
if -3.3000000000000002e74 < B < 5.6999999999999996e-6Initial program 24.7%
Simplified24.7%
Taylor expanded in A around -inf 20.5%
Taylor expanded in B around 0 18.6%
if 5.6999999999999996e-6 < B Initial program 13.6%
Simplified13.6%
Taylor expanded in A around -inf 0.9%
Taylor expanded in B around inf 5.0%
un-div-inv5.0%
Applied egg-rr5.0%
pow1/25.1%
Applied egg-rr5.1%
Final simplification12.0%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= A -8e+145)
(* 2.0 (* (sqrt (* F A)) (/ 1.0 B)))
(/
(- (sqrt (* 2.0 (* -8.0 (* (* A A) (* F C))))))
(- (* B B) (* (* A C) 4.0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (A <= -8e+145) {
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
} else {
tmp = -sqrt((2.0 * (-8.0 * ((A * A) * (F * C))))) / ((B * B) - ((A * C) * 4.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) :: tmp
if (a <= (-8d+145)) then
tmp = 2.0d0 * (sqrt((f * a)) * (1.0d0 / b))
else
tmp = -sqrt((2.0d0 * ((-8.0d0) * ((a * a) * (f * c))))) / ((b * b) - ((a * c) * 4.0d0))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (A <= -8e+145) {
tmp = 2.0 * (Math.sqrt((F * A)) * (1.0 / B));
} else {
tmp = -Math.sqrt((2.0 * (-8.0 * ((A * A) * (F * C))))) / ((B * B) - ((A * C) * 4.0));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if A <= -8e+145: tmp = 2.0 * (math.sqrt((F * A)) * (1.0 / B)) else: tmp = -math.sqrt((2.0 * (-8.0 * ((A * A) * (F * C))))) / ((B * B) - ((A * C) * 4.0)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (A <= -8e+145) tmp = Float64(2.0 * Float64(sqrt(Float64(F * A)) * Float64(1.0 / B))); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(Float64(A * A) * Float64(F * C)))))) / Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (A <= -8e+145)
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
else
tmp = -sqrt((2.0 * (-8.0 * ((A * A) * (F * C))))) / ((B * B) - ((A * C) * 4.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_] := If[LessEqual[A, -8e+145], N[(2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(N[(A * A), $MachinePrecision] * N[(F * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(A * C), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -8 \cdot 10^{+145}:\\
\;\;\;\;2 \cdot \left(\sqrt{F \cdot A} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(\left(A \cdot A\right) \cdot \left(F \cdot C\right)\right)\right)}}{B \cdot B - \left(A \cdot C\right) \cdot 4}\\
\end{array}
\end{array}
if A < -7.9999999999999999e145Initial program 0.9%
Simplified0.9%
Taylor expanded in A around -inf 19.0%
Taylor expanded in B around -inf 1.8%
if -7.9999999999999999e145 < A Initial program 22.2%
Simplified22.2%
Taylor expanded in C around 0 21.0%
+-commutative21.0%
unpow221.0%
unpow221.0%
hypot-def21.5%
Simplified21.5%
Taylor expanded in A around -inf 9.7%
unpow29.7%
Simplified9.7%
Final simplification8.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -2e-310) (* 2.0 (* (sqrt (* F A)) (/ 1.0 B))) (* -2.0 (/ (pow (* F A) 0.5) B))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
} else {
tmp = -2.0 * (pow((F * A), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-2d-310)) then
tmp = 2.0d0 * (sqrt((f * a)) * (1.0d0 / b))
else
tmp = (-2.0d0) * (((f * a) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (Math.sqrt((F * A)) * (1.0 / B));
} else {
tmp = -2.0 * (Math.pow((F * A), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -2e-310: tmp = 2.0 * (math.sqrt((F * A)) * (1.0 / B)) else: tmp = -2.0 * (math.pow((F * A), 0.5) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -2e-310) tmp = Float64(2.0 * Float64(sqrt(Float64(F * A)) * Float64(1.0 / B))); else tmp = Float64(-2.0 * Float64((Float64(F * A) ^ 0.5) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -2e-310)
tmp = 2.0 * (sqrt((F * A)) * (1.0 / B));
else
tmp = -2.0 * (((F * A) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -2e-310], N[(2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(F * A), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \left(\sqrt{F \cdot A} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(F \cdot A\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -1.999999999999994e-310Initial program 20.8%
Simplified20.8%
Taylor expanded in A around -inf 13.3%
Taylor expanded in B around -inf 2.8%
if -1.999999999999994e-310 < B Initial program 18.1%
Simplified18.1%
Taylor expanded in A around -inf 9.8%
Taylor expanded in B around inf 3.2%
un-div-inv3.2%
Applied egg-rr3.2%
pow1/23.3%
Applied egg-rr3.3%
Final simplification3.0%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (pow (* F A) 0.5) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (pow((F * A), 0.5) / B);
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (((f * a) ** 0.5d0) / b)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.pow((F * A), 0.5) / B);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.pow((F * A), 0.5) / B)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64((Float64(F * A) ^ 0.5) / B)) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (((F * A) ^ 0.5) / 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[Power[N[(F * A), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{{\left(F \cdot A\right)}^{0.5}}{B}
\end{array}
Initial program 19.6%
Simplified19.6%
Taylor expanded in A around -inf 11.7%
Taylor expanded in B around inf 2.0%
un-div-inv2.0%
Applied egg-rr2.0%
pow1/22.1%
Applied egg-rr2.1%
Final simplification2.1%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* F A)) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((F * A)) / 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((f * a)) / b)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((F * A)) / B);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.sqrt((F * A)) / B)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(F * A)) / B)) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (sqrt((F * A)) / 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[(F * A), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{\sqrt{F \cdot A}}{B}
\end{array}
Initial program 19.6%
Simplified19.6%
Taylor expanded in A around -inf 11.7%
Taylor expanded in B around inf 2.0%
un-div-inv2.0%
Applied egg-rr2.0%
Final simplification2.0%
herbie shell --seed 2023194
(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))))