
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* C A) 4.0)))
(t_1 (+ C (hypot C B)))
(t_2 (/ (sqrt 2.0) B))
(t_3 (sqrt (+ C (+ A (hypot B (- A C))))))
(t_4 (* 2.0 (* F t_0))))
(if (<= B -4.2e+118)
(* (sqrt (* t_1 F)) t_2)
(if (<= B -8.5e-62)
(/
(*
(* (sqrt 2.0) (* (sqrt F) (sqrt (fma B B (* -4.0 (* C A))))))
(- t_3))
t_0)
(if (<= B 7.2e-59)
(- (/ (sqrt (* t_4 (* C 2.0))) t_0))
(if (<= B 2.4e+20)
(/ (* t_3 (- (sqrt t_4))) t_0)
(* t_2 (* (sqrt t_1) (- (sqrt F))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = C + hypot(C, B);
double t_2 = sqrt(2.0) / B;
double t_3 = sqrt((C + (A + hypot(B, (A - C)))));
double t_4 = 2.0 * (F * t_0);
double tmp;
if (B <= -4.2e+118) {
tmp = sqrt((t_1 * F)) * t_2;
} else if (B <= -8.5e-62) {
tmp = ((sqrt(2.0) * (sqrt(F) * sqrt(fma(B, B, (-4.0 * (C * A)))))) * -t_3) / t_0;
} else if (B <= 7.2e-59) {
tmp = -(sqrt((t_4 * (C * 2.0))) / t_0);
} else if (B <= 2.4e+20) {
tmp = (t_3 * -sqrt(t_4)) / t_0;
} else {
tmp = t_2 * (sqrt(t_1) * -sqrt(F));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(C + hypot(C, B)) t_2 = Float64(sqrt(2.0) / B) t_3 = sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) t_4 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= -4.2e+118) tmp = Float64(sqrt(Float64(t_1 * F)) * t_2); elseif (B <= -8.5e-62) tmp = Float64(Float64(Float64(sqrt(2.0) * Float64(sqrt(F) * sqrt(fma(B, B, Float64(-4.0 * Float64(C * A)))))) * Float64(-t_3)) / t_0); elseif (B <= 7.2e-59) tmp = Float64(-Float64(sqrt(Float64(t_4 * Float64(C * 2.0))) / t_0)); elseif (B <= 2.4e+20) tmp = Float64(Float64(t_3 * Float64(-sqrt(t_4))) / t_0); else tmp = Float64(t_2 * Float64(sqrt(t_1) * Float64(-sqrt(F)))); 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[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.2e+118], N[(N[Sqrt[N[(t$95$1 * F), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[B, -8.5e-62], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(B * B + N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-t$95$3)), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 7.2e-59], (-N[(N[Sqrt[N[(t$95$4 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 2.4e+20], N[(N[(t$95$3 * (-N[Sqrt[t$95$4], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$2 * N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := C + \mathsf{hypot}\left(C, B\right)\\
t_2 := \frac{\sqrt{2}}{B}\\
t_3 := \sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\\
t_4 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+118}:\\
\;\;\;\;\sqrt{t_1 \cdot F} \cdot t_2\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{-62}:\\
\;\;\;\;\frac{\left(\sqrt{2} \cdot \left(\sqrt{F} \cdot \sqrt{\mathsf{fma}\left(B, B, -4 \cdot \left(C \cdot A\right)\right)}\right)\right) \cdot \left(-t_3\right)}{t_0}\\
\mathbf{elif}\;B \leq 7.2 \cdot 10^{-59}:\\
\;\;\;\;-\frac{\sqrt{t_4 \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.4 \cdot 10^{+20}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{t_4}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{t_1} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -4.2e118Initial program 5.0%
associate-*l*5.0%
unpow25.0%
+-commutative5.0%
unpow25.0%
associate-*l*5.0%
unpow25.0%
Simplified5.0%
sqrt-prod9.8%
*-commutative9.8%
*-commutative9.8%
associate-+l+9.8%
unpow29.8%
hypot-udef9.9%
associate-+r+9.9%
+-commutative9.9%
associate-+r+9.7%
Applied egg-rr9.7%
Taylor expanded in B around -inf 10.9%
mul-1-neg10.9%
associate-*l*11.0%
Simplified11.0%
Taylor expanded in A around 0 12.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-def64.4%
Simplified64.4%
if -4.2e118 < B < -8.4999999999999995e-62Initial program 38.3%
associate-*l*38.3%
unpow238.3%
+-commutative38.3%
unpow238.3%
associate-*l*38.3%
unpow238.3%
Simplified38.3%
sqrt-prod51.0%
*-commutative51.0%
*-commutative51.0%
associate-+l+51.3%
unpow251.3%
hypot-udef59.4%
associate-+r+58.6%
+-commutative58.6%
associate-+r+58.5%
Applied egg-rr58.5%
sqrt-prod58.5%
cancel-sign-sub-inv58.5%
*-commutative58.5%
metadata-eval58.5%
*-commutative58.5%
Applied egg-rr58.5%
sqrt-prod60.5%
fma-def60.5%
Applied egg-rr60.5%
if -8.4999999999999995e-62 < B < 7.20000000000000001e-59Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 26.5%
if 7.20000000000000001e-59 < B < 2.4e20Initial program 59.0%
associate-*l*59.0%
unpow259.0%
+-commutative59.0%
unpow259.0%
associate-*l*59.0%
unpow259.0%
Simplified59.0%
sqrt-prod65.6%
*-commutative65.6%
*-commutative65.6%
associate-+l+65.6%
unpow265.6%
hypot-udef80.0%
associate-+r+78.8%
+-commutative78.8%
associate-+r+78.8%
Applied egg-rr78.8%
if 2.4e20 < B Initial program 9.8%
Simplified11.7%
Taylor expanded in A around 0 12.2%
mul-1-neg12.2%
*-commutative12.2%
unpow212.2%
unpow212.2%
Simplified12.2%
sqrt-prod15.3%
hypot-udef68.2%
Applied egg-rr68.2%
hypot-def15.3%
unpow215.3%
unpow215.3%
+-commutative15.3%
unpow215.3%
unpow215.3%
hypot-def68.2%
Simplified68.2%
Final simplification49.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) (* (* C A) 4.0)))
(t_1 (+ C (hypot C B)))
(t_2 (/ (sqrt 2.0) B))
(t_3 (* 2.0 (* F t_0)))
(t_4 (/ (* (sqrt (+ C (+ A (hypot B (- A C))))) (- (sqrt t_3))) t_0)))
(if (<= B -1.05e+108)
(* (sqrt (* t_1 F)) t_2)
(if (<= B -9.6e-64)
t_4
(if (<= B 9e-59)
(- (/ (sqrt (* t_3 (* C 2.0))) t_0))
(if (<= B 2.45e+20) t_4 (* t_2 (* (sqrt t_1) (- (sqrt F))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = C + hypot(C, B);
double t_2 = sqrt(2.0) / B;
double t_3 = 2.0 * (F * t_0);
double t_4 = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt(t_3)) / t_0;
double tmp;
if (B <= -1.05e+108) {
tmp = sqrt((t_1 * F)) * t_2;
} else if (B <= -9.6e-64) {
tmp = t_4;
} else if (B <= 9e-59) {
tmp = -(sqrt((t_3 * (C * 2.0))) / t_0);
} else if (B <= 2.45e+20) {
tmp = t_4;
} else {
tmp = t_2 * (sqrt(t_1) * -sqrt(F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = C + Math.hypot(C, B);
double t_2 = Math.sqrt(2.0) / B;
double t_3 = 2.0 * (F * t_0);
double t_4 = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * -Math.sqrt(t_3)) / t_0;
double tmp;
if (B <= -1.05e+108) {
tmp = Math.sqrt((t_1 * F)) * t_2;
} else if (B <= -9.6e-64) {
tmp = t_4;
} else if (B <= 9e-59) {
tmp = -(Math.sqrt((t_3 * (C * 2.0))) / t_0);
} else if (B <= 2.45e+20) {
tmp = t_4;
} else {
tmp = t_2 * (Math.sqrt(t_1) * -Math.sqrt(F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = C + math.hypot(C, B) t_2 = math.sqrt(2.0) / B t_3 = 2.0 * (F * t_0) t_4 = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * -math.sqrt(t_3)) / t_0 tmp = 0 if B <= -1.05e+108: tmp = math.sqrt((t_1 * F)) * t_2 elif B <= -9.6e-64: tmp = t_4 elif B <= 9e-59: tmp = -(math.sqrt((t_3 * (C * 2.0))) / t_0) elif B <= 2.45e+20: tmp = t_4 else: tmp = t_2 * (math.sqrt(t_1) * -math.sqrt(F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(C + hypot(C, B)) t_2 = Float64(sqrt(2.0) / B) t_3 = Float64(2.0 * Float64(F * t_0)) t_4 = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(-sqrt(t_3))) / t_0) tmp = 0.0 if (B <= -1.05e+108) tmp = Float64(sqrt(Float64(t_1 * F)) * t_2); elseif (B <= -9.6e-64) tmp = t_4; elseif (B <= 9e-59) tmp = Float64(-Float64(sqrt(Float64(t_3 * Float64(C * 2.0))) / t_0)); elseif (B <= 2.45e+20) tmp = t_4; else tmp = Float64(t_2 * Float64(sqrt(t_1) * Float64(-sqrt(F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = C + hypot(C, B);
t_2 = sqrt(2.0) / B;
t_3 = 2.0 * (F * t_0);
t_4 = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt(t_3)) / t_0;
tmp = 0.0;
if (B <= -1.05e+108)
tmp = sqrt((t_1 * F)) * t_2;
elseif (B <= -9.6e-64)
tmp = t_4;
elseif (B <= 9e-59)
tmp = -(sqrt((t_3 * (C * 2.0))) / t_0);
elseif (B <= 2.45e+20)
tmp = t_4;
else
tmp = t_2 * (sqrt(t_1) * -sqrt(F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$3], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.05e+108], N[(N[Sqrt[N[(t$95$1 * F), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision], If[LessEqual[B, -9.6e-64], t$95$4, If[LessEqual[B, 9e-59], (-N[(N[Sqrt[N[(t$95$3 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 2.45e+20], t$95$4, N[(t$95$2 * N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := C + \mathsf{hypot}\left(C, B\right)\\
t_2 := \frac{\sqrt{2}}{B}\\
t_3 := 2 \cdot \left(F \cdot t_0\right)\\
t_4 := \frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{t_3}\right)}{t_0}\\
\mathbf{if}\;B \leq -1.05 \cdot 10^{+108}:\\
\;\;\;\;\sqrt{t_1 \cdot F} \cdot t_2\\
\mathbf{elif}\;B \leq -9.6 \cdot 10^{-64}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;B \leq 9 \cdot 10^{-59}:\\
\;\;\;\;-\frac{\sqrt{t_3 \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{elif}\;B \leq 2.45 \cdot 10^{+20}:\\
\;\;\;\;t_4\\
\mathbf{else}:\\
\;\;\;\;t_2 \cdot \left(\sqrt{t_1} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -1.05000000000000005e108Initial program 5.0%
associate-*l*5.0%
unpow25.0%
+-commutative5.0%
unpow25.0%
associate-*l*5.0%
unpow25.0%
Simplified5.0%
sqrt-prod9.8%
*-commutative9.8%
*-commutative9.8%
associate-+l+9.8%
unpow29.8%
hypot-udef9.9%
associate-+r+9.9%
+-commutative9.9%
associate-+r+9.7%
Applied egg-rr9.7%
Taylor expanded in B around -inf 10.9%
mul-1-neg10.9%
associate-*l*11.0%
Simplified11.0%
Taylor expanded in A around 0 12.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-def64.4%
Simplified64.4%
if -1.05000000000000005e108 < B < -9.59999999999999994e-64 or 9.00000000000000023e-59 < B < 2.45e20Initial program 43.9%
associate-*l*43.9%
unpow243.9%
+-commutative43.9%
unpow243.9%
associate-*l*43.9%
unpow243.9%
Simplified43.9%
sqrt-prod54.9%
*-commutative54.9%
*-commutative54.9%
associate-+l+55.2%
unpow255.2%
hypot-udef64.9%
associate-+r+64.1%
+-commutative64.1%
associate-+r+64.0%
Applied egg-rr64.0%
if -9.59999999999999994e-64 < B < 9.00000000000000023e-59Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 26.5%
if 2.45e20 < B Initial program 9.8%
Simplified11.7%
Taylor expanded in A around 0 12.2%
mul-1-neg12.2%
*-commutative12.2%
unpow212.2%
unpow212.2%
Simplified12.2%
sqrt-prod15.3%
hypot-udef68.2%
Applied egg-rr68.2%
hypot-def15.3%
unpow215.3%
unpow215.3%
+-commutative15.3%
unpow215.3%
unpow215.3%
hypot-def68.2%
Simplified68.2%
Final simplification49.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) (* (* C A) 4.0)))
(t_1 (* 2.0 (* F t_0)))
(t_2 (/ (* (sqrt (+ C (+ A (hypot B (- A C))))) (- (sqrt t_1))) t_0)))
(if (<= B -1.45e+104)
(* (sqrt (* (+ C (hypot C B)) F)) (/ (sqrt 2.0) B))
(if (<= B -3.4e-62)
t_2
(if (<= B 6.5e-59)
(- (/ (sqrt (* t_1 (* C 2.0))) t_0))
(if (<= B 7.4e+57)
t_2
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double t_2 = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt(t_1)) / t_0;
double tmp;
if (B <= -1.45e+104) {
tmp = sqrt(((C + hypot(C, B)) * F)) * (sqrt(2.0) / B);
} else if (B <= -3.4e-62) {
tmp = t_2;
} else if (B <= 6.5e-59) {
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
} else if (B <= 7.4e+57) {
tmp = t_2;
} else {
tmp = sqrt((F * (C + hypot(B, C)))) * (-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) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double t_2 = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * -Math.sqrt(t_1)) / t_0;
double tmp;
if (B <= -1.45e+104) {
tmp = Math.sqrt(((C + Math.hypot(C, B)) * F)) * (Math.sqrt(2.0) / B);
} else if (B <= -3.4e-62) {
tmp = t_2;
} else if (B <= 6.5e-59) {
tmp = -(Math.sqrt((t_1 * (C * 2.0))) / t_0);
} else if (B <= 7.4e+57) {
tmp = t_2;
} else {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = 2.0 * (F * t_0) t_2 = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * -math.sqrt(t_1)) / t_0 tmp = 0 if B <= -1.45e+104: tmp = math.sqrt(((C + math.hypot(C, B)) * F)) * (math.sqrt(2.0) / B) elif B <= -3.4e-62: tmp = t_2 elif B <= 6.5e-59: tmp = -(math.sqrt((t_1 * (C * 2.0))) / t_0) elif B <= 7.4e+57: tmp = t_2 else: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) t_2 = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(-sqrt(t_1))) / t_0) tmp = 0.0 if (B <= -1.45e+104) tmp = Float64(sqrt(Float64(Float64(C + hypot(C, B)) * F)) * Float64(sqrt(2.0) / B)); elseif (B <= -3.4e-62) tmp = t_2; elseif (B <= 6.5e-59) tmp = Float64(-Float64(sqrt(Float64(t_1 * Float64(C * 2.0))) / t_0)); elseif (B <= 7.4e+57) tmp = t_2; else tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * 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) - ((C * A) * 4.0);
t_1 = 2.0 * (F * t_0);
t_2 = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt(t_1)) / t_0;
tmp = 0.0;
if (B <= -1.45e+104)
tmp = sqrt(((C + hypot(C, B)) * F)) * (sqrt(2.0) / B);
elseif (B <= -3.4e-62)
tmp = t_2;
elseif (B <= 6.5e-59)
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
elseif (B <= 7.4e+57)
tmp = t_2;
else
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$1], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.45e+104], N[(N[Sqrt[N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -3.4e-62], t$95$2, If[LessEqual[B, 6.5e-59], (-N[(N[Sqrt[N[(t$95$1 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 7.4e+57], t$95$2, N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
t_2 := \frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{t_1}\right)}{t_0}\\
\mathbf{if}\;B \leq -1.45 \cdot 10^{+104}:\\
\;\;\;\;\sqrt{\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot F} \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq -3.4 \cdot 10^{-62}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{-59}:\\
\;\;\;\;-\frac{\sqrt{t_1 \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{elif}\;B \leq 7.4 \cdot 10^{+57}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -1.4499999999999999e104Initial program 5.0%
associate-*l*5.0%
unpow25.0%
+-commutative5.0%
unpow25.0%
associate-*l*5.0%
unpow25.0%
Simplified5.0%
sqrt-prod9.8%
*-commutative9.8%
*-commutative9.8%
associate-+l+9.8%
unpow29.8%
hypot-udef9.9%
associate-+r+9.9%
+-commutative9.9%
associate-+r+9.7%
Applied egg-rr9.7%
Taylor expanded in B around -inf 10.9%
mul-1-neg10.9%
associate-*l*11.0%
Simplified11.0%
Taylor expanded in A around 0 12.0%
+-commutative12.0%
unpow212.0%
unpow212.0%
hypot-def64.4%
Simplified64.4%
if -1.4499999999999999e104 < B < -3.39999999999999988e-62 or 6.50000000000000017e-59 < B < 7.40000000000000011e57Initial program 43.1%
associate-*l*43.1%
unpow243.1%
+-commutative43.1%
unpow243.1%
associate-*l*43.1%
unpow243.1%
Simplified43.1%
sqrt-prod54.6%
*-commutative54.6%
*-commutative54.6%
associate-+l+54.8%
unpow254.8%
hypot-udef63.5%
associate-+r+62.8%
+-commutative62.8%
associate-+r+63.0%
Applied egg-rr63.0%
if -3.39999999999999988e-62 < B < 6.50000000000000017e-59Initial program 21.9%
associate-*l*21.9%
unpow221.9%
+-commutative21.9%
unpow221.9%
associate-*l*21.9%
unpow221.9%
Simplified21.9%
Taylor expanded in A around -inf 26.5%
if 7.40000000000000011e57 < B Initial program 6.6%
Simplified8.4%
Taylor expanded in A around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
distribute-rgt-neg-in9.1%
*-commutative9.1%
unpow29.1%
unpow29.1%
hypot-def51.1%
Simplified51.1%
Final simplification45.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* (+ C (hypot C B)) F))) (t_1 (- (* B B) (* (* C A) 4.0))))
(if (<= B -2.05e-58)
(* t_0 (/ (sqrt 2.0) B))
(if (<= B 1.8e+47)
(/ (* (sqrt (* 2.0 (* F t_1))) (- (sqrt (+ C C)))) t_1)
(/ (- (sqrt 2.0)) (/ B t_0))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(((C + hypot(C, B)) * F));
double t_1 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -2.05e-58) {
tmp = t_0 * (sqrt(2.0) / B);
} else if (B <= 1.8e+47) {
tmp = (sqrt((2.0 * (F * t_1))) * -sqrt((C + C))) / t_1;
} else {
tmp = -sqrt(2.0) / (B / t_0);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(((C + Math.hypot(C, B)) * F));
double t_1 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -2.05e-58) {
tmp = t_0 * (Math.sqrt(2.0) / B);
} else if (B <= 1.8e+47) {
tmp = (Math.sqrt((2.0 * (F * t_1))) * -Math.sqrt((C + C))) / t_1;
} else {
tmp = -Math.sqrt(2.0) / (B / t_0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(((C + math.hypot(C, B)) * F)) t_1 = (B * B) - ((C * A) * 4.0) tmp = 0 if B <= -2.05e-58: tmp = t_0 * (math.sqrt(2.0) / B) elif B <= 1.8e+47: tmp = (math.sqrt((2.0 * (F * t_1))) * -math.sqrt((C + C))) / t_1 else: tmp = -math.sqrt(2.0) / (B / t_0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(Float64(C + hypot(C, B)) * F)) t_1 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) tmp = 0.0 if (B <= -2.05e-58) tmp = Float64(t_0 * Float64(sqrt(2.0) / B)); elseif (B <= 1.8e+47) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_1))) * Float64(-sqrt(Float64(C + C)))) / t_1); else tmp = Float64(Float64(-sqrt(2.0)) / Float64(B / t_0)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(((C + hypot(C, B)) * F));
t_1 = (B * B) - ((C * A) * 4.0);
tmp = 0.0;
if (B <= -2.05e-58)
tmp = t_0 * (sqrt(2.0) / B);
elseif (B <= 1.8e+47)
tmp = (sqrt((2.0 * (F * t_1))) * -sqrt((C + C))) / t_1;
else
tmp = -sqrt(2.0) / (B / t_0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.05e-58], N[(t$95$0 * N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.8e+47], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], N[((-N[Sqrt[2.0], $MachinePrecision]) / N[(B / t$95$0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot F}\\
t_1 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
\mathbf{if}\;B \leq -2.05 \cdot 10^{-58}:\\
\;\;\;\;t_0 \cdot \frac{\sqrt{2}}{B}\\
\mathbf{elif}\;B \leq 1.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_1\right)} \cdot \left(-\sqrt{C + C}\right)}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2}}{\frac{B}{t_0}}\\
\end{array}
\end{array}
if B < -2.05000000000000014e-58Initial program 21.3%
associate-*l*21.3%
unpow221.3%
+-commutative21.3%
unpow221.3%
associate-*l*21.3%
unpow221.3%
Simplified21.3%
sqrt-prod29.9%
*-commutative29.9%
*-commutative29.9%
associate-+l+30.1%
unpow230.1%
hypot-udef33.8%
associate-+r+33.7%
+-commutative33.7%
associate-+r+33.6%
Applied egg-rr33.6%
Taylor expanded in B around -inf 31.2%
mul-1-neg31.2%
associate-*l*31.3%
Simplified31.3%
Taylor expanded in A around 0 27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def55.4%
Simplified55.4%
if -2.05000000000000014e-58 < B < 1.80000000000000004e47Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod26.6%
*-commutative26.6%
*-commutative26.6%
associate-+l+27.5%
unpow227.5%
hypot-udef38.6%
associate-+r+37.1%
+-commutative37.1%
associate-+r+37.9%
Applied egg-rr37.9%
Taylor expanded in A around -inf 21.3%
if 1.80000000000000004e47 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
associate-*l/12.6%
hypot-udef52.9%
Applied egg-rr52.9%
associate-/l*52.9%
hypot-def12.7%
unpow212.7%
unpow212.7%
+-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def52.9%
Simplified52.9%
Final simplification38.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 (- (* B B) (* (* C A) 4.0))) (t_1 (/ (sqrt 2.0) B)))
(if (<= B -2.4e-58)
(* (sqrt (* (+ C (hypot C B)) F)) t_1)
(if (<= B 1.45e+37)
(/ (* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C C)))) t_0)
(* t_1 (- (sqrt (* F (+ C (hypot B C))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = sqrt(2.0) / B;
double tmp;
if (B <= -2.4e-58) {
tmp = sqrt(((C + hypot(C, B)) * F)) * t_1;
} else if (B <= 1.45e+37) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
} else {
tmp = t_1 * -sqrt((F * (C + hypot(B, C))));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -2.4e-58) {
tmp = Math.sqrt(((C + Math.hypot(C, B)) * F)) * t_1;
} else if (B <= 1.45e+37) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + C))) / t_0;
} else {
tmp = t_1 * -Math.sqrt((F * (C + Math.hypot(B, C))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = math.sqrt(2.0) / B tmp = 0 if B <= -2.4e-58: tmp = math.sqrt(((C + math.hypot(C, B)) * F)) * t_1 elif B <= 1.45e+37: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + C))) / t_0 else: tmp = t_1 * -math.sqrt((F * (C + math.hypot(B, C)))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -2.4e-58) tmp = Float64(sqrt(Float64(Float64(C + hypot(C, B)) * F)) * t_1); elseif (B <= 1.45e+37) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + C)))) / t_0); else tmp = Float64(t_1 * Float64(-sqrt(Float64(F * Float64(C + hypot(B, C)))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -2.4e-58)
tmp = sqrt(((C + hypot(C, B)) * F)) * t_1;
elseif (B <= 1.45e+37)
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
else
tmp = t_1 * -sqrt((F * (C + hypot(B, C))));
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[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -2.4e-58], N[(N[Sqrt[N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, 1.45e+37], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$1 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -2.4 \cdot 10^{-58}:\\
\;\;\;\;\sqrt{\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot F} \cdot t_1\\
\mathbf{elif}\;B \leq 1.45 \cdot 10^{+37}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}\right)\\
\end{array}
\end{array}
if B < -2.4000000000000001e-58Initial program 21.3%
associate-*l*21.3%
unpow221.3%
+-commutative21.3%
unpow221.3%
associate-*l*21.3%
unpow221.3%
Simplified21.3%
sqrt-prod29.9%
*-commutative29.9%
*-commutative29.9%
associate-+l+30.1%
unpow230.1%
hypot-udef33.8%
associate-+r+33.7%
+-commutative33.7%
associate-+r+33.6%
Applied egg-rr33.6%
Taylor expanded in B around -inf 31.2%
mul-1-neg31.2%
associate-*l*31.3%
Simplified31.3%
Taylor expanded in A around 0 27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def55.4%
Simplified55.4%
if -2.4000000000000001e-58 < B < 1.44999999999999989e37Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod26.6%
*-commutative26.6%
*-commutative26.6%
associate-+l+27.5%
unpow227.5%
hypot-udef38.6%
associate-+r+37.1%
+-commutative37.1%
associate-+r+37.9%
Applied egg-rr37.9%
Taylor expanded in A around -inf 21.3%
if 1.44999999999999989e37 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
distribute-rgt-neg-in12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
hypot-def53.0%
Simplified53.0%
Final simplification38.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 (- (* B B) (* (* C A) 4.0))) (t_1 (/ (sqrt 2.0) B)))
(if (<= B -3.1e-58)
(* (sqrt (* (+ C (hypot C B)) F)) t_1)
(if (<= B 1.4e+38)
(/ (* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C C)))) t_0)
(* t_1 (- (sqrt (* B F))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = sqrt(2.0) / B;
double tmp;
if (B <= -3.1e-58) {
tmp = sqrt(((C + hypot(C, B)) * F)) * t_1;
} else if (B <= 1.4e+38) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
} else {
tmp = t_1 * -sqrt((B * F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = Math.sqrt(2.0) / B;
double tmp;
if (B <= -3.1e-58) {
tmp = Math.sqrt(((C + Math.hypot(C, B)) * F)) * t_1;
} else if (B <= 1.4e+38) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + C))) / t_0;
} else {
tmp = t_1 * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = math.sqrt(2.0) / B tmp = 0 if B <= -3.1e-58: tmp = math.sqrt(((C + math.hypot(C, B)) * F)) * t_1 elif B <= 1.4e+38: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + C))) / t_0 else: tmp = t_1 * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(sqrt(2.0) / B) tmp = 0.0 if (B <= -3.1e-58) tmp = Float64(sqrt(Float64(Float64(C + hypot(C, B)) * F)) * t_1); elseif (B <= 1.4e+38) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + C)))) / t_0); else tmp = Float64(t_1 * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = sqrt(2.0) / B;
tmp = 0.0;
if (B <= -3.1e-58)
tmp = sqrt(((C + hypot(C, B)) * F)) * t_1;
elseif (B <= 1.4e+38)
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
else
tmp = t_1 * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -3.1e-58], N[(N[Sqrt[N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, 1.4e+38], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(t$95$1 * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := \frac{\sqrt{2}}{B}\\
\mathbf{if}\;B \leq -3.1 \cdot 10^{-58}:\\
\;\;\;\;\sqrt{\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot F} \cdot t_1\\
\mathbf{elif}\;B \leq 1.4 \cdot 10^{+38}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -3.0999999999999999e-58Initial program 21.3%
associate-*l*21.3%
unpow221.3%
+-commutative21.3%
unpow221.3%
associate-*l*21.3%
unpow221.3%
Simplified21.3%
sqrt-prod29.9%
*-commutative29.9%
*-commutative29.9%
associate-+l+30.1%
unpow230.1%
hypot-udef33.8%
associate-+r+33.7%
+-commutative33.7%
associate-+r+33.6%
Applied egg-rr33.6%
Taylor expanded in B around -inf 31.2%
mul-1-neg31.2%
associate-*l*31.3%
Simplified31.3%
Taylor expanded in A around 0 27.7%
+-commutative27.7%
unpow227.7%
unpow227.7%
hypot-def55.4%
Simplified55.4%
if -3.0999999999999999e-58 < B < 1.4e38Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
sqrt-prod26.6%
*-commutative26.6%
*-commutative26.6%
associate-+l+27.5%
unpow227.5%
hypot-udef38.6%
associate-+r+37.1%
+-commutative37.1%
associate-+r+37.9%
Applied egg-rr37.9%
Taylor expanded in A around -inf 21.3%
if 1.4e38 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification37.3%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* C A) 4.0)))
(t_1 (* 2.0 (* F t_0)))
(t_2 (* -0.5 (/ (* B B) A)))
(t_3 (sqrt t_1)))
(if (<= C -2e-220)
(/ (- (sqrt (* t_1 (fma 2.0 C t_2)))) t_0)
(if (<= C 1.8e-299)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(if (<= C 8e-180)
(/ (* t_3 (- (sqrt (+ C (+ C t_2))))) t_0)
(if (<= C 2.4e-6)
(/ (- (sqrt (* t_1 (+ C (hypot B C))))) t_0)
(/ (* t_3 (- (sqrt (+ C C)))) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double t_2 = -0.5 * ((B * B) / A);
double t_3 = sqrt(t_1);
double tmp;
if (C <= -2e-220) {
tmp = -sqrt((t_1 * fma(2.0, C, t_2))) / t_0;
} else if (C <= 1.8e-299) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else if (C <= 8e-180) {
tmp = (t_3 * -sqrt((C + (C + t_2)))) / t_0;
} else if (C <= 2.4e-6) {
tmp = -sqrt((t_1 * (C + hypot(B, C)))) / t_0;
} else {
tmp = (t_3 * -sqrt((C + C))) / t_0;
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) t_2 = Float64(-0.5 * Float64(Float64(B * B) / A)) t_3 = sqrt(t_1) tmp = 0.0 if (C <= -2e-220) tmp = Float64(Float64(-sqrt(Float64(t_1 * fma(2.0, C, t_2)))) / t_0); elseif (C <= 1.8e-299) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); elseif (C <= 8e-180) tmp = Float64(Float64(t_3 * Float64(-sqrt(Float64(C + Float64(C + t_2))))) / t_0); elseif (C <= 2.4e-6) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(B, C))))) / t_0); else tmp = Float64(Float64(t_3 * Float64(-sqrt(Float64(C + C)))) / t_0); 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[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[C, -2e-220], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 1.8e-299], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[C, 8e-180], N[(N[(t$95$3 * (-N[Sqrt[N[(C + N[(C + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[C, 2.4e-6], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(t$95$3 * (-N[Sqrt[N[(C + C), $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(C \cdot A\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
t_2 := -0.5 \cdot \frac{B \cdot B}{A}\\
t_3 := \sqrt{t_1}\\
\mathbf{if}\;C \leq -2 \cdot 10^{-220}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \mathsf{fma}\left(2, C, t_2\right)}}{t_0}\\
\mathbf{elif}\;C \leq 1.8 \cdot 10^{-299}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;C \leq 8 \cdot 10^{-180}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{C + \left(C + t_2\right)}\right)}{t_0}\\
\mathbf{elif}\;C \leq 2.4 \cdot 10^{-6}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\end{array}
\end{array}
if C < -1.99999999999999998e-220Initial program 13.1%
associate-*l*13.1%
unpow213.1%
+-commutative13.1%
unpow213.1%
associate-*l*13.1%
unpow213.1%
Simplified13.1%
Taylor expanded in A around -inf 12.4%
fma-def12.4%
unpow212.4%
Simplified12.4%
if -1.99999999999999998e-220 < C < 1.8e-299Initial program 13.0%
associate-*l*13.0%
unpow213.0%
+-commutative13.0%
unpow213.0%
associate-*l*13.0%
unpow213.0%
Simplified13.0%
Taylor expanded in A around 0 13.1%
unpow213.1%
unpow213.1%
hypot-def13.6%
Simplified13.6%
Taylor expanded in C around 0 23.6%
mul-1-neg23.6%
Simplified23.6%
if 1.8e-299 < C < 8.0000000000000002e-180Initial program 16.3%
associate-*l*16.3%
unpow216.3%
+-commutative16.3%
unpow216.3%
associate-*l*16.3%
unpow216.3%
Simplified16.3%
sqrt-prod23.8%
*-commutative23.8%
*-commutative23.8%
associate-+l+23.8%
unpow223.8%
hypot-udef27.5%
associate-+r+27.5%
+-commutative27.5%
associate-+r+30.2%
Applied egg-rr30.2%
Taylor expanded in A around -inf 16.1%
unpow216.1%
Simplified16.1%
if 8.0000000000000002e-180 < C < 2.3999999999999999e-6Initial program 41.8%
associate-*l*41.8%
unpow241.8%
+-commutative41.8%
unpow241.8%
associate-*l*41.8%
unpow241.8%
Simplified41.8%
Taylor expanded in A around 0 39.3%
unpow239.3%
unpow239.3%
hypot-def39.3%
Simplified39.3%
if 2.3999999999999999e-6 < C Initial program 31.7%
associate-*l*31.7%
unpow231.7%
+-commutative31.7%
unpow231.7%
associate-*l*31.7%
unpow231.7%
Simplified31.7%
sqrt-prod33.3%
*-commutative33.3%
*-commutative33.3%
associate-+l+33.3%
unpow233.3%
hypot-udef46.7%
associate-+r+46.7%
+-commutative46.7%
associate-+r+47.0%
Applied egg-rr47.0%
Taylor expanded in A around -inf 45.1%
Final simplification24.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) (* (* C A) 4.0)))
(t_1 (/ (* (sqrt (- C B)) (- (sqrt (* 2.0 (* F (* B B)))))) t_0))
(t_2 (/ (* (sqrt (* 2.0 (* F t_0))) (- (sqrt (+ C C)))) t_0)))
(if (<= B -1.32e+154)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -8.5e+18)
t_1
(if (<= B -1.3e-31)
t_2
(if (<= B -7.5e-60)
t_1
(if (<= B 3.8e+37)
t_2
(* (/ (sqrt 2.0) B) (- (sqrt (* B F)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
double t_2 = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -8.5e+18) {
tmp = t_1;
} else if (B <= -1.3e-31) {
tmp = t_2;
} else if (B <= -7.5e-60) {
tmp = t_1;
} else if (B <= 3.8e+37) {
tmp = t_2;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (b * b) - ((c * a) * 4.0d0)
t_1 = (sqrt((c - b)) * -sqrt((2.0d0 * (f * (b * b))))) / t_0
t_2 = (sqrt((2.0d0 * (f * t_0))) * -sqrt((c + c))) / t_0
if (b <= (-1.32d+154)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-8.5d+18)) then
tmp = t_1
else if (b <= (-1.3d-31)) then
tmp = t_2
else if (b <= (-7.5d-60)) then
tmp = t_1
else if (b <= 3.8d+37) then
tmp = t_2
else
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = (Math.sqrt((C - B)) * -Math.sqrt((2.0 * (F * (B * B))))) / t_0;
double t_2 = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + C))) / t_0;
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -8.5e+18) {
tmp = t_1;
} else if (B <= -1.3e-31) {
tmp = t_2;
} else if (B <= -7.5e-60) {
tmp = t_1;
} else if (B <= 3.8e+37) {
tmp = t_2;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = (math.sqrt((C - B)) * -math.sqrt((2.0 * (F * (B * B))))) / t_0 t_2 = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + C))) / t_0 tmp = 0 if B <= -1.32e+154: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -8.5e+18: tmp = t_1 elif B <= -1.3e-31: tmp = t_2 elif B <= -7.5e-60: tmp = t_1 elif B <= 3.8e+37: tmp = t_2 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(Float64(sqrt(Float64(C - B)) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(B * B)))))) / t_0) t_2 = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + C)))) / t_0) tmp = 0.0 if (B <= -1.32e+154) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -8.5e+18) tmp = t_1; elseif (B <= -1.3e-31) tmp = t_2; elseif (B <= -7.5e-60) tmp = t_1; elseif (B <= 3.8e+37) tmp = t_2; else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
t_2 = (sqrt((2.0 * (F * t_0))) * -sqrt((C + C))) / t_0;
tmp = 0.0;
if (B <= -1.32e+154)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -8.5e+18)
tmp = t_1;
elseif (B <= -1.3e-31)
tmp = t_2;
elseif (B <= -7.5e-60)
tmp = t_1;
elseif (B <= 3.8e+37)
tmp = t_2;
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sqrt[N[(C - B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[B, -1.32e+154], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -8.5e+18], t$95$1, If[LessEqual[B, -1.3e-31], t$95$2, If[LessEqual[B, -7.5e-60], t$95$1, If[LessEqual[B, 3.8e+37], t$95$2, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := \frac{\sqrt{C - B} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B\right)\right)}\right)}{t_0}\\
t_2 := \frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{if}\;B \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -8.5 \cdot 10^{+18}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq -1.3 \cdot 10^{-31}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq -7.5 \cdot 10^{-60}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{+37}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -1.31999999999999998e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 12.2%
if -1.31999999999999998e154 < B < -8.5e18 or -1.29999999999999998e-31 < B < -7.5000000000000002e-60Initial program 36.7%
associate-*l*36.7%
unpow236.7%
+-commutative36.7%
unpow236.7%
associate-*l*36.7%
unpow236.7%
Simplified36.7%
sqrt-prod53.8%
*-commutative53.8%
*-commutative53.8%
associate-+l+54.2%
unpow254.2%
hypot-udef60.0%
associate-+r+59.6%
+-commutative59.6%
associate-+r+59.4%
Applied egg-rr59.4%
Taylor expanded in B around -inf 48.7%
mul-1-neg48.7%
Simplified48.7%
Taylor expanded in B around inf 48.3%
unpow248.3%
Simplified48.3%
if -8.5e18 < B < -1.29999999999999998e-31 or -7.5000000000000002e-60 < B < 3.7999999999999999e37Initial program 27.6%
associate-*l*27.6%
unpow227.6%
+-commutative27.6%
unpow227.6%
associate-*l*27.6%
unpow227.6%
Simplified27.6%
sqrt-prod28.8%
*-commutative28.8%
*-commutative28.8%
associate-+l+29.6%
unpow229.6%
hypot-udef40.8%
associate-+r+39.3%
+-commutative39.3%
associate-+r+40.1%
Applied egg-rr40.1%
Taylor expanded in A around -inf 23.8%
if 3.7999999999999999e37 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification30.5%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* -4.0 (* C A)) (* B B)))
(t_1 (- (* B B) (* (* C A) 4.0)))
(t_2 (* 2.0 (* F t_1)))
(t_3 (sqrt t_2)))
(if (<= B -1.32e+154)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -6e+19)
(/ (* t_3 (- (sqrt (- C B)))) t_1)
(if (<= B -3.5e-31)
(/ (* t_3 (- (sqrt (+ C C)))) t_1)
(if (<= B -2.4e-107)
(* (sqrt (* 2.0 (* (+ C (hypot B C)) (* F t_0)))) (/ -1.0 t_0))
(if (<= B 3.5e+41)
(- (/ (sqrt (* t_2 (* C 2.0))) t_1))
(* (/ (sqrt 2.0) B) (- (sqrt (* B F)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (-4.0 * (C * A)) + (B * B);
double t_1 = (B * B) - ((C * A) * 4.0);
double t_2 = 2.0 * (F * t_1);
double t_3 = sqrt(t_2);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -6e+19) {
tmp = (t_3 * -sqrt((C - B))) / t_1;
} else if (B <= -3.5e-31) {
tmp = (t_3 * -sqrt((C + C))) / t_1;
} else if (B <= -2.4e-107) {
tmp = sqrt((2.0 * ((C + hypot(B, C)) * (F * t_0)))) * (-1.0 / t_0);
} else if (B <= 3.5e+41) {
tmp = -(sqrt((t_2 * (C * 2.0))) / t_1);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (-4.0 * (C * A)) + (B * B);
double t_1 = (B * B) - ((C * A) * 4.0);
double t_2 = 2.0 * (F * t_1);
double t_3 = Math.sqrt(t_2);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -6e+19) {
tmp = (t_3 * -Math.sqrt((C - B))) / t_1;
} else if (B <= -3.5e-31) {
tmp = (t_3 * -Math.sqrt((C + C))) / t_1;
} else if (B <= -2.4e-107) {
tmp = Math.sqrt((2.0 * ((C + Math.hypot(B, C)) * (F * t_0)))) * (-1.0 / t_0);
} else if (B <= 3.5e+41) {
tmp = -(Math.sqrt((t_2 * (C * 2.0))) / t_1);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (-4.0 * (C * A)) + (B * B) t_1 = (B * B) - ((C * A) * 4.0) t_2 = 2.0 * (F * t_1) t_3 = math.sqrt(t_2) tmp = 0 if B <= -1.32e+154: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -6e+19: tmp = (t_3 * -math.sqrt((C - B))) / t_1 elif B <= -3.5e-31: tmp = (t_3 * -math.sqrt((C + C))) / t_1 elif B <= -2.4e-107: tmp = math.sqrt((2.0 * ((C + math.hypot(B, C)) * (F * t_0)))) * (-1.0 / t_0) elif B <= 3.5e+41: tmp = -(math.sqrt((t_2 * (C * 2.0))) / t_1) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(-4.0 * Float64(C * A)) + Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_2 = Float64(2.0 * Float64(F * t_1)) t_3 = sqrt(t_2) tmp = 0.0 if (B <= -1.32e+154) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -6e+19) tmp = Float64(Float64(t_3 * Float64(-sqrt(Float64(C - B)))) / t_1); elseif (B <= -3.5e-31) tmp = Float64(Float64(t_3 * Float64(-sqrt(Float64(C + C)))) / t_1); elseif (B <= -2.4e-107) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(C + hypot(B, C)) * Float64(F * t_0)))) * Float64(-1.0 / t_0)); elseif (B <= 3.5e+41) tmp = Float64(-Float64(sqrt(Float64(t_2 * Float64(C * 2.0))) / t_1)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (-4.0 * (C * A)) + (B * B);
t_1 = (B * B) - ((C * A) * 4.0);
t_2 = 2.0 * (F * t_1);
t_3 = sqrt(t_2);
tmp = 0.0;
if (B <= -1.32e+154)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -6e+19)
tmp = (t_3 * -sqrt((C - B))) / t_1;
elseif (B <= -3.5e-31)
tmp = (t_3 * -sqrt((C + C))) / t_1;
elseif (B <= -2.4e-107)
tmp = sqrt((2.0 * ((C + hypot(B, C)) * (F * t_0)))) * (-1.0 / t_0);
elseif (B <= 3.5e+41)
tmp = -(sqrt((t_2 * (C * 2.0))) / t_1);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[t$95$2], $MachinePrecision]}, If[LessEqual[B, -1.32e+154], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -6e+19], N[(N[(t$95$3 * (-N[Sqrt[N[(C - B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, -3.5e-31], N[(N[(t$95$3 * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, -2.4e-107], N[(N[Sqrt[N[(2.0 * N[(N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 3.5e+41], (-N[(N[Sqrt[N[(t$95$2 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -4 \cdot \left(C \cdot A\right) + B \cdot B\\
t_1 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_2 := 2 \cdot \left(F \cdot t_1\right)\\
t_3 := \sqrt{t_2}\\
\mathbf{if}\;B \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -6 \cdot 10^{+19}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{C - B}\right)}{t_1}\\
\mathbf{elif}\;B \leq -3.5 \cdot 10^{-31}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{C + C}\right)}{t_1}\\
\mathbf{elif}\;B \leq -2.4 \cdot 10^{-107}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot \left(F \cdot t_0\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{+41}:\\
\;\;\;\;-\frac{\sqrt{t_2 \cdot \left(C \cdot 2\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -1.31999999999999998e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 12.2%
if -1.31999999999999998e154 < B < -6e19Initial program 25.8%
associate-*l*25.8%
unpow225.8%
+-commutative25.8%
unpow225.8%
associate-*l*25.8%
unpow225.8%
Simplified25.8%
sqrt-prod45.2%
*-commutative45.2%
*-commutative45.2%
associate-+l+45.8%
unpow245.8%
hypot-udef53.7%
associate-+r+53.0%
+-commutative53.0%
associate-+r+52.7%
Applied egg-rr52.7%
Taylor expanded in B around -inf 41.4%
mul-1-neg41.4%
Simplified41.4%
if -6e19 < B < -3.49999999999999985e-31Initial program 51.2%
associate-*l*51.2%
unpow251.2%
+-commutative51.2%
unpow251.2%
associate-*l*51.2%
unpow251.2%
Simplified51.2%
sqrt-prod63.1%
*-commutative63.1%
*-commutative63.1%
associate-+l+63.1%
unpow263.1%
hypot-udef74.9%
associate-+r+74.9%
+-commutative74.9%
associate-+r+74.9%
Applied egg-rr74.9%
Taylor expanded in A around -inf 62.4%
if -3.49999999999999985e-31 < B < -2.39999999999999994e-107Initial program 48.2%
associate-*l*48.2%
unpow248.2%
+-commutative48.2%
unpow248.2%
associate-*l*48.2%
unpow248.2%
Simplified48.2%
Taylor expanded in A around 0 48.6%
unpow248.6%
unpow248.6%
hypot-def48.9%
Simplified48.9%
div-inv49.0%
associate-*l*49.0%
*-commutative49.0%
cancel-sign-sub-inv49.0%
metadata-eval49.0%
*-commutative49.0%
cancel-sign-sub-inv49.0%
metadata-eval49.0%
*-commutative49.0%
Applied egg-rr49.0%
if -2.39999999999999994e-107 < B < 3.4999999999999999e41Initial program 26.0%
associate-*l*26.0%
unpow226.0%
+-commutative26.0%
unpow226.0%
associate-*l*26.0%
unpow226.0%
Simplified26.0%
Taylor expanded in A around -inf 26.0%
if 3.4999999999999999e41 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification32.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) (* (* C A) 4.0))) (t_1 (* 2.0 (* F t_0))))
(if (<= C -1.4e-223)
(/ (- (sqrt (* t_1 (fma 2.0 C (* -0.5 (/ (* B B) A)))))) t_0)
(if (<= C 1.7e-299)
(* (sqrt (/ F B)) (- (sqrt 2.0)))
(if (or (<= C 8e-181) (not (<= C 5.2e-7)))
(/ (* (sqrt t_1) (- (sqrt (+ C C)))) t_0)
(/ (- (sqrt (* t_1 (+ C (hypot B C))))) t_0))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double tmp;
if (C <= -1.4e-223) {
tmp = -sqrt((t_1 * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else if (C <= 1.7e-299) {
tmp = sqrt((F / B)) * -sqrt(2.0);
} else if ((C <= 8e-181) || !(C <= 5.2e-7)) {
tmp = (sqrt(t_1) * -sqrt((C + C))) / t_0;
} else {
tmp = -sqrt((t_1 * (C + hypot(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(C * A) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (C <= -1.4e-223) tmp = Float64(Float64(-sqrt(Float64(t_1 * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); elseif (C <= 1.7e-299) tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); elseif ((C <= 8e-181) || !(C <= 5.2e-7)) tmp = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(C + C)))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(B, C))))) / t_0); 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[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.4e-223], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 1.7e-299], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[C, 8e-181], N[Not[LessEqual[C, 5.2e-7]], $MachinePrecision]], N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $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(C \cdot A\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;C \leq -1.4 \cdot 10^{-223}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{elif}\;C \leq 1.7 \cdot 10^{-299}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;C \leq 8 \cdot 10^{-181} \lor \neg \left(C \leq 5.2 \cdot 10^{-7}\right):\\
\;\;\;\;\frac{\sqrt{t_1} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if C < -1.40000000000000007e-223Initial program 13.1%
associate-*l*13.1%
unpow213.1%
+-commutative13.1%
unpow213.1%
associate-*l*13.1%
unpow213.1%
Simplified13.1%
Taylor expanded in A around -inf 12.4%
fma-def12.4%
unpow212.4%
Simplified12.4%
if -1.40000000000000007e-223 < C < 1.6999999999999999e-299Initial program 13.0%
associate-*l*13.0%
unpow213.0%
+-commutative13.0%
unpow213.0%
associate-*l*13.0%
unpow213.0%
Simplified13.0%
Taylor expanded in A around 0 13.1%
unpow213.1%
unpow213.1%
hypot-def13.6%
Simplified13.6%
Taylor expanded in C around 0 23.6%
mul-1-neg23.6%
Simplified23.6%
if 1.6999999999999999e-299 < C < 8.00000000000000038e-181 or 5.19999999999999998e-7 < C Initial program 26.8%
associate-*l*26.8%
unpow226.8%
+-commutative26.8%
unpow226.8%
associate-*l*26.8%
unpow226.8%
Simplified26.8%
sqrt-prod30.3%
*-commutative30.3%
*-commutative30.3%
associate-+l+30.3%
unpow230.3%
hypot-udef40.6%
associate-+r+40.6%
+-commutative40.6%
associate-+r+41.7%
Applied egg-rr41.7%
Taylor expanded in A around -inf 36.2%
if 8.00000000000000038e-181 < C < 5.19999999999999998e-7Initial program 41.8%
associate-*l*41.8%
unpow241.8%
+-commutative41.8%
unpow241.8%
associate-*l*41.8%
unpow241.8%
Simplified41.8%
Taylor expanded in A around 0 39.3%
unpow239.3%
unpow239.3%
hypot-def39.3%
Simplified39.3%
Final simplification24.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) (* (* C A) 4.0))) (t_1 (* 2.0 (* F t_0))))
(if (<= B -1.32e+154)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -7.2e+18)
(/ (* (sqrt (- C B)) (- (sqrt (* 2.0 (* F (* B B)))))) t_0)
(if (<= B -1.6e-31)
(/ (* (sqrt t_1) (- (sqrt (+ C C)))) t_0)
(if (<= B -2.6e-107)
(/ (- (sqrt (* t_1 (+ C (hypot B C))))) t_0)
(if (<= B 1.6e+37)
(- (/ (sqrt (* t_1 (* C 2.0))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* B F)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -7.2e+18) {
tmp = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
} else if (B <= -1.6e-31) {
tmp = (sqrt(t_1) * -sqrt((C + C))) / t_0;
} else if (B <= -2.6e-107) {
tmp = -sqrt((t_1 * (C + hypot(B, C)))) / t_0;
} else if (B <= 1.6e+37) {
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -7.2e+18) {
tmp = (Math.sqrt((C - B)) * -Math.sqrt((2.0 * (F * (B * B))))) / t_0;
} else if (B <= -1.6e-31) {
tmp = (Math.sqrt(t_1) * -Math.sqrt((C + C))) / t_0;
} else if (B <= -2.6e-107) {
tmp = -Math.sqrt((t_1 * (C + Math.hypot(B, C)))) / t_0;
} else if (B <= 1.6e+37) {
tmp = -(Math.sqrt((t_1 * (C * 2.0))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = 2.0 * (F * t_0) tmp = 0 if B <= -1.32e+154: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -7.2e+18: tmp = (math.sqrt((C - B)) * -math.sqrt((2.0 * (F * (B * B))))) / t_0 elif B <= -1.6e-31: tmp = (math.sqrt(t_1) * -math.sqrt((C + C))) / t_0 elif B <= -2.6e-107: tmp = -math.sqrt((t_1 * (C + math.hypot(B, C)))) / t_0 elif B <= 1.6e+37: tmp = -(math.sqrt((t_1 * (C * 2.0))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= -1.32e+154) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -7.2e+18) tmp = Float64(Float64(sqrt(Float64(C - B)) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(B * B)))))) / t_0); elseif (B <= -1.6e-31) tmp = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(C + C)))) / t_0); elseif (B <= -2.6e-107) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(B, C))))) / t_0); elseif (B <= 1.6e+37) tmp = Float64(-Float64(sqrt(Float64(t_1 * Float64(C * 2.0))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = 2.0 * (F * t_0);
tmp = 0.0;
if (B <= -1.32e+154)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -7.2e+18)
tmp = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
elseif (B <= -1.6e-31)
tmp = (sqrt(t_1) * -sqrt((C + C))) / t_0;
elseif (B <= -2.6e-107)
tmp = -sqrt((t_1 * (C + hypot(B, C)))) / t_0;
elseif (B <= 1.6e+37)
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.32e+154], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7.2e+18], N[(N[(N[Sqrt[N[(C - B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -1.6e-31], N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -2.6e-107], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.6e+37], (-N[(N[Sqrt[N[(t$95$1 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -7.2 \cdot 10^{+18}:\\
\;\;\;\;\frac{\sqrt{C - B} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;B \leq -1.6 \cdot 10^{-31}:\\
\;\;\;\;\frac{\sqrt{t_1} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{elif}\;B \leq -2.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.6 \cdot 10^{+37}:\\
\;\;\;\;-\frac{\sqrt{t_1 \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -1.31999999999999998e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 12.2%
if -1.31999999999999998e154 < B < -7.2e18Initial program 25.8%
associate-*l*25.8%
unpow225.8%
+-commutative25.8%
unpow225.8%
associate-*l*25.8%
unpow225.8%
Simplified25.8%
sqrt-prod45.2%
*-commutative45.2%
*-commutative45.2%
associate-+l+45.8%
unpow245.8%
hypot-udef53.7%
associate-+r+53.0%
+-commutative53.0%
associate-+r+52.7%
Applied egg-rr52.7%
Taylor expanded in B around -inf 41.4%
mul-1-neg41.4%
Simplified41.4%
Taylor expanded in B around inf 40.8%
unpow240.8%
Simplified40.8%
if -7.2e18 < B < -1.60000000000000009e-31Initial program 51.2%
associate-*l*51.2%
unpow251.2%
+-commutative51.2%
unpow251.2%
associate-*l*51.2%
unpow251.2%
Simplified51.2%
sqrt-prod63.1%
*-commutative63.1%
*-commutative63.1%
associate-+l+63.1%
unpow263.1%
hypot-udef74.9%
associate-+r+74.9%
+-commutative74.9%
associate-+r+74.9%
Applied egg-rr74.9%
Taylor expanded in A around -inf 62.4%
if -1.60000000000000009e-31 < B < -2.6000000000000001e-107Initial program 48.2%
associate-*l*48.2%
unpow248.2%
+-commutative48.2%
unpow248.2%
associate-*l*48.2%
unpow248.2%
Simplified48.2%
Taylor expanded in A around 0 48.6%
unpow248.6%
unpow248.6%
hypot-def48.9%
Simplified48.9%
if -2.6000000000000001e-107 < B < 1.60000000000000007e37Initial program 26.0%
associate-*l*26.0%
unpow226.0%
+-commutative26.0%
unpow226.0%
associate-*l*26.0%
unpow226.0%
Simplified26.0%
Taylor expanded in A around -inf 26.0%
if 1.60000000000000007e37 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification32.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* (* C A) 4.0)))
(t_1 (* 2.0 (* F t_0)))
(t_2 (sqrt t_1)))
(if (<= B -1.32e+154)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -2.65e+20)
(/ (* t_2 (- (sqrt (- C B)))) t_0)
(if (<= B -3e-31)
(/ (* t_2 (- (sqrt (+ C C)))) t_0)
(if (<= B -2.6e-107)
(/ (- (sqrt (* t_1 (+ C (hypot B C))))) t_0)
(if (<= B 3.5e+41)
(- (/ (sqrt (* t_1 (* C 2.0))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* B F)))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double t_2 = sqrt(t_1);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -2.65e+20) {
tmp = (t_2 * -sqrt((C - B))) / t_0;
} else if (B <= -3e-31) {
tmp = (t_2 * -sqrt((C + C))) / t_0;
} else if (B <= -2.6e-107) {
tmp = -sqrt((t_1 * (C + hypot(B, C)))) / t_0;
} else if (B <= 3.5e+41) {
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = 2.0 * (F * t_0);
double t_2 = Math.sqrt(t_1);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -2.65e+20) {
tmp = (t_2 * -Math.sqrt((C - B))) / t_0;
} else if (B <= -3e-31) {
tmp = (t_2 * -Math.sqrt((C + C))) / t_0;
} else if (B <= -2.6e-107) {
tmp = -Math.sqrt((t_1 * (C + Math.hypot(B, C)))) / t_0;
} else if (B <= 3.5e+41) {
tmp = -(Math.sqrt((t_1 * (C * 2.0))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = 2.0 * (F * t_0) t_2 = math.sqrt(t_1) tmp = 0 if B <= -1.32e+154: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -2.65e+20: tmp = (t_2 * -math.sqrt((C - B))) / t_0 elif B <= -3e-31: tmp = (t_2 * -math.sqrt((C + C))) / t_0 elif B <= -2.6e-107: tmp = -math.sqrt((t_1 * (C + math.hypot(B, C)))) / t_0 elif B <= 3.5e+41: tmp = -(math.sqrt((t_1 * (C * 2.0))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = Float64(2.0 * Float64(F * t_0)) t_2 = sqrt(t_1) tmp = 0.0 if (B <= -1.32e+154) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -2.65e+20) tmp = Float64(Float64(t_2 * Float64(-sqrt(Float64(C - B)))) / t_0); elseif (B <= -3e-31) tmp = Float64(Float64(t_2 * Float64(-sqrt(Float64(C + C)))) / t_0); elseif (B <= -2.6e-107) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(B, C))))) / t_0); elseif (B <= 3.5e+41) tmp = Float64(-Float64(sqrt(Float64(t_1 * Float64(C * 2.0))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
t_1 = 2.0 * (F * t_0);
t_2 = sqrt(t_1);
tmp = 0.0;
if (B <= -1.32e+154)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -2.65e+20)
tmp = (t_2 * -sqrt((C - B))) / t_0;
elseif (B <= -3e-31)
tmp = (t_2 * -sqrt((C + C))) / t_0;
elseif (B <= -2.6e-107)
tmp = -sqrt((t_1 * (C + hypot(B, C)))) / t_0;
elseif (B <= 3.5e+41)
tmp = -(sqrt((t_1 * (C * 2.0))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[t$95$1], $MachinePrecision]}, If[LessEqual[B, -1.32e+154], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.65e+20], N[(N[(t$95$2 * (-N[Sqrt[N[(C - B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -3e-31], N[(N[(t$95$2 * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -2.6e-107], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.5e+41], (-N[(N[Sqrt[N[(t$95$1 * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
t_2 := \sqrt{t_1}\\
\mathbf{if}\;B \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -2.65 \cdot 10^{+20}:\\
\;\;\;\;\frac{t_2 \cdot \left(-\sqrt{C - B}\right)}{t_0}\\
\mathbf{elif}\;B \leq -3 \cdot 10^{-31}:\\
\;\;\;\;\frac{t_2 \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{elif}\;B \leq -2.6 \cdot 10^{-107}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.5 \cdot 10^{+41}:\\
\;\;\;\;-\frac{\sqrt{t_1 \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -1.31999999999999998e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 12.2%
if -1.31999999999999998e154 < B < -2.65e20Initial program 25.8%
associate-*l*25.8%
unpow225.8%
+-commutative25.8%
unpow225.8%
associate-*l*25.8%
unpow225.8%
Simplified25.8%
sqrt-prod45.2%
*-commutative45.2%
*-commutative45.2%
associate-+l+45.8%
unpow245.8%
hypot-udef53.7%
associate-+r+53.0%
+-commutative53.0%
associate-+r+52.7%
Applied egg-rr52.7%
Taylor expanded in B around -inf 41.4%
mul-1-neg41.4%
Simplified41.4%
if -2.65e20 < B < -2.99999999999999981e-31Initial program 51.2%
associate-*l*51.2%
unpow251.2%
+-commutative51.2%
unpow251.2%
associate-*l*51.2%
unpow251.2%
Simplified51.2%
sqrt-prod63.1%
*-commutative63.1%
*-commutative63.1%
associate-+l+63.1%
unpow263.1%
hypot-udef74.9%
associate-+r+74.9%
+-commutative74.9%
associate-+r+74.9%
Applied egg-rr74.9%
Taylor expanded in A around -inf 62.4%
if -2.99999999999999981e-31 < B < -2.6000000000000001e-107Initial program 48.2%
associate-*l*48.2%
unpow248.2%
+-commutative48.2%
unpow248.2%
associate-*l*48.2%
unpow248.2%
Simplified48.2%
Taylor expanded in A around 0 48.6%
unpow248.6%
unpow248.6%
hypot-def48.9%
Simplified48.9%
if -2.6000000000000001e-107 < B < 3.4999999999999999e41Initial program 26.0%
associate-*l*26.0%
unpow226.0%
+-commutative26.0%
unpow226.0%
associate-*l*26.0%
unpow226.0%
Simplified26.0%
Taylor expanded in A around -inf 26.0%
if 3.4999999999999999e41 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification32.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) (* (* C A) 4.0))))
(if (<= B -1.32e+154)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.4e-66)
(/ (* (sqrt (- C B)) (- (sqrt (* 2.0 (* F (* B B)))))) t_0)
(if (<= B 7.5e+41)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (* C 2.0))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* B F)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.4e-66) {
tmp = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
} else if (B <= 7.5e+41) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((c * a) * 4.0d0)
if (b <= (-1.32d+154)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-1.4d-66)) then
tmp = (sqrt((c - b)) * -sqrt((2.0d0 * (f * (b * b))))) / t_0
else if (b <= 7.5d+41) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (c * 2.0d0))) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -1.32e+154) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.4e-66) {
tmp = (Math.sqrt((C - B)) * -Math.sqrt((2.0 * (F * (B * B))))) / t_0;
} else if (B <= 7.5e+41) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) tmp = 0 if B <= -1.32e+154: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.4e-66: tmp = (math.sqrt((C - B)) * -math.sqrt((2.0 * (F * (B * B))))) / t_0 elif B <= 7.5e+41: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) tmp = 0.0 if (B <= -1.32e+154) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.4e-66) tmp = Float64(Float64(sqrt(Float64(C - B)) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(B * B)))))) / t_0); elseif (B <= 7.5e+41) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C * 2.0))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
tmp = 0.0;
if (B <= -1.32e+154)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.4e-66)
tmp = (sqrt((C - B)) * -sqrt((2.0 * (F * (B * B))))) / t_0;
elseif (B <= 7.5e+41)
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.32e+154], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.4e-66], N[(N[(N[Sqrt[N[(C - B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 7.5e+41], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
\mathbf{if}\;B \leq -1.32 \cdot 10^{+154}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.4 \cdot 10^{-66}:\\
\;\;\;\;\frac{\sqrt{C - B} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{+41}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -1.31999999999999998e154Initial program 0.0%
associate-*l*0.0%
unpow20.0%
+-commutative0.0%
unpow20.0%
associate-*l*0.0%
unpow20.0%
Simplified0.0%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 12.2%
if -1.31999999999999998e154 < B < -1.4e-66Initial program 37.8%
associate-*l*37.8%
unpow237.8%
+-commutative37.8%
unpow237.8%
associate-*l*37.8%
unpow237.8%
Simplified37.8%
sqrt-prod53.1%
*-commutative53.1%
*-commutative53.1%
associate-+l+53.4%
unpow253.4%
hypot-udef60.5%
associate-+r+59.8%
+-commutative59.8%
associate-+r+59.6%
Applied egg-rr59.6%
Taylor expanded in B around -inf 40.2%
mul-1-neg40.2%
Simplified40.2%
Taylor expanded in B around inf 39.1%
unpow239.1%
Simplified39.1%
if -1.4e-66 < B < 7.50000000000000072e41Initial program 26.5%
associate-*l*26.5%
unpow226.5%
+-commutative26.5%
unpow226.5%
associate-*l*26.5%
unpow226.5%
Simplified26.5%
Taylor expanded in A around -inf 25.8%
if 7.50000000000000072e41 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification30.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) (* (* C A) 4.0))))
(if (<= B -5.5e+102)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B 6.2e+38)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (* C 2.0))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -5.5e+102) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= 6.2e+38) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((c * a) * 4.0d0)
if (b <= (-5.5d+102)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= 6.2d+38) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (c * 2.0d0))) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -5.5e+102) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= 6.2e+38) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) tmp = 0 if B <= -5.5e+102: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= 6.2e+38: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) tmp = 0.0 if (B <= -5.5e+102) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= 6.2e+38) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C * 2.0))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
tmp = 0.0;
if (B <= -5.5e+102)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= 6.2e+38)
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5.5e+102], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.2e+38], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 6.2 \cdot 10^{+38}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\end{array}
\end{array}
if B < -5.49999999999999981e102Initial program 4.9%
associate-*l*4.9%
unpow24.9%
+-commutative4.9%
unpow24.9%
associate-*l*4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in A around -inf 0.3%
Taylor expanded in B around -inf 10.6%
if -5.49999999999999981e102 < B < 6.20000000000000035e38Initial program 29.4%
associate-*l*29.4%
unpow229.4%
+-commutative29.4%
unpow229.4%
associate-*l*29.4%
unpow229.4%
Simplified29.4%
Taylor expanded in A around -inf 24.1%
if 6.20000000000000035e38 < B Initial program 8.3%
Simplified10.1%
Taylor expanded in A around 0 12.7%
mul-1-neg12.7%
*-commutative12.7%
unpow212.7%
unpow212.7%
Simplified12.7%
Taylor expanded in C around 0 49.3%
Final simplification26.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) (* (* C A) 4.0))))
(if (<= B -4.8e+101)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B 1e+37)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (* C 2.0))) t_0))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double tmp;
if (B <= -4.8e+101) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= 1e+37) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = sqrt((F / B)) * -sqrt(2.0);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - ((c * a) * 4.0d0)
if (b <= (-4.8d+101)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= 1d+37) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (c * 2.0d0))) / t_0)
else
tmp = sqrt((f / b)) * -sqrt(2.0d0)
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) - ((C * A) * 4.0);
double tmp;
if (B <= -4.8e+101) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= 1e+37) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = Math.sqrt((F / B)) * -Math.sqrt(2.0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) tmp = 0 if B <= -4.8e+101: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= 1e+37: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0) else: tmp = math.sqrt((F / B)) * -math.sqrt(2.0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) tmp = 0.0 if (B <= -4.8e+101) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= 1e+37) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C * 2.0))) / t_0)); else tmp = Float64(sqrt(Float64(F / B)) * Float64(-sqrt(2.0))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - ((C * A) * 4.0);
tmp = 0.0;
if (B <= -4.8e+101)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= 1e+37)
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
else
tmp = sqrt((F / B)) * -sqrt(2.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[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.8e+101], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1e+37], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
\mathbf{if}\;B \leq -4.8 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 10^{+37}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -4.79999999999999977e101Initial program 4.9%
associate-*l*4.9%
unpow24.9%
+-commutative4.9%
unpow24.9%
associate-*l*4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in A around -inf 0.3%
Taylor expanded in B around -inf 10.6%
if -4.79999999999999977e101 < B < 9.99999999999999954e36Initial program 29.4%
associate-*l*29.4%
unpow229.4%
+-commutative29.4%
unpow229.4%
associate-*l*29.4%
unpow229.4%
Simplified29.4%
Taylor expanded in A around -inf 24.1%
if 9.99999999999999954e36 < B Initial program 8.3%
associate-*l*8.3%
unpow28.3%
+-commutative8.3%
unpow28.3%
associate-*l*8.3%
unpow28.3%
Simplified8.3%
Taylor expanded in A around 0 6.9%
unpow26.9%
unpow26.9%
hypot-def6.9%
Simplified6.9%
Taylor expanded in C around 0 48.8%
mul-1-neg48.8%
Simplified48.8%
Final simplification26.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) (* (* C A) 4.0))) (t_1 (sqrt (* C F))))
(if (<= B -1.05e+103)
(* 2.0 (* t_1 (/ 1.0 B)))
(if (<= B 7.8e+57)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (* C 2.0))) t_0))
(* t_1 (- (/ 2.0 B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - ((C * A) * 4.0);
double t_1 = sqrt((C * F));
double tmp;
if (B <= -1.05e+103) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= 7.8e+57) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = t_1 * -(2.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) :: tmp
t_0 = (b * b) - ((c * a) * 4.0d0)
t_1 = sqrt((c * f))
if (b <= (-1.05d+103)) then
tmp = 2.0d0 * (t_1 * (1.0d0 / b))
else if (b <= 7.8d+57) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (c * 2.0d0))) / t_0)
else
tmp = t_1 * -(2.0d0 / 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) - ((C * A) * 4.0);
double t_1 = Math.sqrt((C * F));
double tmp;
if (B <= -1.05e+103) {
tmp = 2.0 * (t_1 * (1.0 / B));
} else if (B <= 7.8e+57) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
} else {
tmp = t_1 * -(2.0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - ((C * A) * 4.0) t_1 = math.sqrt((C * F)) tmp = 0 if B <= -1.05e+103: tmp = 2.0 * (t_1 * (1.0 / B)) elif B <= 7.8e+57: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0) else: tmp = t_1 * -(2.0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)) t_1 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -1.05e+103) tmp = Float64(2.0 * Float64(t_1 * Float64(1.0 / B))); elseif (B <= 7.8e+57) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(C * 2.0))) / t_0)); else tmp = Float64(t_1 * Float64(-Float64(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) - ((C * A) * 4.0);
t_1 = sqrt((C * F));
tmp = 0.0;
if (B <= -1.05e+103)
tmp = 2.0 * (t_1 * (1.0 / B));
elseif (B <= 7.8e+57)
tmp = -(sqrt(((2.0 * (F * t_0)) * (C * 2.0))) / t_0);
else
tmp = t_1 * -(2.0 / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.05e+103], N[(2.0 * N[(t$95$1 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 7.8e+57], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(C * 2.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(t$95$1 * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - \left(C \cdot A\right) \cdot 4\\
t_1 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -1.05 \cdot 10^{+103}:\\
\;\;\;\;2 \cdot \left(t_1 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 7.8 \cdot 10^{+57}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(C \cdot 2\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \left(-\frac{2}{B}\right)\\
\end{array}
\end{array}
if B < -1.0500000000000001e103Initial program 4.9%
associate-*l*4.9%
unpow24.9%
+-commutative4.9%
unpow24.9%
associate-*l*4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in A around -inf 0.3%
Taylor expanded in B around -inf 10.6%
if -1.0500000000000001e103 < B < 7.79999999999999937e57Initial program 29.6%
associate-*l*29.6%
unpow229.6%
+-commutative29.6%
unpow229.6%
associate-*l*29.6%
unpow229.6%
Simplified29.6%
Taylor expanded in A around -inf 23.9%
if 7.79999999999999937e57 < B Initial program 6.6%
Simplified8.4%
Taylor expanded in A around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
unpow29.1%
unpow29.1%
Simplified9.1%
Taylor expanded in B around 0 6.8%
unpow26.8%
rem-square-sqrt6.8%
Simplified6.8%
Final simplification18.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* C F))))
(if (<= B -5e+101)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B 6.5e+57)
(/
(- (sqrt (* 4.0 (* C (* F (+ (* -4.0 (* C A)) (* B B)))))))
(- (* B B) (* (* C A) 4.0)))
(* t_0 (- (/ 2.0 B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -5e+101) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 6.5e+57) {
tmp = -sqrt((4.0 * (C * (F * ((-4.0 * (C * A)) + (B * B)))))) / ((B * B) - ((C * A) * 4.0));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-5d+101)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= 6.5d+57) then
tmp = -sqrt((4.0d0 * (c * (f * (((-4.0d0) * (c * a)) + (b * b)))))) / ((b * b) - ((c * a) * 4.0d0))
else
tmp = t_0 * -(2.0d0 / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -5e+101) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 6.5e+57) {
tmp = -Math.sqrt((4.0 * (C * (F * ((-4.0 * (C * A)) + (B * B)))))) / ((B * B) - ((C * A) * 4.0));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -5e+101: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= 6.5e+57: tmp = -math.sqrt((4.0 * (C * (F * ((-4.0 * (C * A)) + (B * B)))))) / ((B * B) - ((C * A) * 4.0)) else: tmp = t_0 * -(2.0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -5e+101) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= 6.5e+57) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(-4.0 * Float64(C * A)) + Float64(B * B))))))) / Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0))); else tmp = Float64(t_0 * Float64(-Float64(2.0 / B))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -5e+101)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= 6.5e+57)
tmp = -sqrt((4.0 * (C * (F * ((-4.0 * (C * A)) + (B * B)))))) / ((B * B) - ((C * A) * 4.0));
else
tmp = t_0 * -(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[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -5e+101], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.5e+57], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -5 \cdot 10^{+101}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{+57}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(-4 \cdot \left(C \cdot A\right) + B \cdot B\right)\right)\right)}}{B \cdot B - \left(C \cdot A\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\frac{2}{B}\right)\\
\end{array}
\end{array}
if B < -4.99999999999999989e101Initial program 4.9%
associate-*l*4.9%
unpow24.9%
+-commutative4.9%
unpow24.9%
associate-*l*4.9%
unpow24.9%
Simplified4.9%
Taylor expanded in A around -inf 0.3%
Taylor expanded in B around -inf 10.6%
if -4.99999999999999989e101 < B < 6.4999999999999997e57Initial program 29.6%
associate-*l*29.6%
unpow229.6%
+-commutative29.6%
unpow229.6%
associate-*l*29.6%
unpow229.6%
Simplified29.6%
Taylor expanded in A around -inf 23.9%
Taylor expanded in F around 0 23.9%
cancel-sign-sub-inv23.9%
metadata-eval23.9%
unpow223.9%
Simplified23.9%
if 6.4999999999999997e57 < B Initial program 6.6%
Simplified8.4%
Taylor expanded in A around 0 9.1%
mul-1-neg9.1%
*-commutative9.1%
unpow29.1%
unpow29.1%
Simplified9.1%
Taylor expanded in B around 0 6.8%
unpow26.8%
rem-square-sqrt6.8%
Simplified6.8%
Final simplification18.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* C F))))
(if (<= B -1.8e-15)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B 4.5e-27)
(*
(sqrt (* 2.0 (* -8.0 (* F (* A (* C C))))))
(/ -1.0 (+ (* -4.0 (* C A)) (* B B))))
(* t_0 (- (/ 2.0 B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -1.8e-15) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 4.5e-27) {
tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((-4.0 * (C * A)) + (B * B)));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-1.8d-15)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= 4.5d-27) then
tmp = sqrt((2.0d0 * ((-8.0d0) * (f * (a * (c * c)))))) * ((-1.0d0) / (((-4.0d0) * (c * a)) + (b * b)))
else
tmp = t_0 * -(2.0d0 / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -1.8e-15) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 4.5e-27) {
tmp = Math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((-4.0 * (C * A)) + (B * B)));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -1.8e-15: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= 4.5e-27: tmp = math.sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((-4.0 * (C * A)) + (B * B))) else: tmp = t_0 * -(2.0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -1.8e-15) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= 4.5e-27) tmp = Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(F * Float64(A * Float64(C * C)))))) * Float64(-1.0 / Float64(Float64(-4.0 * Float64(C * A)) + Float64(B * B)))); else tmp = Float64(t_0 * Float64(-Float64(2.0 / B))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -1.8e-15)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= 4.5e-27)
tmp = sqrt((2.0 * (-8.0 * (F * (A * (C * C)))))) * (-1.0 / ((-4.0 * (C * A)) + (B * B)));
else
tmp = t_0 * -(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[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -1.8e-15], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.5e-27], N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(F * N[(A * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision] + N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -1.8 \cdot 10^{-15}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 4.5 \cdot 10^{-27}:\\
\;\;\;\;\sqrt{2 \cdot \left(-8 \cdot \left(F \cdot \left(A \cdot \left(C \cdot C\right)\right)\right)\right)} \cdot \frac{-1}{-4 \cdot \left(C \cdot A\right) + B \cdot B}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\frac{2}{B}\right)\\
\end{array}
\end{array}
if B < -1.8000000000000001e-15Initial program 14.3%
associate-*l*14.3%
unpow214.3%
+-commutative14.3%
unpow214.3%
associate-*l*14.3%
unpow214.3%
Simplified14.3%
Taylor expanded in A around -inf 7.2%
Taylor expanded in B around -inf 12.0%
if -1.8000000000000001e-15 < B < 4.5000000000000002e-27Initial program 27.4%
associate-*l*27.4%
unpow227.4%
+-commutative27.4%
unpow227.4%
associate-*l*27.4%
unpow227.4%
Simplified27.4%
Taylor expanded in A around 0 22.0%
unpow222.0%
unpow222.0%
hypot-def26.6%
Simplified26.6%
div-inv26.5%
associate-*l*26.5%
*-commutative26.5%
cancel-sign-sub-inv26.5%
metadata-eval26.5%
*-commutative26.5%
cancel-sign-sub-inv26.5%
metadata-eval26.5%
*-commutative26.5%
Applied egg-rr26.5%
Taylor expanded in B around 0 14.9%
associate-*r*17.6%
unpow217.6%
Simplified17.6%
if 4.5000000000000002e-27 < B Initial program 15.3%
Simplified17.0%
Taylor expanded in A around 0 14.3%
mul-1-neg14.3%
*-commutative14.3%
unpow214.3%
unpow214.3%
Simplified14.3%
Taylor expanded in B around 0 6.0%
unpow26.0%
rem-square-sqrt6.0%
Simplified6.0%
Final simplification13.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (sqrt (* C F))))
(if (<= B -2.5e-15)
(* 2.0 (* t_0 (/ 1.0 B)))
(if (<= B 2.25e-9)
(- (/ (sqrt (* (* A -16.0) (* F (* C C)))) (- (* B B) (* (* C A) 4.0))))
(* t_0 (- (/ 2.0 B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -2.5e-15) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 2.25e-9) {
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - ((C * A) * 4.0)));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-2.5d-15)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else if (b <= 2.25d-9) then
tmp = -(sqrt(((a * (-16.0d0)) * (f * (c * c)))) / ((b * b) - ((c * a) * 4.0d0)))
else
tmp = t_0 * -(2.0d0 / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -2.5e-15) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else if (B <= 2.25e-9) {
tmp = -(Math.sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - ((C * A) * 4.0)));
} else {
tmp = t_0 * -(2.0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -2.5e-15: tmp = 2.0 * (t_0 * (1.0 / B)) elif B <= 2.25e-9: tmp = -(math.sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - ((C * A) * 4.0))) else: tmp = t_0 * -(2.0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -2.5e-15) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); elseif (B <= 2.25e-9) tmp = Float64(-Float64(sqrt(Float64(Float64(A * -16.0) * Float64(F * Float64(C * C)))) / Float64(Float64(B * B) - Float64(Float64(C * A) * 4.0)))); else tmp = Float64(t_0 * Float64(-Float64(2.0 / B))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -2.5e-15)
tmp = 2.0 * (t_0 * (1.0 / B));
elseif (B <= 2.25e-9)
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - ((C * A) * 4.0)));
else
tmp = t_0 * -(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[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2.5e-15], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.25e-9], (-N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(N[(C * A), $MachinePrecision] * 4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(t$95$0 * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -2.5 \cdot 10^{-15}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 2.25 \cdot 10^{-9}:\\
\;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{B \cdot B - \left(C \cdot A\right) \cdot 4}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\frac{2}{B}\right)\\
\end{array}
\end{array}
if B < -2.5e-15Initial program 14.3%
associate-*l*14.3%
unpow214.3%
+-commutative14.3%
unpow214.3%
associate-*l*14.3%
unpow214.3%
Simplified14.3%
Taylor expanded in A around -inf 7.2%
Taylor expanded in B around -inf 12.0%
if -2.5e-15 < B < 2.24999999999999988e-9Initial program 28.8%
associate-*l*28.8%
unpow228.8%
+-commutative28.8%
unpow228.8%
associate-*l*28.8%
unpow228.8%
Simplified28.8%
Taylor expanded in A around -inf 25.2%
Taylor expanded in B around 0 14.6%
associate-*r*14.6%
unpow214.6%
Simplified14.6%
if 2.24999999999999988e-9 < B Initial program 11.1%
Simplified13.0%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
Taylor expanded in B around 0 6.3%
unpow26.3%
rem-square-sqrt6.3%
Simplified6.3%
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 (<= B -1.15e-303) (* 2.0 (* (sqrt (* C F)) (/ 1.0 B))) (* (/ 2.0 B) (- (pow (* C F) 0.5)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.15e-303) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else {
tmp = (2.0 / B) * -pow((C * F), 0.5);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-1.15d-303)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else
tmp = (2.0d0 / b) * -((c * f) ** 0.5d0)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.15e-303) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else {
tmp = (2.0 / B) * -Math.pow((C * F), 0.5);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -1.15e-303: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) else: tmp = (2.0 / B) * -math.pow((C * F), 0.5) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -1.15e-303) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); else tmp = Float64(Float64(2.0 / B) * Float64(-(Float64(C * F) ^ 0.5))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.15e-303)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
else
tmp = (2.0 / B) * -((C * F) ^ 0.5);
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.15e-303], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.15 \cdot 10^{-303}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{B} \cdot \left(-{\left(C \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if B < -1.14999999999999998e-303Initial program 21.1%
associate-*l*21.1%
unpow221.1%
+-commutative21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
Simplified21.1%
Taylor expanded in A around -inf 12.7%
Taylor expanded in B around -inf 7.8%
if -1.14999999999999998e-303 < B Initial program 21.1%
Simplified25.9%
Taylor expanded in A around 0 12.6%
mul-1-neg12.6%
*-commutative12.6%
unpow212.6%
unpow212.6%
Simplified12.6%
Taylor expanded in B around 0 5.0%
unpow25.0%
rem-square-sqrt5.1%
Simplified5.1%
pow1/25.3%
*-commutative5.3%
Applied egg-rr5.3%
Final simplification6.5%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (/ 2.0 B) (- (pow (* C F) 0.5))))
assert(A < C);
double code(double A, double B, double C, double F) {
return (2.0 / B) * -pow((C * F), 0.5);
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (2.0d0 / b) * -((c * f) ** 0.5d0)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (2.0 / B) * -Math.pow((C * F), 0.5);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (2.0 / B) * -math.pow((C * F), 0.5)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(2.0 / B) * Float64(-(Float64(C * F) ^ 0.5))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (2.0 / B) * -((C * F) ^ 0.5);
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(2.0 / B), $MachinePrecision] * (-N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{2}{B} \cdot \left(-{\left(C \cdot F\right)}^{0.5}\right)
\end{array}
Initial program 21.1%
Simplified24.9%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
unpow27.2%
unpow27.2%
Simplified7.2%
Taylor expanded in B around 0 3.1%
unpow23.1%
rem-square-sqrt3.1%
Simplified3.1%
pow1/23.3%
*-commutative3.3%
Applied egg-rr3.3%
Final simplification3.3%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (sqrt (* C F)) (- (/ 2.0 B))))
assert(A < C);
double code(double A, double B, double C, double F) {
return sqrt((C * F)) * -(2.0 / 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 = sqrt((c * f)) * -(2.0d0 / b)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return Math.sqrt((C * F)) * -(2.0 / B);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return math.sqrt((C * F)) * -(2.0 / B)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(sqrt(Float64(C * F)) * Float64(-Float64(2.0 / B))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = sqrt((C * F)) * -(2.0 / B);
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * (-N[(2.0 / B), $MachinePrecision])), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\sqrt{C \cdot F} \cdot \left(-\frac{2}{B}\right)
\end{array}
Initial program 21.1%
Simplified24.9%
Taylor expanded in A around 0 7.2%
mul-1-neg7.2%
*-commutative7.2%
unpow27.2%
unpow27.2%
Simplified7.2%
Taylor expanded in B around 0 3.1%
unpow23.1%
rem-square-sqrt3.1%
Simplified3.1%
Final simplification3.1%
herbie shell --seed 2023175
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))