
(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 15 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 (* F (- A (hypot B A)))) (t_1 (- (pow B 2.0) (* C (* A 4.0)))))
(if (<= B -1.7e-57)
(/
(- (sqrt (* 2.0 (* (fma B B (* (* -4.0 A) C)) t_0))))
(+ (* B B) (* -4.0 (* A C))))
(if (<= B 1.02e+40)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (+ A A)))) t_1)
(* (pow t_0 0.5) (/ (- (sqrt 2.0)) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (A - hypot(B, A));
double t_1 = pow(B, 2.0) - (C * (A * 4.0));
double tmp;
if (B <= -1.7e-57) {
tmp = -sqrt((2.0 * (fma(B, B, ((-4.0 * A) * C)) * t_0))) / ((B * B) + (-4.0 * (A * C)));
} else if (B <= 1.02e+40) {
tmp = -sqrt(((2.0 * (F * t_1)) * (A + A))) / t_1;
} else {
tmp = pow(t_0, 0.5) * (-sqrt(2.0) / B);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(A - hypot(B, A))) t_1 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) tmp = 0.0 if (B <= -1.7e-57) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(fma(B, B, Float64(Float64(-4.0 * A) * C)) * t_0)))) / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))); elseif (B <= 1.02e+40) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(A + A)))) / t_1); else tmp = Float64((t_0 ^ 0.5) * Float64(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[(F * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.7e-57], N[((-N[Sqrt[N[(2.0 * N[(N[(B * B + N[(N[(-4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.02e+40], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Power[t$95$0, 0.5], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)\\
t_1 := {B}^{2} - C \cdot \left(A \cdot 4\right)\\
\mathbf{if}\;B \leq -1.7 \cdot 10^{-57}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, \left(-4 \cdot A\right) \cdot C\right) \cdot t_0\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B \leq 1.02 \cdot 10^{+40}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A + A\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;{t_0}^{0.5} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -1.70000000000000008e-57Initial program 20.0%
Taylor expanded in C around 0 15.9%
unpow215.9%
unpow215.9%
hypot-def18.4%
Simplified18.4%
*-un-lft-identity18.4%
associate-*l*18.3%
pow218.3%
associate-*l*18.3%
pow218.3%
associate-*l*18.3%
Applied egg-rr18.3%
*-lft-identity18.3%
associate-*r*18.4%
unpow218.4%
cancel-sign-sub-inv18.4%
unpow218.4%
metadata-eval18.4%
unpow218.4%
cancel-sign-sub-inv18.4%
Simplified18.4%
*-un-lft-identity18.4%
associate-*l*18.3%
fma-def18.3%
Applied egg-rr18.3%
*-lft-identity18.3%
associate-*l*19.5%
associate-*r*19.5%
Simplified19.5%
if -1.70000000000000008e-57 < B < 1.02e40Initial program 21.0%
Taylor expanded in C around inf 23.6%
sub-neg23.6%
mul-1-neg23.6%
remove-double-neg23.6%
Simplified23.6%
if 1.02e40 < B Initial program 11.4%
Taylor expanded in C around 0 20.0%
mul-1-neg20.0%
*-commutative20.0%
distribute-rgt-neg-in20.0%
*-commutative20.0%
unpow220.0%
unpow220.0%
hypot-def55.4%
Simplified55.4%
pow1/255.4%
Applied egg-rr55.4%
Final simplification28.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 (- (pow B 2.0) (* C (* A 4.0))))
(t_1 (+ (* B B) (* -4.0 (* A C))))
(t_2 (- A (hypot B A))))
(if (<= B -1.3e-56)
(/ (- (sqrt (* t_2 (* 2.0 (* F t_1))))) t_1)
(if (<= B 3.2e+39)
(/ (- (sqrt (* (* 2.0 (* F t_0)) (+ A A)))) t_0)
(* (pow (* F t_2) 0.5) (/ (- (sqrt 2.0)) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - (C * (A * 4.0));
double t_1 = (B * B) + (-4.0 * (A * C));
double t_2 = A - hypot(B, A);
double tmp;
if (B <= -1.3e-56) {
tmp = -sqrt((t_2 * (2.0 * (F * t_1)))) / t_1;
} else if (B <= 3.2e+39) {
tmp = -sqrt(((2.0 * (F * t_0)) * (A + A))) / t_0;
} else {
tmp = pow((F * t_2), 0.5) * (-sqrt(2.0) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - (C * (A * 4.0));
double t_1 = (B * B) + (-4.0 * (A * C));
double t_2 = A - Math.hypot(B, A);
double tmp;
if (B <= -1.3e-56) {
tmp = -Math.sqrt((t_2 * (2.0 * (F * t_1)))) / t_1;
} else if (B <= 3.2e+39) {
tmp = -Math.sqrt(((2.0 * (F * t_0)) * (A + A))) / t_0;
} else {
tmp = Math.pow((F * t_2), 0.5) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.pow(B, 2.0) - (C * (A * 4.0)) t_1 = (B * B) + (-4.0 * (A * C)) t_2 = A - math.hypot(B, A) tmp = 0 if B <= -1.3e-56: tmp = -math.sqrt((t_2 * (2.0 * (F * t_1)))) / t_1 elif B <= 3.2e+39: tmp = -math.sqrt(((2.0 * (F * t_0)) * (A + A))) / t_0 else: tmp = math.pow((F * t_2), 0.5) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0))) t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) t_2 = Float64(A - hypot(B, A)) tmp = 0.0 if (B <= -1.3e-56) tmp = Float64(Float64(-sqrt(Float64(t_2 * Float64(2.0 * Float64(F * t_1))))) / t_1); elseif (B <= 3.2e+39) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A + A)))) / t_0); else tmp = Float64((Float64(F * t_2) ^ 0.5) * 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 ^ 2.0) - (C * (A * 4.0));
t_1 = (B * B) + (-4.0 * (A * C));
t_2 = A - hypot(B, A);
tmp = 0.0;
if (B <= -1.3e-56)
tmp = -sqrt((t_2 * (2.0 * (F * t_1)))) / t_1;
elseif (B <= 3.2e+39)
tmp = -sqrt(((2.0 * (F * t_0)) * (A + A))) / t_0;
else
tmp = ((F * t_2) ^ 0.5) * (-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[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.3e-56], N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 3.2e+39], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Power[N[(F * t$95$2), $MachinePrecision], 0.5], $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}^{2} - C \cdot \left(A \cdot 4\right)\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_2 := A - \mathsf{hypot}\left(B, A\right)\\
\mathbf{if}\;B \leq -1.3 \cdot 10^{-56}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \left(2 \cdot \left(F \cdot t_1\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 3.2 \cdot 10^{+39}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A + A\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;{\left(F \cdot t_2\right)}^{0.5} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -1.29999999999999998e-56Initial program 20.0%
Taylor expanded in C around 0 15.9%
unpow215.9%
unpow215.9%
hypot-def18.4%
Simplified18.4%
*-un-lft-identity18.4%
associate-*l*18.3%
pow218.3%
associate-*l*18.3%
pow218.3%
associate-*l*18.3%
Applied egg-rr18.3%
*-lft-identity18.3%
associate-*r*18.4%
unpow218.4%
cancel-sign-sub-inv18.4%
unpow218.4%
metadata-eval18.4%
unpow218.4%
cancel-sign-sub-inv18.4%
Simplified18.4%
if -1.29999999999999998e-56 < B < 3.19999999999999993e39Initial program 21.0%
Taylor expanded in C around inf 23.6%
sub-neg23.6%
mul-1-neg23.6%
remove-double-neg23.6%
Simplified23.6%
if 3.19999999999999993e39 < B Initial program 11.4%
Taylor expanded in C around 0 20.0%
mul-1-neg20.0%
*-commutative20.0%
distribute-rgt-neg-in20.0%
*-commutative20.0%
unpow220.0%
unpow220.0%
hypot-def55.4%
Simplified55.4%
pow1/255.4%
Applied egg-rr55.4%
Final simplification27.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 (- A (hypot B A)))
(t_2 (/ (- (sqrt (* t_1 (* 2.0 (* F t_0))))) t_0)))
(if (<= B -3.7e-203)
t_2
(if (<= B 1.8e-237)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= B 1.35e+41)
t_2
(* (pow (* F t_1) 0.5) (/ (- (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 = A - hypot(B, A);
double t_2 = -sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -3.7e-203) {
tmp = t_2;
} else if (B <= 1.8e-237) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 1.35e+41) {
tmp = t_2;
} else {
tmp = pow((F * t_1), 0.5) * (-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) + (-4.0 * (A * C));
double t_1 = A - Math.hypot(B, A);
double t_2 = -Math.sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -3.7e-203) {
tmp = t_2;
} else if (B <= 1.8e-237) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 1.35e+41) {
tmp = t_2;
} else {
tmp = Math.pow((F * t_1), 0.5) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) t_1 = A - math.hypot(B, A) t_2 = -math.sqrt((t_1 * (2.0 * (F * t_0)))) / t_0 tmp = 0 if B <= -3.7e-203: tmp = t_2 elif B <= 1.8e-237: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif B <= 1.35e+41: tmp = t_2 else: tmp = math.pow((F * t_1), 0.5) * (-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(-4.0 * Float64(A * C))) t_1 = Float64(A - hypot(B, A)) t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(F * t_0))))) / t_0) tmp = 0.0 if (B <= -3.7e-203) tmp = t_2; elseif (B <= 1.8e-237) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (B <= 1.35e+41) tmp = t_2; else tmp = Float64((Float64(F * t_1) ^ 0.5) * 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) + (-4.0 * (A * C));
t_1 = A - hypot(B, A);
t_2 = -sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
tmp = 0.0;
if (B <= -3.7e-203)
tmp = t_2;
elseif (B <= 1.8e-237)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.0)));
elseif (B <= 1.35e+41)
tmp = t_2;
else
tmp = ((F * t_1) ^ 0.5) * (-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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -3.7e-203], t$95$2, If[LessEqual[B, 1.8e-237], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.35e+41], t$95$2, N[(N[Power[N[(F * t$95$1), $MachinePrecision], 0.5], $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 + -4 \cdot \left(A \cdot C\right)\\
t_1 := A - \mathsf{hypot}\left(B, A\right)\\
t_2 := \frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -3.7 \cdot 10^{-203}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 1.8 \cdot 10^{-237}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;B \leq 1.35 \cdot 10^{+41}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;{\left(F \cdot t_1\right)}^{0.5} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -3.70000000000000002e-203 or 1.79999999999999998e-237 < B < 1.35e41Initial program 22.0%
Taylor expanded in C around 0 18.3%
unpow218.3%
unpow218.3%
hypot-def21.3%
Simplified21.3%
*-un-lft-identity21.3%
associate-*l*21.3%
pow221.3%
associate-*l*21.3%
pow221.3%
associate-*l*21.3%
Applied egg-rr21.3%
*-lft-identity21.3%
associate-*r*21.3%
unpow221.3%
cancel-sign-sub-inv21.3%
unpow221.3%
metadata-eval21.3%
unpow221.3%
cancel-sign-sub-inv21.3%
Simplified21.3%
if -3.70000000000000002e-203 < B < 1.79999999999999998e-237Initial program 12.5%
Taylor expanded in C around 0 15.4%
unpow215.4%
unpow215.4%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around -inf 22.2%
unpow222.2%
Simplified22.2%
if 1.35e41 < B Initial program 11.4%
Taylor expanded in C around 0 20.0%
mul-1-neg20.0%
*-commutative20.0%
distribute-rgt-neg-in20.0%
*-commutative20.0%
unpow220.0%
unpow220.0%
hypot-def55.4%
Simplified55.4%
pow1/255.4%
Applied egg-rr55.4%
Final simplification27.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 (- A (hypot B A)))
(t_2 (/ (- (sqrt (* t_1 (* 2.0 (* F t_0))))) t_0)))
(if (<= B -4.8e-203)
t_2
(if (<= B 3.8e-242)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= B 5.5e+40) t_2 (* (/ (sqrt 2.0) B) (- (sqrt (* F t_1)))))))))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 = A - hypot(B, A);
double t_2 = -sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -4.8e-203) {
tmp = t_2;
} else if (B <= 3.8e-242) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 5.5e+40) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * t_1));
}
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 = A - Math.hypot(B, A);
double t_2 = -Math.sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -4.8e-203) {
tmp = t_2;
} else if (B <= 3.8e-242) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 5.5e+40) {
tmp = t_2;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * t_1));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) t_1 = A - math.hypot(B, A) t_2 = -math.sqrt((t_1 * (2.0 * (F * t_0)))) / t_0 tmp = 0 if B <= -4.8e-203: tmp = t_2 elif B <= 3.8e-242: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif B <= 5.5e+40: tmp = t_2 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * t_1)) 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(A - hypot(B, A)) t_2 = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(F * t_0))))) / t_0) tmp = 0.0 if (B <= -4.8e-203) tmp = t_2; elseif (B <= 3.8e-242) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (B <= 5.5e+40) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * t_1)))); 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 = A - hypot(B, A);
t_2 = -sqrt((t_1 * (2.0 * (F * t_0)))) / t_0;
tmp = 0.0;
if (B <= -4.8e-203)
tmp = t_2;
elseif (B <= 3.8e-242)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.0)));
elseif (B <= 5.5e+40)
tmp = t_2;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * 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[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -4.8e-203], t$95$2, If[LessEqual[B, 3.8e-242], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 5.5e+40], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * t$95$1), $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 := A - \mathsf{hypot}\left(B, A\right)\\
t_2 := \frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -4.8 \cdot 10^{-203}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{-242}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;B \leq 5.5 \cdot 10^{+40}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot t_1}\right)\\
\end{array}
\end{array}
if B < -4.7999999999999997e-203 or 3.8000000000000002e-242 < B < 5.49999999999999974e40Initial program 22.0%
Taylor expanded in C around 0 18.3%
unpow218.3%
unpow218.3%
hypot-def21.3%
Simplified21.3%
*-un-lft-identity21.3%
associate-*l*21.3%
pow221.3%
associate-*l*21.3%
pow221.3%
associate-*l*21.3%
Applied egg-rr21.3%
*-lft-identity21.3%
associate-*r*21.3%
unpow221.3%
cancel-sign-sub-inv21.3%
unpow221.3%
metadata-eval21.3%
unpow221.3%
cancel-sign-sub-inv21.3%
Simplified21.3%
if -4.7999999999999997e-203 < B < 3.8000000000000002e-242Initial program 12.5%
Taylor expanded in C around 0 15.4%
unpow215.4%
unpow215.4%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around -inf 22.2%
unpow222.2%
Simplified22.2%
if 5.49999999999999974e40 < B Initial program 11.4%
Taylor expanded in C around 0 20.0%
mul-1-neg20.0%
*-commutative20.0%
distribute-rgt-neg-in20.0%
*-commutative20.0%
unpow220.0%
unpow220.0%
hypot-def55.4%
Simplified55.4%
Final simplification27.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 (hypot B A)) (* 2.0 (* F t_0))))))
(if (<= B -5.1e-203)
(/ (- t_1) t_0)
(if (<= B 1.5e-233)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= B 1.05e+45)
(* t_1 (/ -1.0 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 = sqrt(((A - hypot(B, A)) * (2.0 * (F * t_0))));
double tmp;
if (B <= -5.1e-203) {
tmp = -t_1 / t_0;
} else if (B <= 1.5e-233) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 1.05e+45) {
tmp = t_1 * (-1.0 / 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 = Math.sqrt(((A - Math.hypot(B, A)) * (2.0 * (F * t_0))));
double tmp;
if (B <= -5.1e-203) {
tmp = -t_1 / t_0;
} else if (B <= 1.5e-233) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 1.05e+45) {
tmp = t_1 * (-1.0 / 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 = math.sqrt(((A - math.hypot(B, A)) * (2.0 * (F * t_0)))) tmp = 0 if B <= -5.1e-203: tmp = -t_1 / t_0 elif B <= 1.5e-233: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif B <= 1.05e+45: tmp = t_1 * (-1.0 / 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 = sqrt(Float64(Float64(A - hypot(B, A)) * Float64(2.0 * Float64(F * t_0)))) tmp = 0.0 if (B <= -5.1e-203) tmp = Float64(Float64(-t_1) / t_0); elseif (B <= 1.5e-233) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (B <= 1.05e+45) tmp = Float64(t_1 * Float64(-1.0 / t_0)); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * 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 = sqrt(((A - hypot(B, A)) * (2.0 * (F * t_0))));
tmp = 0.0;
if (B <= -5.1e-203)
tmp = -t_1 / t_0;
elseif (B <= 1.5e-233)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.0)));
elseif (B <= 1.05e+45)
tmp = t_1 * (-1.0 / 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[Sqrt[N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -5.1e-203], N[((-t$95$1) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.5e-233], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.05e+45], N[(t$95$1 * N[(-1.0 / t$95$0), $MachinePrecision]), $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 := \sqrt{\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}\\
\mathbf{if}\;B \leq -5.1 \cdot 10^{-203}:\\
\;\;\;\;\frac{-t_1}{t_0}\\
\mathbf{elif}\;B \leq 1.5 \cdot 10^{-233}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;B \leq 1.05 \cdot 10^{+45}:\\
\;\;\;\;t_1 \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < -5.09999999999999985e-203Initial program 22.1%
Taylor expanded in C around 0 17.7%
unpow217.7%
unpow217.7%
hypot-def19.9%
Simplified19.9%
*-un-lft-identity19.9%
associate-*l*19.9%
pow219.9%
associate-*l*19.9%
pow219.9%
associate-*l*19.9%
Applied egg-rr19.9%
*-lft-identity19.9%
associate-*r*19.9%
unpow219.9%
cancel-sign-sub-inv19.9%
unpow219.9%
metadata-eval19.9%
unpow219.9%
cancel-sign-sub-inv19.9%
Simplified19.9%
if -5.09999999999999985e-203 < B < 1.49999999999999999e-233Initial program 12.5%
Taylor expanded in C around 0 15.4%
unpow215.4%
unpow215.4%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around -inf 22.2%
unpow222.2%
Simplified22.2%
if 1.49999999999999999e-233 < B < 1.04999999999999997e45Initial program 21.5%
Taylor expanded in C around 0 19.1%
unpow219.1%
unpow219.1%
hypot-def23.4%
Simplified23.4%
div-inv23.4%
associate-*l*23.4%
pow223.4%
associate-*l*23.4%
pow223.4%
associate-*l*23.4%
Applied egg-rr23.4%
associate-*r*23.4%
unpow223.4%
cancel-sign-sub-inv23.4%
unpow223.4%
metadata-eval23.4%
unpow223.4%
cancel-sign-sub-inv23.4%
unpow223.4%
metadata-eval23.4%
Simplified23.4%
if 1.04999999999999997e45 < B Initial program 11.6%
Taylor expanded in B around inf 8.7%
Taylor expanded in C around 0 56.5%
associate-*r*56.5%
neg-mul-156.5%
distribute-neg-frac56.5%
Simplified56.5%
Final simplification27.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 (hypot B A)) (* 2.0 (* F t_0))))) t_0)))
(if (<= B -2.95e-203)
t_1
(if (<= B 6.5e-236)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= B 2.3e+45)
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) + (-4.0 * (A * C));
double t_1 = -sqrt(((A - hypot(B, A)) * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -2.95e-203) {
tmp = t_1;
} else if (B <= 6.5e-236) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 2.3e+45) {
tmp = 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) + (-4.0 * (A * C));
double t_1 = -Math.sqrt(((A - Math.hypot(B, A)) * (2.0 * (F * t_0)))) / t_0;
double tmp;
if (B <= -2.95e-203) {
tmp = t_1;
} else if (B <= 6.5e-236) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 2.3e+45) {
tmp = 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) + (-4.0 * (A * C)) t_1 = -math.sqrt(((A - math.hypot(B, A)) * (2.0 * (F * t_0)))) / t_0 tmp = 0 if B <= -2.95e-203: tmp = t_1 elif B <= 6.5e-236: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif B <= 2.3e+45: tmp = 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(-4.0 * Float64(A * C))) t_1 = Float64(Float64(-sqrt(Float64(Float64(A - hypot(B, A)) * Float64(2.0 * Float64(F * t_0))))) / t_0) tmp = 0.0 if (B <= -2.95e-203) tmp = t_1; elseif (B <= 6.5e-236) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (B <= 2.3e+45) tmp = t_1; else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * 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 = -sqrt(((A - hypot(B, A)) * (2.0 * (F * t_0)))) / t_0;
tmp = 0.0;
if (B <= -2.95e-203)
tmp = t_1;
elseif (B <= 6.5e-236)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.0)));
elseif (B <= 2.3e+45)
tmp = 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-N[Sqrt[N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[B, -2.95e-203], t$95$1, If[LessEqual[B, 6.5e-236], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.3e+45], t$95$1, 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 := \frac{-\sqrt{\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{if}\;B \leq -2.95 \cdot 10^{-203}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{-236}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{+45}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < -2.95e-203 or 6.5000000000000001e-236 < B < 2.30000000000000012e45Initial program 21.9%
Taylor expanded in C around 0 18.2%
unpow218.2%
unpow218.2%
hypot-def21.2%
Simplified21.2%
*-un-lft-identity21.2%
associate-*l*21.2%
pow221.2%
associate-*l*21.2%
pow221.2%
associate-*l*21.2%
Applied egg-rr21.2%
*-lft-identity21.2%
associate-*r*21.2%
unpow221.2%
cancel-sign-sub-inv21.2%
unpow221.2%
metadata-eval21.2%
unpow221.2%
cancel-sign-sub-inv21.2%
Simplified21.2%
if -2.95e-203 < B < 6.5000000000000001e-236Initial program 12.5%
Taylor expanded in C around 0 15.4%
unpow215.4%
unpow215.4%
hypot-def16.1%
Simplified16.1%
Taylor expanded in A around -inf 22.2%
unpow222.2%
Simplified22.2%
if 2.30000000000000012e45 < B Initial program 11.6%
Taylor expanded in B around inf 8.7%
Taylor expanded in C around 0 56.5%
associate-*r*56.5%
neg-mul-156.5%
distribute-neg-frac56.5%
Simplified56.5%
Final simplification27.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 (- A (hypot B A))))
(if (<= B -1.55e+28)
(/ (- (sqrt (* t_1 (* 2.0 (* F (* B B)))))) t_0)
(if (<= B 4.5e-242)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(if (<= B 4.7e-83)
(/ (- (sqrt (* t_1 (* 2.0 (* (* (* -4.0 A) C) F))))) 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 = A - hypot(B, A);
double tmp;
if (B <= -1.55e+28) {
tmp = -sqrt((t_1 * (2.0 * (F * (B * B))))) / t_0;
} else if (B <= 4.5e-242) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 4.7e-83) {
tmp = -sqrt((t_1 * (2.0 * (((-4.0 * A) * C) * F)))) / 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 = A - Math.hypot(B, A);
double tmp;
if (B <= -1.55e+28) {
tmp = -Math.sqrt((t_1 * (2.0 * (F * (B * B))))) / t_0;
} else if (B <= 4.5e-242) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.0)));
} else if (B <= 4.7e-83) {
tmp = -Math.sqrt((t_1 * (2.0 * (((-4.0 * A) * C) * F)))) / 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 = A - math.hypot(B, A) tmp = 0 if B <= -1.55e+28: tmp = -math.sqrt((t_1 * (2.0 * (F * (B * B))))) / t_0 elif B <= 4.5e-242: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.0))) elif B <= 4.7e-83: tmp = -math.sqrt((t_1 * (2.0 * (((-4.0 * A) * C) * F)))) / 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(A - hypot(B, A)) tmp = 0.0 if (B <= -1.55e+28) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(F * Float64(B * B)))))) / t_0); elseif (B <= 4.5e-242) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); elseif (B <= 4.7e-83) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * Float64(Float64(Float64(-4.0 * A) * C) * F))))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * 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 = A - hypot(B, A);
tmp = 0.0;
if (B <= -1.55e+28)
tmp = -sqrt((t_1 * (2.0 * (F * (B * B))))) / t_0;
elseif (B <= 4.5e-242)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.0)));
elseif (B <= 4.7e-83)
tmp = -sqrt((t_1 * (2.0 * (((-4.0 * A) * C) * F)))) / 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[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.55e+28], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 4.5e-242], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.7e-83], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * N[(N[(N[(-4.0 * A), $MachinePrecision] * C), $MachinePrecision] * F), $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 := A - \mathsf{hypot}\left(B, A\right)\\
\mathbf{if}\;B \leq -1.55 \cdot 10^{+28}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{-242}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{elif}\;B \leq 4.7 \cdot 10^{-83}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(2 \cdot \left(\left(\left(-4 \cdot A\right) \cdot C\right) \cdot F\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < -1.55e28Initial program 16.5%
Taylor expanded in C around 0 11.3%
unpow211.3%
unpow211.3%
hypot-def13.0%
Simplified13.0%
*-un-lft-identity13.0%
associate-*l*13.0%
pow213.0%
associate-*l*13.0%
pow213.0%
associate-*l*13.0%
Applied egg-rr13.0%
*-lft-identity13.0%
associate-*r*13.0%
unpow213.0%
cancel-sign-sub-inv13.0%
unpow213.0%
metadata-eval13.0%
unpow213.0%
cancel-sign-sub-inv13.0%
Simplified13.0%
Taylor expanded in B around inf 13.4%
unpow213.4%
Simplified13.4%
if -1.55e28 < B < 4.4999999999999999e-242Initial program 22.8%
Taylor expanded in C around 0 21.8%
unpow221.8%
unpow221.8%
hypot-def23.9%
Simplified23.9%
Taylor expanded in A around -inf 21.8%
unpow221.8%
Simplified21.8%
if 4.4999999999999999e-242 < B < 4.7000000000000003e-83Initial program 12.5%
Taylor expanded in C around 0 10.4%
unpow210.4%
unpow210.4%
hypot-def14.9%
Simplified14.9%
*-un-lft-identity14.9%
associate-*l*14.9%
pow214.9%
associate-*l*14.9%
pow214.9%
associate-*l*14.9%
Applied egg-rr14.9%
*-lft-identity14.9%
associate-*r*14.9%
unpow214.9%
cancel-sign-sub-inv14.9%
unpow214.9%
metadata-eval14.9%
unpow214.9%
cancel-sign-sub-inv14.9%
Simplified14.9%
Taylor expanded in B around 0 14.9%
associate-*r*14.9%
Simplified14.9%
if 4.7000000000000003e-83 < B Initial program 20.2%
Taylor expanded in B around inf 14.6%
Taylor expanded in C around 0 44.9%
associate-*r*44.9%
neg-mul-144.9%
distribute-neg-frac44.9%
Simplified44.9%
Final simplification25.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -1.6e+28)
(/
(- (sqrt (* (- A (hypot B A)) (* 2.0 (* F (* B B))))))
(+ (* B B) (* -4.0 (* A C))))
(if (<= B 125000.0)
(/
(- (sqrt (* -16.0 (* (* A A) (* C F)))))
(- (pow B 2.0) (* C (* A 4.0))))
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (- A B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.6e+28) {
tmp = -sqrt(((A - hypot(B, A)) * (2.0 * (F * (B * B))))) / ((B * B) + (-4.0 * (A * C)));
} else if (B <= 125000.0) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.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 tmp;
if (B <= -1.6e+28) {
tmp = -Math.sqrt(((A - Math.hypot(B, A)) * (2.0 * (F * (B * B))))) / ((B * B) + (-4.0 * (A * C)));
} else if (B <= 125000.0) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.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): tmp = 0 if B <= -1.6e+28: tmp = -math.sqrt(((A - math.hypot(B, A)) * (2.0 * (F * (B * B))))) / ((B * B) + (-4.0 * (A * C))) elif B <= 125000.0: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.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) tmp = 0.0 if (B <= -1.6e+28) tmp = Float64(Float64(-sqrt(Float64(Float64(A - hypot(B, A)) * Float64(2.0 * Float64(F * Float64(B * B)))))) / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))); elseif (B <= 125000.0) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(A - B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.6e+28)
tmp = -sqrt(((A - hypot(B, A)) * (2.0 * (F * (B * B))))) / ((B * B) + (-4.0 * (A * C)));
elseif (B <= 125000.0)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.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_] := If[LessEqual[B, -1.6e+28], N[((-N[Sqrt[N[(N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 125000.0], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;B \leq -1.6 \cdot 10^{+28}:\\
\;\;\;\;\frac{-\sqrt{\left(A - \mathsf{hypot}\left(B, A\right)\right) \cdot \left(2 \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{B \cdot B + -4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B \leq 125000:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < -1.6e28Initial program 16.5%
Taylor expanded in C around 0 11.3%
unpow211.3%
unpow211.3%
hypot-def13.0%
Simplified13.0%
*-un-lft-identity13.0%
associate-*l*13.0%
pow213.0%
associate-*l*13.0%
pow213.0%
associate-*l*13.0%
Applied egg-rr13.0%
*-lft-identity13.0%
associate-*r*13.0%
unpow213.0%
cancel-sign-sub-inv13.0%
unpow213.0%
metadata-eval13.0%
unpow213.0%
cancel-sign-sub-inv13.0%
Simplified13.0%
Taylor expanded in B around inf 13.4%
unpow213.4%
Simplified13.4%
if -1.6e28 < B < 125000Initial program 21.7%
Taylor expanded in C around 0 20.5%
unpow220.5%
unpow220.5%
hypot-def23.1%
Simplified23.1%
Taylor expanded in A around -inf 16.1%
unpow216.1%
Simplified16.1%
if 125000 < B Initial program 14.3%
Taylor expanded in B around inf 10.8%
Taylor expanded in C around 0 54.2%
associate-*r*54.2%
neg-mul-154.2%
distribute-neg-frac54.2%
Simplified54.2%
Final simplification23.2%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B 52000.0) (/ (- (sqrt (* -16.0 (* (* A A) (* C F))))) (- (pow B 2.0) (* C (* A 4.0)))) (* (/ (- (sqrt 2.0)) B) (sqrt (* F (- A B))))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 52000.0) {
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / (pow(B, 2.0) - (C * (A * 4.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) :: tmp
if (b <= 52000.0d0) then
tmp = -sqrt(((-16.0d0) * ((a * a) * (c * f)))) / ((b ** 2.0d0) - (c * (a * 4.0d0)))
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 tmp;
if (B <= 52000.0) {
tmp = -Math.sqrt((-16.0 * ((A * A) * (C * F)))) / (Math.pow(B, 2.0) - (C * (A * 4.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): tmp = 0 if B <= 52000.0: tmp = -math.sqrt((-16.0 * ((A * A) * (C * F)))) / (math.pow(B, 2.0) - (C * (A * 4.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) tmp = 0.0 if (B <= 52000.0) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(Float64(A * A) * Float64(C * F))))) / Float64((B ^ 2.0) - Float64(C * Float64(A * 4.0)))); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(A - B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 52000.0)
tmp = -sqrt((-16.0 * ((A * A) * (C * F)))) / ((B ^ 2.0) - (C * (A * 4.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_] := If[LessEqual[B, 52000.0], N[((-N[Sqrt[N[(-16.0 * N[(N[(A * A), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[Power[B, 2.0], $MachinePrecision] - N[(C * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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}
\mathbf{if}\;B \leq 52000:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(\left(A \cdot A\right) \cdot \left(C \cdot F\right)\right)}}{{B}^{2} - C \cdot \left(A \cdot 4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < 52000Initial program 20.1%
Taylor expanded in C around 0 17.6%
unpow217.6%
unpow217.6%
hypot-def20.0%
Simplified20.0%
Taylor expanded in A around -inf 12.2%
unpow212.2%
Simplified12.2%
if 52000 < B Initial program 14.3%
Taylor expanded in B around inf 10.8%
Taylor expanded in C around 0 54.2%
associate-*r*54.2%
neg-mul-154.2%
distribute-neg-frac54.2%
Simplified54.2%
Final simplification20.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (- (sqrt 2.0)) B)))
(if (<= B 5.9e-263)
(* t_0 (sqrt (* F (/ (* (* B B) -0.5) C))))
(* t_0 (sqrt (* F (- A B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0) / B;
double tmp;
if (B <= 5.9e-263) {
tmp = t_0 * sqrt((F * (((B * B) * -0.5) / C)));
} else {
tmp = t_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) :: tmp
t_0 = -sqrt(2.0d0) / b
if (b <= 5.9d-263) then
tmp = t_0 * sqrt((f * (((b * b) * (-0.5d0)) / c)))
else
tmp = t_0 * 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 = -Math.sqrt(2.0) / B;
double tmp;
if (B <= 5.9e-263) {
tmp = t_0 * Math.sqrt((F * (((B * B) * -0.5) / C)));
} else {
tmp = t_0 * Math.sqrt((F * (A - B)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) / B tmp = 0 if B <= 5.9e-263: tmp = t_0 * math.sqrt((F * (((B * B) * -0.5) / C))) else: tmp = t_0 * math.sqrt((F * (A - B))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(-sqrt(2.0)) / B) tmp = 0.0 if (B <= 5.9e-263) tmp = Float64(t_0 * sqrt(Float64(F * Float64(Float64(Float64(B * B) * -0.5) / C)))); else tmp = Float64(t_0 * 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 = -sqrt(2.0) / B;
tmp = 0.0;
if (B <= 5.9e-263)
tmp = t_0 * sqrt((F * (((B * B) * -0.5) / C)));
else
tmp = t_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[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]}, If[LessEqual[B, 5.9e-263], N[(t$95$0 * N[Sqrt[N[(F * N[(N[(N[(B * B), $MachinePrecision] * -0.5), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * 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 := \frac{-\sqrt{2}}{B}\\
\mathbf{if}\;B \leq 5.9 \cdot 10^{-263}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \frac{\left(B \cdot B\right) \cdot -0.5}{C}}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < 5.89999999999999972e-263Initial program 20.7%
add-cbrt-cube14.8%
pow314.9%
unpow214.9%
unpow214.9%
hypot-def14.9%
Applied egg-rr14.9%
Taylor expanded in A around 0 1.5%
associate-*r*1.5%
neg-mul-11.5%
distribute-neg-frac1.5%
unpow21.5%
unpow21.5%
hypot-def2.4%
Simplified2.4%
Taylor expanded in C around inf 6.6%
associate-*r/6.6%
unpow26.6%
Simplified6.6%
if 5.89999999999999972e-263 < B Initial program 16.9%
Taylor expanded in B around inf 11.0%
Taylor expanded in C around 0 30.6%
associate-*r*30.6%
neg-mul-130.6%
distribute-neg-frac30.6%
Simplified30.6%
Final simplification17.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))))
(if (<= B 9.5e-226)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C B))))))) 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 <= 9.5e-226) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / 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) :: tmp
t_0 = (b * b) + ((-4.0d0) * (a * c))
if (b <= 9.5d-226) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + (c - b)))))) / 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 tmp;
if (B <= 9.5e-226) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / 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 <= 9.5e-226: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / 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 <= 9.5e-226) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - B))))))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * 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 <= 9.5e-226)
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / 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, 9.5e-226], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $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 9.5 \cdot 10^{-226}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - B\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(A - B\right)}\\
\end{array}
\end{array}
if B < 9.5000000000000007e-226Initial program 19.6%
Taylor expanded in B around inf 4.6%
*-un-lft-identity4.6%
associate-*l*4.6%
pow24.6%
associate-*l*4.6%
associate--l+4.6%
pow24.6%
associate-*l*4.6%
Applied egg-rr4.6%
*-lft-identity4.6%
associate-*l*4.8%
unpow24.8%
cancel-sign-sub-inv4.8%
unpow24.8%
metadata-eval4.8%
unpow24.8%
cancel-sign-sub-inv4.8%
unpow24.8%
metadata-eval4.8%
Simplified4.8%
if 9.5000000000000007e-226 < B Initial program 18.0%
Taylor expanded in B around inf 11.4%
Taylor expanded in C around 0 32.8%
associate-*r*32.8%
neg-mul-132.8%
distribute-neg-frac32.8%
Simplified32.8%
Final simplification16.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 4.3e-226)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A (- C B))))))) t_0)
(* (/ (- (sqrt 2.0)) B) (sqrt (* F (- B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 4.3e-226) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
} else {
tmp = (-sqrt(2.0) / B) * sqrt((F * -B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) + ((-4.0d0) * (a * c))
if (b <= 4.3d-226) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + (c - b)))))) / t_0
else
tmp = (-sqrt(2.0d0) / b) * sqrt((f * -b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 4.3e-226) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
} else {
tmp = (-Math.sqrt(2.0) / B) * Math.sqrt((F * -B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 4.3e-226: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0 else: tmp = (-math.sqrt(2.0) / B) * math.sqrt((F * -B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 4.3e-226) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - B))))))) / t_0); else tmp = Float64(Float64(Float64(-sqrt(2.0)) / B) * sqrt(Float64(F * Float64(-B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + (-4.0 * (A * C));
tmp = 0.0;
if (B <= 4.3e-226)
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
else
tmp = (-sqrt(2.0) / B) * sqrt((F * -B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.3e-226], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision] * N[Sqrt[N[(F * (-B)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 4.3 \cdot 10^{-226}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - B\right)\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{B} \cdot \sqrt{F \cdot \left(-B\right)}\\
\end{array}
\end{array}
if B < 4.30000000000000024e-226Initial program 19.6%
Taylor expanded in B around inf 4.6%
*-un-lft-identity4.6%
associate-*l*4.6%
pow24.6%
associate-*l*4.6%
associate--l+4.6%
pow24.6%
associate-*l*4.6%
Applied egg-rr4.6%
*-lft-identity4.6%
associate-*l*4.8%
unpow24.8%
cancel-sign-sub-inv4.8%
unpow24.8%
metadata-eval4.8%
unpow24.8%
cancel-sign-sub-inv4.8%
unpow24.8%
metadata-eval4.8%
Simplified4.8%
if 4.30000000000000024e-226 < B Initial program 18.0%
add-cbrt-cube13.6%
pow313.5%
unpow213.5%
unpow213.5%
hypot-def13.5%
Applied egg-rr13.5%
Taylor expanded in A around 0 18.4%
associate-*r*18.4%
neg-mul-118.4%
distribute-neg-frac18.4%
unpow218.4%
unpow218.4%
hypot-def36.8%
Simplified36.8%
Taylor expanded in C around 0 33.2%
mul-1-neg33.2%
Simplified33.2%
Final simplification16.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)))) (/ (- (sqrt (* 2.0 (* (+ A (- C B)) (* F t_0))))) t_0)))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((A * C) * 4.0);
return -sqrt((2.0 * ((A + (C - B)) * (F * t_0)))) / t_0;
}
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
t_0 = (b * b) - ((a * c) * 4.0d0)
code = -sqrt((2.0d0 * ((a + (c - b)) * (f * t_0)))) / t_0
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);
return -Math.sqrt((2.0 * ((A + (C - B)) * (F * t_0)))) / t_0;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((A * C) * 4.0) return -math.sqrt((2.0 * ((A + (C - B)) * (F * t_0)))) / t_0
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(A * C) * 4.0)) return Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + Float64(C - B)) * Float64(F * t_0))))) / t_0) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
t_0 = (B * B) - ((A * C) * 4.0);
tmp = -sqrt((2.0 * ((A + (C - B)) * (F * t_0)))) / t_0;
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]}, N[((-N[Sqrt[N[(2.0 * N[(N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $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\\
\frac{-\sqrt{2 \cdot \left(\left(A + \left(C - B\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}
\end{array}
\end{array}
Initial program 18.9%
Taylor expanded in B around inf 7.5%
distribute-frac-neg7.5%
associate-*l*7.5%
pow27.5%
associate-*l*7.5%
associate--l+7.5%
pow27.5%
associate-*l*7.5%
Applied egg-rr7.5%
Final simplification7.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))))) (/ (- (sqrt (* 2.0 (* t_0 (* F (+ 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));
return -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
}
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
t_0 = (b * b) + ((-4.0d0) * (a * c))
code = -sqrt((2.0d0 * (t_0 * (f * (a + (c - b)))))) / t_0
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));
return -Math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) return -math.sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) return Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - B))))))) / t_0) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
t_0 = (B * B) + (-4.0 * (A * C));
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - B)))))) / t_0;
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]}, N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - B), $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 + -4 \cdot \left(A \cdot C\right)\\
\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - B\right)\right)\right)\right)}}{t_0}
\end{array}
\end{array}
Initial program 18.9%
Taylor expanded in B around inf 7.5%
*-un-lft-identity7.5%
associate-*l*7.5%
pow27.5%
associate-*l*7.5%
associate--l+7.5%
pow27.5%
associate-*l*7.5%
Applied egg-rr7.5%
*-lft-identity7.5%
associate-*l*7.7%
unpow27.7%
cancel-sign-sub-inv7.7%
unpow27.7%
metadata-eval7.7%
unpow27.7%
cancel-sign-sub-inv7.7%
unpow27.7%
metadata-eval7.7%
Simplified7.7%
Final simplification7.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (* (sqrt (* C F)) (* B (- 2.0))) (+ (* B B) (* -4.0 (* A C)))))
assert(A < C);
double code(double A, double B, double C, double F) {
return (sqrt((C * F)) * (B * -2.0)) / ((B * B) + (-4.0 * (A * 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((c * f)) * (b * -2.0d0)) / ((b * b) + ((-4.0d0) * (a * c)))
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (Math.sqrt((C * F)) * (B * -2.0)) / ((B * B) + (-4.0 * (A * C)));
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (math.sqrt((C * F)) * (B * -2.0)) / ((B * B) + (-4.0 * (A * C)))
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(sqrt(Float64(C * F)) * Float64(B * Float64(-2.0))) / Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (sqrt((C * F)) * (B * -2.0)) / ((B * B) + (-4.0 * (A * C)));
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(B * (-2.0)), $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{\sqrt{C \cdot F} \cdot \left(B \cdot \left(-2\right)\right)}{B \cdot B + -4 \cdot \left(A \cdot C\right)}
\end{array}
Initial program 18.9%
Taylor expanded in C around 0 16.1%
unpow216.1%
unpow216.1%
hypot-def18.3%
Simplified18.3%
*-un-lft-identity18.3%
associate-*l*18.2%
pow218.2%
associate-*l*18.2%
pow218.2%
associate-*l*18.2%
Applied egg-rr18.2%
*-lft-identity18.2%
associate-*r*18.3%
unpow218.3%
cancel-sign-sub-inv18.3%
unpow218.3%
metadata-eval18.3%
unpow218.3%
cancel-sign-sub-inv18.3%
Simplified18.3%
Taylor expanded in B around 0 2.8%
unpow22.8%
rem-square-sqrt2.8%
Simplified2.8%
Final simplification2.8%
herbie shell --seed 2023187
(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))))