
(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 (* (* 4.0 A) C))
(t_1 (- (sqrt F)))
(t_2 (- (pow B 2.0) t_0))
(t_3 (sqrt (+ C (+ A (hypot B (- A C))))))
(t_4
(/
(-
(sqrt
(*
(* 2.0 (* t_2 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0)))))))
t_2))
(t_5 (fma B B (* C (* A -4.0)))))
(if (<= t_4 0.0)
(/
(* t_3 (* (sqrt 2.0) (* (sqrt (- (* B B) t_0)) t_1)))
(- (* B B) (* 4.0 (* A C))))
(if (<= t_4 INFINITY)
(/ (- (sqrt (* 2.0 (* F t_5)))) (/ t_5 t_3))
(* (/ (sqrt 2.0) B) (* (sqrt (+ C (hypot C B))) t_1))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = -sqrt(F);
double t_2 = pow(B, 2.0) - t_0;
double t_3 = sqrt((C + (A + hypot(B, (A - C)))));
double t_4 = -sqrt(((2.0 * (t_2 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_2;
double t_5 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (t_4 <= 0.0) {
tmp = (t_3 * (sqrt(2.0) * (sqrt(((B * B) - t_0)) * t_1))) / ((B * B) - (4.0 * (A * C)));
} else if (t_4 <= ((double) INFINITY)) {
tmp = -sqrt((2.0 * (F * t_5))) / (t_5 / t_3);
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * t_1);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(-sqrt(F)) t_2 = Float64((B ^ 2.0) - t_0) t_3 = sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) t_4 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) t_5 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (t_4 <= 0.0) tmp = Float64(Float64(t_3 * Float64(sqrt(2.0) * Float64(sqrt(Float64(Float64(B * B) - t_0)) * t_1))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); elseif (t_4 <= Inf) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * t_5)))) / Float64(t_5 / t_3)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * t_1)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = (-N[Sqrt[F], $MachinePrecision])}, Block[{t$95$2 = N[(N[Power[B, 2.0], $MachinePrecision] - t$95$0), $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[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, Block[{t$95$5 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, 0.0], N[(N[(t$95$3 * N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[((-N[Sqrt[N[(2.0 * N[(F * t$95$5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(t$95$5 / t$95$3), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := -\sqrt{F}\\
t_2 := {B}^{2} - t_0\\
t_3 := \sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\\
t_4 := \frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_2}\\
t_5 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;t_4 \leq 0:\\
\;\;\;\;\frac{t_3 \cdot \left(\sqrt{2} \cdot \left(\sqrt{B \cdot B - t_0} \cdot t_1\right)\right)}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;t_4 \leq \infty:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot t_5\right)}}{\frac{t_5}{t_3}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot t_1\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 30.5%
associate-*l*30.4%
unpow230.4%
+-commutative30.4%
unpow230.4%
associate-*l*30.4%
unpow230.4%
Simplified30.4%
sqrt-prod35.1%
*-commutative35.1%
*-commutative35.1%
associate-+l+35.9%
unpow235.9%
hypot-udef49.5%
associate-+r+48.2%
+-commutative48.2%
associate-+r+48.9%
Applied egg-rr48.9%
sqrt-prod48.8%
Applied egg-rr48.8%
sqrt-prod65.7%
*-commutative65.7%
associate-*r*65.7%
Applied egg-rr65.7%
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 51.0%
associate-*l*51.0%
unpow251.0%
+-commutative51.0%
unpow251.0%
associate-*l*51.0%
unpow251.0%
Simplified51.0%
sqrt-prod47.2%
*-commutative47.2%
*-commutative47.2%
associate-+l+47.2%
unpow247.2%
hypot-udef71.1%
associate-+r+71.1%
+-commutative71.1%
associate-+r+71.1%
Applied egg-rr71.1%
sqrt-prod70.9%
Applied egg-rr70.9%
div-inv71.0%
distribute-rgt-neg-in71.0%
sqrt-unprod71.2%
*-commutative71.2%
associate-*r*71.2%
associate-*r*71.2%
Applied egg-rr71.2%
associate-*r/71.1%
*-rgt-identity71.1%
distribute-rgt-neg-out71.1%
distribute-neg-frac71.1%
associate-/l*71.2%
distribute-neg-frac71.2%
Simplified71.2%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Simplified0.4%
Taylor expanded in A around 0 1.7%
mul-1-neg1.7%
*-commutative1.7%
unpow21.7%
unpow21.7%
Simplified1.7%
sqrt-prod1.7%
hypot-def30.7%
Applied egg-rr30.7%
hypot-def1.7%
unpow21.7%
unpow21.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-def30.7%
Simplified30.7%
Final simplification49.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.6e-49)
(/
(* (sqrt (+ C (+ A (hypot B (- A C))))) (* (sqrt 2.0) (* B (sqrt F))))
t_0)
(if (<= B 1.02e+62)
(/
(*
(sqrt (* 2.0 (* F t_0)))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.6e-49) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(2.0) * (B * sqrt(F)))) / t_0;
} else if (B <= 1.02e+62) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.6e-49) {
tmp = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * (Math.sqrt(2.0) * (B * Math.sqrt(F)))) / t_0;
} else if (B <= 1.02e+62) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((C + Math.hypot(C, B))) * -Math.sqrt(F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -1.6e-49: tmp = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * (math.sqrt(2.0) * (B * math.sqrt(F)))) / t_0 elif B <= 1.02e+62: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((C + math.hypot(C, B))) * -math.sqrt(F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -1.6e-49) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(sqrt(2.0) * Float64(B * sqrt(F)))) / t_0); elseif (B <= 1.02e+62) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * 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) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -1.6e-49)
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(2.0) * (B * sqrt(F)))) / t_0;
elseif (B <= 1.02e+62)
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
else
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.6e-49], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[(B * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1.02e+62], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.6 \cdot 10^{-49}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(\sqrt{2} \cdot \left(B \cdot \sqrt{F}\right)\right)}{t_0}\\
\mathbf{elif}\;B \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -1.60000000000000001e-49Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
sqrt-prod21.8%
*-commutative21.8%
*-commutative21.8%
associate-+l+21.8%
unpow221.8%
hypot-udef25.6%
associate-+r+25.3%
+-commutative25.3%
associate-+r+25.2%
Applied egg-rr25.2%
sqrt-prod25.2%
Applied egg-rr25.2%
Taylor expanded in B around -inf 30.5%
mul-1-neg30.5%
*-commutative30.5%
distribute-rgt-neg-in30.5%
Simplified30.5%
if -1.60000000000000001e-49 < B < 1.02000000000000002e62Initial program 22.2%
associate-*l*22.2%
unpow222.2%
+-commutative22.2%
unpow222.2%
associate-*l*22.2%
unpow222.2%
Simplified22.2%
sqrt-prod22.7%
*-commutative22.7%
*-commutative22.7%
associate-+l+23.5%
unpow223.5%
hypot-udef37.1%
associate-+r+36.1%
+-commutative36.1%
associate-+r+36.9%
Applied egg-rr36.9%
Taylor expanded in A around -inf 20.1%
unpow220.1%
Simplified20.1%
if 1.02000000000000002e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Final simplification35.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.3e-42)
(/
(* (sqrt (+ C (+ A (hypot B (- A C))))) (* (sqrt F) (* B (sqrt 2.0))))
t_0)
(if (<= B 1e+62)
(/
(*
(sqrt (* 2.0 (* F t_0)))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.3e-42) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(F) * (B * sqrt(2.0)))) / t_0;
} else if (B <= 1e+62) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.3e-42) {
tmp = (Math.sqrt((C + (A + Math.hypot(B, (A - C))))) * (Math.sqrt(F) * (B * Math.sqrt(2.0)))) / t_0;
} else if (B <= 1e+62) {
tmp = (Math.sqrt((2.0 * (F * t_0))) * -Math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt((C + Math.hypot(C, B))) * -Math.sqrt(F));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -1.3e-42: tmp = (math.sqrt((C + (A + math.hypot(B, (A - C))))) * (math.sqrt(F) * (B * math.sqrt(2.0)))) / t_0 elif B <= 1e+62: tmp = (math.sqrt((2.0 * (F * t_0))) * -math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt((C + math.hypot(C, B))) * -math.sqrt(F)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -1.3e-42) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(sqrt(F) * Float64(B * sqrt(2.0)))) / t_0); elseif (B <= 1e+62) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * 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) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -1.3e-42)
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * (sqrt(F) * (B * sqrt(2.0)))) / t_0;
elseif (B <= 1e+62)
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
else
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.3e-42], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[(B * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1e+62], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.3 \cdot 10^{-42}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(\sqrt{F} \cdot \left(B \cdot \sqrt{2}\right)\right)}{t_0}\\
\mathbf{elif}\;B \leq 10^{+62}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -1.3e-42Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
sqrt-prod21.8%
*-commutative21.8%
*-commutative21.8%
associate-+l+21.8%
unpow221.8%
hypot-udef25.6%
associate-+r+25.3%
+-commutative25.3%
associate-+r+25.2%
Applied egg-rr25.2%
Taylor expanded in B around -inf 30.5%
associate-*r*30.5%
*-commutative30.5%
neg-mul-130.5%
distribute-lft-neg-in30.5%
Simplified30.5%
if -1.3e-42 < B < 1.00000000000000004e62Initial program 22.2%
associate-*l*22.2%
unpow222.2%
+-commutative22.2%
unpow222.2%
associate-*l*22.2%
unpow222.2%
Simplified22.2%
sqrt-prod22.7%
*-commutative22.7%
*-commutative22.7%
associate-+l+23.5%
unpow223.5%
hypot-udef37.1%
associate-+r+36.1%
+-commutative36.1%
associate-+r+36.9%
Applied egg-rr36.9%
Taylor expanded in A around -inf 20.1%
unpow220.1%
Simplified20.1%
if 1.00000000000000004e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Final simplification35.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (- (* B B) (* (* 4.0 A) C)))
(t_2 (* 2.0 (* F t_1))))
(if (<= B -4.5e+146)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.25e-120)
(* (* (sqrt (+ C (+ A (hypot B (- A C))))) (sqrt t_2)) (/ -1.0 t_1))
(if (<= B -7e-264)
(/ (- (sqrt (* t_2 (fma 2.0 C (/ -0.5 (/ A (* B B))))))) t_1)
(if (<= B 6.2e-224)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_0)
(if (<= B 1.65e-190)
(*
-0.5
(*
(sqrt 2.0)
(sqrt (/ F (/ A (fma 0.5 (/ (* B B) (* A A)) -2.0))))))
(if (<= B 1e+62)
(/
(*
(sqrt (* 2.0 (* F t_0)))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(*
(/ (sqrt 2.0) B)
(* (sqrt (+ C (hypot C B))) (- (sqrt F))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = (B * B) - ((4.0 * A) * C);
double t_2 = 2.0 * (F * t_1);
double tmp;
if (B <= -4.5e+146) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.25e-120) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * sqrt(t_2)) * (-1.0 / t_1);
} else if (B <= -7e-264) {
tmp = -sqrt((t_2 * fma(2.0, C, (-0.5 / (A / (B * B)))))) / t_1;
} else if (B <= 6.2e-224) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_0;
} else if (B <= 1.65e-190) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B * B) / (A * A)), -2.0)))));
} else if (B <= 1e+62) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt((C + hypot(C, B))) * -sqrt(F));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(B * B) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(2.0 * Float64(F * t_1)) tmp = 0.0 if (B <= -4.5e+146) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.25e-120) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * sqrt(t_2)) * Float64(-1.0 / t_1)); elseif (B <= -7e-264) tmp = Float64(Float64(-sqrt(Float64(t_2 * fma(2.0, C, Float64(-0.5 / Float64(A / Float64(B * B))))))) / t_1); elseif (B <= 6.2e-224) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_0); elseif (B <= 1.65e-190) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B * B) / Float64(A * A)), -2.0)))))); elseif (B <= 1e+62) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(Float64(C + hypot(C, B))) * 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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.5e+146], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.25e-120], 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$2], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7e-264], N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * C + N[(-0.5 / N[(A / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 6.2e-224], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 1.65e-190], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B * B), $MachinePrecision] / N[(A * A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1e+62], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(F \cdot t_1\right)\\
\mathbf{if}\;B \leq -4.5 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.25 \cdot 10^{-120}:\\
\;\;\;\;\left(\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{t_2}\right) \cdot \frac{-1}{t_1}\\
\mathbf{elif}\;B \leq -7 \cdot 10^{-264}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \mathsf{fma}\left(2, C, \frac{-0.5}{\frac{A}{B \cdot B}}\right)}}{t_1}\\
\mathbf{elif}\;B \leq 6.2 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 1.65 \cdot 10^{-190}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B \cdot B}{A \cdot A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 10^{+62}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{C + \mathsf{hypot}\left(C, B\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < -4.50000000000000026e146Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 2.4%
Taylor expanded in B around -inf 8.1%
*-commutative8.1%
Simplified8.1%
if -4.50000000000000026e146 < B < -1.25000000000000002e-120Initial program 36.9%
associate-*l*36.9%
unpow236.9%
+-commutative36.9%
unpow236.9%
associate-*l*36.9%
unpow236.9%
Simplified36.9%
sqrt-prod42.0%
*-commutative42.0%
*-commutative42.0%
associate-+l+42.3%
unpow242.3%
hypot-udef49.7%
associate-+r+49.1%
+-commutative49.1%
associate-+r+48.9%
Applied egg-rr48.9%
sqrt-prod48.9%
Applied egg-rr48.9%
div-inv48.9%
distribute-rgt-neg-in48.9%
sqrt-unprod48.9%
*-commutative48.9%
associate-*r*48.9%
associate-*r*48.9%
Applied egg-rr48.9%
if -1.25000000000000002e-120 < B < -7.0000000000000001e-264Initial program 39.6%
associate-*l*39.2%
unpow239.2%
+-commutative39.2%
unpow239.2%
associate-*l*39.2%
unpow239.2%
Simplified39.2%
unpow239.2%
hypot-udef43.6%
*-un-lft-identity43.6%
Applied egg-rr43.6%
*-lft-identity43.6%
Simplified43.6%
Taylor expanded in A around -inf 23.7%
fma-def23.7%
associate-*r/23.7%
unpow223.7%
Simplified23.7%
distribute-frac-neg23.7%
*-commutative23.7%
*-commutative23.7%
*-commutative23.7%
associate-*r*23.7%
associate-/l*23.7%
Applied egg-rr24.2%
if -7.0000000000000001e-264 < B < 6.20000000000000017e-224Initial program 6.6%
associate-*l*6.6%
unpow26.6%
+-commutative6.6%
unpow26.6%
associate-*l*6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in A around -inf 11.1%
sqrt-prod24.6%
*-commutative24.6%
*-commutative24.6%
Applied egg-rr24.6%
associate-*r*24.6%
unpow224.6%
cancel-sign-sub-inv24.6%
unpow224.6%
metadata-eval24.6%
Simplified24.6%
if 6.20000000000000017e-224 < B < 1.65000000000000009e-190Initial program 10.7%
associate-*l*10.7%
unpow210.7%
+-commutative10.7%
unpow210.7%
associate-*l*10.7%
unpow210.7%
Simplified10.7%
Taylor expanded in A around -inf 2.4%
associate-+r+2.4%
mul-1-neg2.4%
unsub-neg2.4%
distribute-lft-out2.4%
*-commutative2.4%
unpow22.4%
times-frac1.7%
unpow21.7%
unpow21.7%
Simplified1.7%
Taylor expanded in C around -inf 18.5%
*-commutative18.5%
associate-/l*18.5%
fma-neg18.5%
unpow218.5%
unpow218.5%
metadata-eval18.5%
Simplified18.5%
if 1.65000000000000009e-190 < B < 1.00000000000000004e62Initial program 21.1%
associate-*l*21.1%
unpow221.1%
+-commutative21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
Simplified21.1%
sqrt-prod22.4%
*-commutative22.4%
*-commutative22.4%
associate-+l+22.4%
unpow222.4%
hypot-udef37.8%
associate-+r+37.1%
+-commutative37.1%
associate-+r+38.3%
Applied egg-rr38.3%
Taylor expanded in A around -inf 20.4%
unpow220.4%
Simplified20.4%
if 1.00000000000000004e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Final simplification37.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) (* 4.0 (* A C))))
(t_1 (- (* B B) (* (* 4.0 A) C)))
(t_2 (* 2.0 (* F t_1))))
(if (<= B -4.2e+146)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.95e-120)
(* (* (sqrt (+ C (+ A (hypot B (- A C))))) (sqrt t_2)) (/ -1.0 t_1))
(if (<= B -1.25e-260)
(/ (- (sqrt (* t_2 (fma 2.0 C (/ -0.5 (/ A (* B B))))))) t_1)
(if (<= B 6.8e-224)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_0)
(if (<= B 7.5e-191)
(*
-0.5
(*
(sqrt 2.0)
(sqrt (/ F (/ A (fma 0.5 (/ (* B B) (* A A)) -2.0))))))
(if (<= B 6.5e+62)
(/
(*
(sqrt (* 2.0 (* F t_0)))
(- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = (B * B) - ((4.0 * A) * C);
double t_2 = 2.0 * (F * t_1);
double tmp;
if (B <= -4.2e+146) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.95e-120) {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * sqrt(t_2)) * (-1.0 / t_1);
} else if (B <= -1.25e-260) {
tmp = -sqrt((t_2 * fma(2.0, C, (-0.5 / (A / (B * B)))))) / t_1;
} else if (B <= 6.8e-224) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_0;
} else if (B <= 7.5e-191) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B * B) / (A * A)), -2.0)))));
} else if (B <= 6.5e+62) {
tmp = (sqrt((2.0 * (F * t_0))) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(B * B) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(2.0 * Float64(F * t_1)) tmp = 0.0 if (B <= -4.2e+146) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.95e-120) tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * sqrt(t_2)) * Float64(-1.0 / t_1)); elseif (B <= -1.25e-260) tmp = Float64(Float64(-sqrt(Float64(t_2 * fma(2.0, C, Float64(-0.5 / Float64(A / Float64(B * B))))))) / t_1); elseif (B <= 6.8e-224) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_0); elseif (B <= 7.5e-191) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B * B) / Float64(A * A)), -2.0)))))); elseif (B <= 6.5e+62) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_0))) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.2e+146], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.95e-120], 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$2], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.25e-260], N[((-N[Sqrt[N[(t$95$2 * N[(2.0 * C + N[(-0.5 / N[(A / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 6.8e-224], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 7.5e-191], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B * B), $MachinePrecision] / N[(A * A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.5e+62], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(F \cdot t_1\right)\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.95 \cdot 10^{-120}:\\
\;\;\;\;\left(\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \sqrt{t_2}\right) \cdot \frac{-1}{t_1}\\
\mathbf{elif}\;B \leq -1.25 \cdot 10^{-260}:\\
\;\;\;\;\frac{-\sqrt{t_2 \cdot \mathsf{fma}\left(2, C, \frac{-0.5}{\frac{A}{B \cdot B}}\right)}}{t_1}\\
\mathbf{elif}\;B \leq 6.8 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 7.5 \cdot 10^{-191}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B \cdot B}{A \cdot A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{+62}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t_0\right)} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < -4.2000000000000001e146Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 2.4%
Taylor expanded in B around -inf 8.1%
*-commutative8.1%
Simplified8.1%
if -4.2000000000000001e146 < B < -1.9500000000000001e-120Initial program 36.9%
associate-*l*36.9%
unpow236.9%
+-commutative36.9%
unpow236.9%
associate-*l*36.9%
unpow236.9%
Simplified36.9%
sqrt-prod42.0%
*-commutative42.0%
*-commutative42.0%
associate-+l+42.3%
unpow242.3%
hypot-udef49.7%
associate-+r+49.1%
+-commutative49.1%
associate-+r+48.9%
Applied egg-rr48.9%
sqrt-prod48.9%
Applied egg-rr48.9%
div-inv48.9%
distribute-rgt-neg-in48.9%
sqrt-unprod48.9%
*-commutative48.9%
associate-*r*48.9%
associate-*r*48.9%
Applied egg-rr48.9%
if -1.9500000000000001e-120 < B < -1.2500000000000001e-260Initial program 39.6%
associate-*l*39.2%
unpow239.2%
+-commutative39.2%
unpow239.2%
associate-*l*39.2%
unpow239.2%
Simplified39.2%
unpow239.2%
hypot-udef43.6%
*-un-lft-identity43.6%
Applied egg-rr43.6%
*-lft-identity43.6%
Simplified43.6%
Taylor expanded in A around -inf 23.7%
fma-def23.7%
associate-*r/23.7%
unpow223.7%
Simplified23.7%
distribute-frac-neg23.7%
*-commutative23.7%
*-commutative23.7%
*-commutative23.7%
associate-*r*23.7%
associate-/l*23.7%
Applied egg-rr24.2%
if -1.2500000000000001e-260 < B < 6.79999999999999984e-224Initial program 6.6%
associate-*l*6.6%
unpow26.6%
+-commutative6.6%
unpow26.6%
associate-*l*6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in A around -inf 11.1%
sqrt-prod24.6%
*-commutative24.6%
*-commutative24.6%
Applied egg-rr24.6%
associate-*r*24.6%
unpow224.6%
cancel-sign-sub-inv24.6%
unpow224.6%
metadata-eval24.6%
Simplified24.6%
if 6.79999999999999984e-224 < B < 7.4999999999999995e-191Initial program 10.7%
associate-*l*10.7%
unpow210.7%
+-commutative10.7%
unpow210.7%
associate-*l*10.7%
unpow210.7%
Simplified10.7%
Taylor expanded in A around -inf 2.4%
associate-+r+2.4%
mul-1-neg2.4%
unsub-neg2.4%
distribute-lft-out2.4%
*-commutative2.4%
unpow22.4%
times-frac1.7%
unpow21.7%
unpow21.7%
Simplified1.7%
Taylor expanded in C around -inf 18.5%
*-commutative18.5%
associate-/l*18.5%
fma-neg18.5%
unpow218.5%
unpow218.5%
metadata-eval18.5%
Simplified18.5%
if 7.4999999999999995e-191 < B < 6.5000000000000003e62Initial program 21.1%
associate-*l*21.1%
unpow221.1%
+-commutative21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
Simplified21.1%
sqrt-prod22.4%
*-commutative22.4%
*-commutative22.4%
associate-+l+22.4%
unpow222.4%
hypot-udef37.8%
associate-+r+37.1%
+-commutative37.1%
associate-+r+38.3%
Applied egg-rr38.3%
Taylor expanded in A around -inf 20.4%
unpow220.4%
Simplified20.4%
if 6.5000000000000003e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Taylor expanded in C around 0 74.0%
Final simplification36.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (sqrt (* 2.0 (* F t_0))))
(t_2 (- (* B B) (* (* 4.0 A) C))))
(if (<= B -4.5e+151)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -9e-121)
(/ (* t_1 (- (sqrt (+ C (+ A (hypot B (- A C))))))) t_0)
(if (<= B -1.12e-264)
(/
(- (sqrt (* (* 2.0 (* F t_2)) (fma 2.0 C (/ -0.5 (/ A (* B B)))))))
t_2)
(if (<= B 6.3e-224)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_0)
(if (<= B 8.5e-191)
(*
-0.5
(*
(sqrt 2.0)
(sqrt (/ F (/ A (fma 0.5 (/ (* B B) (* A A)) -2.0))))))
(if (<= B 1e+62)
(/ (* t_1 (- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A))))))) t_0)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B))))))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = sqrt((2.0 * (F * t_0)));
double t_2 = (B * B) - ((4.0 * A) * C);
double tmp;
if (B <= -4.5e+151) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -9e-121) {
tmp = (t_1 * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
} else if (B <= -1.12e-264) {
tmp = -sqrt(((2.0 * (F * t_2)) * fma(2.0, C, (-0.5 / (A / (B * B)))))) / t_2;
} else if (B <= 6.3e-224) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_0;
} else if (B <= 8.5e-191) {
tmp = -0.5 * (sqrt(2.0) * sqrt((F / (A / fma(0.5, ((B * B) / (A * A)), -2.0)))));
} else if (B <= 1e+62) {
tmp = (t_1 * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = sqrt(Float64(2.0 * Float64(F * t_0))) t_2 = Float64(Float64(B * B) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if (B <= -4.5e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -9e-121) tmp = Float64(Float64(t_1 * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_0); elseif (B <= -1.12e-264) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_2)) * fma(2.0, C, Float64(-0.5 / Float64(A / Float64(B * B))))))) / t_2); elseif (B <= 6.3e-224) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_0); elseif (B <= 8.5e-191) tmp = Float64(-0.5 * Float64(sqrt(2.0) * sqrt(Float64(F / Float64(A / fma(0.5, Float64(Float64(B * B) / Float64(A * A)), -2.0)))))); elseif (B <= 1e+62) tmp = Float64(Float64(t_1 * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.5e+151], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -9e-121], N[(N[(t$95$1 * (-N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -1.12e-264], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$2), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 / N[(A / N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 6.3e-224], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, 8.5e-191], N[(-0.5 * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(F / N[(A / N[(0.5 * N[(N[(B * B), $MachinePrecision] / N[(A * A), $MachinePrecision]), $MachinePrecision] + -2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1e+62], N[(N[(t$95$1 * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \sqrt{2 \cdot \left(F \cdot t_0\right)}\\
t_2 := B \cdot B - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B \leq -4.5 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -9 \cdot 10^{-121}:\\
\;\;\;\;\frac{t_1 \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;B \leq -1.12 \cdot 10^{-264}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_2\right)\right) \cdot \mathsf{fma}\left(2, C, \frac{-0.5}{\frac{A}{B \cdot B}}\right)}}{t_2}\\
\mathbf{elif}\;B \leq 6.3 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\mathbf{elif}\;B \leq 8.5 \cdot 10^{-191}:\\
\;\;\;\;-0.5 \cdot \left(\sqrt{2} \cdot \sqrt{\frac{F}{\frac{A}{\mathsf{fma}\left(0.5, \frac{B \cdot B}{A \cdot A}, -2\right)}}}\right)\\
\mathbf{elif}\;B \leq 10^{+62}:\\
\;\;\;\;\frac{t_1 \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < -4.4999999999999999e151Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 5.9%
*-commutative5.9%
Simplified5.9%
if -4.4999999999999999e151 < B < -9.0000000000000007e-121Initial program 36.3%
associate-*l*36.3%
unpow236.3%
+-commutative36.3%
unpow236.3%
associate-*l*36.3%
unpow236.3%
Simplified36.3%
sqrt-prod41.3%
*-commutative41.3%
*-commutative41.3%
associate-+l+41.6%
unpow241.6%
hypot-udef50.6%
associate-+r+50.0%
+-commutative50.0%
associate-+r+49.7%
Applied egg-rr49.7%
if -9.0000000000000007e-121 < B < -1.12000000000000009e-264Initial program 39.6%
associate-*l*39.2%
unpow239.2%
+-commutative39.2%
unpow239.2%
associate-*l*39.2%
unpow239.2%
Simplified39.2%
unpow239.2%
hypot-udef43.6%
*-un-lft-identity43.6%
Applied egg-rr43.6%
*-lft-identity43.6%
Simplified43.6%
Taylor expanded in A around -inf 23.7%
fma-def23.7%
associate-*r/23.7%
unpow223.7%
Simplified23.7%
distribute-frac-neg23.7%
*-commutative23.7%
*-commutative23.7%
*-commutative23.7%
associate-*r*23.7%
associate-/l*23.7%
Applied egg-rr24.2%
if -1.12000000000000009e-264 < B < 6.30000000000000043e-224Initial program 6.6%
associate-*l*6.6%
unpow26.6%
+-commutative6.6%
unpow26.6%
associate-*l*6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in A around -inf 11.1%
sqrt-prod24.6%
*-commutative24.6%
*-commutative24.6%
Applied egg-rr24.6%
associate-*r*24.6%
unpow224.6%
cancel-sign-sub-inv24.6%
unpow224.6%
metadata-eval24.6%
Simplified24.6%
if 6.30000000000000043e-224 < B < 8.49999999999999954e-191Initial program 10.7%
associate-*l*10.7%
unpow210.7%
+-commutative10.7%
unpow210.7%
associate-*l*10.7%
unpow210.7%
Simplified10.7%
Taylor expanded in A around -inf 2.4%
associate-+r+2.4%
mul-1-neg2.4%
unsub-neg2.4%
distribute-lft-out2.4%
*-commutative2.4%
unpow22.4%
times-frac1.7%
unpow21.7%
unpow21.7%
Simplified1.7%
Taylor expanded in C around -inf 18.5%
*-commutative18.5%
associate-/l*18.5%
fma-neg18.5%
unpow218.5%
unpow218.5%
metadata-eval18.5%
Simplified18.5%
if 8.49999999999999954e-191 < B < 1.00000000000000004e62Initial program 21.1%
associate-*l*21.1%
unpow221.1%
+-commutative21.1%
unpow221.1%
associate-*l*21.1%
unpow221.1%
Simplified21.1%
sqrt-prod22.4%
*-commutative22.4%
*-commutative22.4%
associate-+l+22.4%
unpow222.4%
hypot-udef37.8%
associate-+r+37.1%
+-commutative37.1%
associate-+r+38.3%
Applied egg-rr38.3%
Taylor expanded in A around -inf 20.4%
unpow220.4%
Simplified20.4%
if 1.00000000000000004e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Taylor expanded in C around 0 74.0%
Final simplification36.7%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* F t_0)))
(if (<= B -4e+146)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.1e-98)
(* (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) t_1))) (/ -1.0 t_0))
(if (<= B 2.05e+62)
(/
(* (sqrt (* 2.0 t_1)) (- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_0)
(* (/ (sqrt 2.0) B) (* (sqrt F) (- (sqrt B)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = F * t_0;
double tmp;
if (B <= -4e+146) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.1e-98) {
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * t_1))) * (-1.0 / t_0);
} else if (B <= 2.05e+62) {
tmp = (sqrt((2.0 * t_1)) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = F * t_0;
double tmp;
if (B <= -4e+146) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.1e-98) {
tmp = Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * t_1))) * (-1.0 / t_0);
} else if (B <= 2.05e+62) {
tmp = (Math.sqrt((2.0 * t_1)) * -Math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * (Math.sqrt(F) * -Math.sqrt(B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = F * t_0 tmp = 0 if B <= -4e+146: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.1e-98: tmp = math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * t_1))) * (-1.0 / t_0) elif B <= 2.05e+62: tmp = (math.sqrt((2.0 * t_1)) * -math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * (math.sqrt(F) * -math.sqrt(B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -4e+146) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.1e-98) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * t_1))) * Float64(-1.0 / t_0)); elseif (B <= 2.05e+62) tmp = Float64(Float64(sqrt(Float64(2.0 * t_1)) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(sqrt(F) * Float64(-sqrt(B)))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -4e+146)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.1e-98)
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * t_1))) * (-1.0 / t_0);
elseif (B <= 2.05e+62)
tmp = (sqrt((2.0 * t_1)) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_0;
else
tmp = (sqrt(2.0) / B) * (sqrt(F) * -sqrt(B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -4e+146], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.1e-98], N[(N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.05e+62], N[(N[(N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -4 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.1 \cdot 10^{-98}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot t_1\right)} \cdot \frac{-1}{t_0}\\
\mathbf{elif}\;B \leq 2.05 \cdot 10^{+62}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_1} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B}\right)\right)\\
\end{array}
\end{array}
if B < -3.99999999999999973e146Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 2.4%
Taylor expanded in B around -inf 8.1%
*-commutative8.1%
Simplified8.1%
if -3.99999999999999973e146 < B < -1.09999999999999998e-98Initial program 40.4%
associate-*l*40.4%
unpow240.4%
+-commutative40.4%
unpow240.4%
associate-*l*40.4%
unpow240.4%
Simplified40.4%
div-inv40.4%
Applied egg-rr46.4%
if -1.09999999999999998e-98 < B < 2.04999999999999992e62Initial program 20.2%
associate-*l*20.1%
unpow220.1%
+-commutative20.1%
unpow220.1%
associate-*l*20.1%
unpow220.1%
Simplified20.1%
sqrt-prod20.6%
*-commutative20.6%
*-commutative20.6%
associate-+l+21.3%
unpow221.3%
hypot-udef35.1%
associate-+r+34.1%
+-commutative34.1%
associate-+r+35.0%
Applied egg-rr35.0%
Taylor expanded in A around -inf 20.6%
unpow220.6%
Simplified20.6%
if 2.04999999999999992e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in A around 0 13.4%
mul-1-neg13.4%
*-commutative13.4%
unpow213.4%
unpow213.4%
Simplified13.4%
sqrt-prod15.2%
hypot-def75.3%
Applied egg-rr75.3%
hypot-def15.2%
unpow215.2%
unpow215.2%
+-commutative15.2%
unpow215.2%
unpow215.2%
hypot-def75.3%
Simplified75.3%
Taylor expanded in C around 0 74.0%
Final simplification35.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))) (t_1 (- (* B B) (* 4.0 (* A C)))) (t_2 (* F t_1)))
(if (<= B -4.2e+144)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.7e-98)
(* (sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) t_2))) (/ -1.0 t_1))
(if (<= B 4e+80)
(/
(* (sqrt (* 2.0 t_2)) (- (sqrt (+ C (+ C (* -0.5 (/ (* B B) A)))))))
t_1)
(if (<= B 3.6e+282)
(* (sqrt (+ (* C F) (* B F))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = F * t_1;
double tmp;
if (B <= -4.2e+144) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-98) {
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * t_2))) * (-1.0 / t_1);
} else if (B <= 4e+80) {
tmp = (sqrt((2.0 * t_2)) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_1;
} else if (B <= 3.6e+282) {
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = sqrt((F / 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(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = F * t_1;
double tmp;
if (B <= -4.2e+144) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-98) {
tmp = Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * t_2))) * (-1.0 / t_1);
} else if (B <= 4e+80) {
tmp = (Math.sqrt((2.0 * t_2)) * -Math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_1;
} else if (B <= 3.6e+282) {
tmp = Math.sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = Math.sqrt((F / B)) * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) t_1 = (B * B) - (4.0 * (A * C)) t_2 = F * t_1 tmp = 0 if B <= -4.2e+144: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.7e-98: tmp = math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * t_2))) * (-1.0 / t_1) elif B <= 4e+80: tmp = (math.sqrt((2.0 * t_2)) * -math.sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_1 elif B <= 3.6e+282: tmp = math.sqrt(((C * F) + (B * F))) * (t_0 / B) else: tmp = math.sqrt((F / B)) * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_2 = Float64(F * t_1) tmp = 0.0 if (B <= -4.2e+144) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.7e-98) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * t_2))) * Float64(-1.0 / t_1)); elseif (B <= 4e+80) tmp = Float64(Float64(sqrt(Float64(2.0 * t_2)) * Float64(-sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))))) / t_1); elseif (B <= 3.6e+282) tmp = Float64(sqrt(Float64(Float64(C * F) + Float64(B * F))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -sqrt(2.0);
t_1 = (B * B) - (4.0 * (A * C));
t_2 = F * t_1;
tmp = 0.0;
if (B <= -4.2e+144)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.7e-98)
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * t_2))) * (-1.0 / t_1);
elseif (B <= 4e+80)
tmp = (sqrt((2.0 * t_2)) * -sqrt((C + (C + (-0.5 * ((B * B) / A)))))) / t_1;
elseif (B <= 3.6e+282)
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
else
tmp = sqrt((F / 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[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$1), $MachinePrecision]}, If[LessEqual[B, -4.2e+144], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.7e-98], N[(N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4e+80], N[(N[(N[Sqrt[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 3.6e+282], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] + N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_2 := F \cdot t_1\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+144}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.7 \cdot 10^{-98}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot t_2\right)} \cdot \frac{-1}{t_1}\\
\mathbf{elif}\;B \leq 4 \cdot 10^{+80}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_2} \cdot \left(-\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)}\right)}{t_1}\\
\mathbf{elif}\;B \leq 3.6 \cdot 10^{+282}:\\
\;\;\;\;\sqrt{C \cdot F + B \cdot F} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if B < -4.19999999999999993e144Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 2.4%
Taylor expanded in B around -inf 8.1%
*-commutative8.1%
Simplified8.1%
if -4.19999999999999993e144 < B < -1.7000000000000001e-98Initial program 40.4%
associate-*l*40.4%
unpow240.4%
+-commutative40.4%
unpow240.4%
associate-*l*40.4%
unpow240.4%
Simplified40.4%
div-inv40.4%
Applied egg-rr46.4%
if -1.7000000000000001e-98 < B < 4e80Initial program 19.9%
associate-*l*19.8%
unpow219.8%
+-commutative19.8%
unpow219.8%
associate-*l*19.8%
unpow219.8%
Simplified19.8%
sqrt-prod20.3%
*-commutative20.3%
*-commutative20.3%
associate-+l+21.0%
unpow221.0%
hypot-udef34.6%
associate-+r+33.6%
+-commutative33.6%
associate-+r+34.4%
Applied egg-rr34.4%
Taylor expanded in A around -inf 20.2%
unpow220.2%
Simplified20.2%
if 4e80 < B < 3.59999999999999986e282Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 3.59999999999999986e282 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Final simplification32.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (sqrt 2.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -4e+146)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.02e-55)
(*
(sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_1))))
(/ -1.0 t_1))
(if (<= B 1.25e+81)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_1)
(if (<= B 1.9e+283)
(* (sqrt (+ (* C F) (* B F))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4e+146) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.02e-55) {
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_1)))) * (-1.0 / t_1);
} else if (B <= 1.25e+81) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
} else if (B <= 1.9e+283) {
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = sqrt((F / 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(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4e+146) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.02e-55) {
tmp = Math.sqrt((2.0 * ((C + (A + Math.hypot(B, (A - C)))) * (F * t_1)))) * (-1.0 / t_1);
} else if (B <= 1.25e+81) {
tmp = (Math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -Math.sqrt((2.0 * C))) / t_1;
} else if (B <= 1.9e+283) {
tmp = Math.sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = Math.sqrt((F / B)) * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -4e+146: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.02e-55: tmp = math.sqrt((2.0 * ((C + (A + math.hypot(B, (A - C)))) * (F * t_1)))) * (-1.0 / t_1) elif B <= 1.25e+81: tmp = (math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -math.sqrt((2.0 * C))) / t_1 elif B <= 1.9e+283: tmp = math.sqrt(((C * F) + (B * F))) * (t_0 / B) else: tmp = math.sqrt((F / B)) * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -4e+146) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.02e-55) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_1)))) * Float64(-1.0 / t_1)); elseif (B <= 1.25e+81) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_1); elseif (B <= 1.9e+283) tmp = Float64(sqrt(Float64(Float64(C * F) + Float64(B * F))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -sqrt(2.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -4e+146)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.02e-55)
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_1)))) * (-1.0 / t_1);
elseif (B <= 1.25e+81)
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
elseif (B <= 1.9e+283)
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
else
tmp = sqrt((F / 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[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4e+146], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.02e-55], N[(N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.25e+81], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 1.9e+283], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] + N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -4 \cdot 10^{+146}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.02 \cdot 10^{-55}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_1\right)\right)} \cdot \frac{-1}{t_1}\\
\mathbf{elif}\;B \leq 1.25 \cdot 10^{+81}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_1}\\
\mathbf{elif}\;B \leq 1.9 \cdot 10^{+283}:\\
\;\;\;\;\sqrt{C \cdot F + B \cdot F} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if B < -3.99999999999999973e146Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 2.4%
Taylor expanded in B around -inf 8.1%
*-commutative8.1%
Simplified8.1%
if -3.99999999999999973e146 < B < -1.02e-55Initial program 38.5%
associate-*l*38.5%
unpow238.5%
+-commutative38.5%
unpow238.5%
associate-*l*38.5%
unpow238.5%
Simplified38.5%
div-inv38.5%
Applied egg-rr43.3%
if -1.02e-55 < B < 1.25e81Initial program 21.9%
associate-*l*21.8%
unpow221.8%
+-commutative21.8%
unpow221.8%
associate-*l*21.8%
unpow221.8%
Simplified21.8%
Taylor expanded in A around -inf 16.2%
sqrt-prod19.7%
*-commutative19.7%
*-commutative19.7%
Applied egg-rr19.7%
associate-*r*19.7%
unpow219.7%
cancel-sign-sub-inv19.7%
unpow219.7%
metadata-eval19.7%
Simplified19.7%
if 1.25e81 < B < 1.9000000000000001e283Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 1.9000000000000001e283 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
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 (- (sqrt 2.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.6e+130)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.6e-40)
(- (/ (sqrt (* (* 2.0 (* F t_1)) (- A (- B C)))) t_1))
(if (<= B 5.4e+80)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_1)
(if (<= B 3e+280)
(* (sqrt (+ (* C F) (* B F))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.6e+130) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.6e-40) {
tmp = -(sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
} else if (B <= 5.4e+80) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
} else if (B <= 3e+280) {
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = sqrt((F / B)) * t_0;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -sqrt(2.0d0)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-1.6d+130)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-1.6d-40)) then
tmp = -(sqrt(((2.0d0 * (f * t_1)) * (a - (b - c)))) / t_1)
else if (b <= 5.4d+80) then
tmp = (sqrt(((2.0d0 * f) * ((b * b) + ((-4.0d0) * (a * c))))) * -sqrt((2.0d0 * c))) / t_1
else if (b <= 3d+280) then
tmp = sqrt(((c * f) + (b * f))) * (t_0 / b)
else
tmp = sqrt((f / b)) * t_0
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -1.6e+130) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.6e-40) {
tmp = -(Math.sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
} else if (B <= 5.4e+80) {
tmp = (Math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -Math.sqrt((2.0 * C))) / t_1;
} else if (B <= 3e+280) {
tmp = Math.sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = Math.sqrt((F / B)) * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -1.6e+130: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.6e-40: tmp = -(math.sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1) elif B <= 5.4e+80: tmp = (math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -math.sqrt((2.0 * C))) / t_1 elif B <= 3e+280: tmp = math.sqrt(((C * F) + (B * F))) * (t_0 / B) else: tmp = math.sqrt((F / B)) * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -1.6e+130) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.6e-40) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(A - Float64(B - C)))) / t_1)); elseif (B <= 5.4e+80) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_1); elseif (B <= 3e+280) tmp = Float64(sqrt(Float64(Float64(C * F) + Float64(B * F))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -sqrt(2.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -1.6e+130)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.6e-40)
tmp = -(sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
elseif (B <= 5.4e+80)
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
elseif (B <= 3e+280)
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
else
tmp = sqrt((F / 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[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.6e+130], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.6e-40], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(A - N[(B - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[B, 5.4e+80], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 3e+280], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] + N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.6 \cdot 10^{+130}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.6 \cdot 10^{-40}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A - \left(B - C\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 5.4 \cdot 10^{+80}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_1}\\
\mathbf{elif}\;B \leq 3 \cdot 10^{+280}:\\
\;\;\;\;\sqrt{C \cdot F + B \cdot F} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if B < -1.6e130Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -1.6e130 < B < -1.60000000000000001e-40Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in B around -inf 39.3%
mul-1-neg39.3%
unsub-neg39.3%
Simplified39.3%
if -1.60000000000000001e-40 < B < 5.39999999999999966e80Initial program 21.9%
associate-*l*21.8%
unpow221.8%
+-commutative21.8%
unpow221.8%
associate-*l*21.8%
unpow221.8%
Simplified21.8%
Taylor expanded in A around -inf 16.2%
sqrt-prod19.7%
*-commutative19.7%
*-commutative19.7%
Applied egg-rr19.7%
associate-*r*19.7%
unpow219.7%
cancel-sign-sub-inv19.7%
unpow219.7%
metadata-eval19.7%
Simplified19.7%
if 5.39999999999999966e80 < B < 3.0000000000000001e280Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 3.0000000000000001e280 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Final simplification29.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 2.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -9.8e+148)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.7e-48)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (+ C (hypot B C))))) t_1)
(if (<= B 5.2e+82)
(/
(*
(sqrt (* (* 2.0 F) (+ (* B B) (* -4.0 (* A C)))))
(- (sqrt (* 2.0 C))))
t_1)
(if (<= B 5.2e+279)
(* (sqrt (+ (* C F) (* B F))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -9.8e+148) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-48) {
tmp = -sqrt(((2.0 * (F * t_1)) * (C + hypot(B, C)))) / t_1;
} else if (B <= 5.2e+82) {
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
} else if (B <= 5.2e+279) {
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = sqrt((F / 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(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -9.8e+148) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-48) {
tmp = -Math.sqrt(((2.0 * (F * t_1)) * (C + Math.hypot(B, C)))) / t_1;
} else if (B <= 5.2e+82) {
tmp = (Math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -Math.sqrt((2.0 * C))) / t_1;
} else if (B <= 5.2e+279) {
tmp = Math.sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = Math.sqrt((F / B)) * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -9.8e+148: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.7e-48: tmp = -math.sqrt(((2.0 * (F * t_1)) * (C + math.hypot(B, C)))) / t_1 elif B <= 5.2e+82: tmp = (math.sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -math.sqrt((2.0 * C))) / t_1 elif B <= 5.2e+279: tmp = math.sqrt(((C * F) + (B * F))) * (t_0 / B) else: tmp = math.sqrt((F / B)) * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -9.8e+148) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.7e-48) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(C + hypot(B, C))))) / t_1); elseif (B <= 5.2e+82) tmp = Float64(Float64(sqrt(Float64(Float64(2.0 * F) * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))))) * Float64(-sqrt(Float64(2.0 * C)))) / t_1); elseif (B <= 5.2e+279) tmp = Float64(sqrt(Float64(Float64(C * F) + Float64(B * F))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -sqrt(2.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -9.8e+148)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.7e-48)
tmp = -sqrt(((2.0 * (F * t_1)) * (C + hypot(B, C)))) / t_1;
elseif (B <= 5.2e+82)
tmp = (sqrt(((2.0 * F) * ((B * B) + (-4.0 * (A * C))))) * -sqrt((2.0 * C))) / t_1;
elseif (B <= 5.2e+279)
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
else
tmp = sqrt((F / 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[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -9.8e+148], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.7e-48], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 5.2e+82], N[(N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B, 5.2e+279], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] + N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -9.8 \cdot 10^{+148}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.7 \cdot 10^{-48}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 5.2 \cdot 10^{+82}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_1}\\
\mathbf{elif}\;B \leq 5.2 \cdot 10^{+279}:\\
\;\;\;\;\sqrt{C \cdot F + B \cdot F} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if B < -9.8e148Initial program 0.1%
associate-*l*0.1%
unpow20.1%
+-commutative0.1%
unpow20.1%
associate-*l*0.1%
unpow20.1%
Simplified0.1%
Taylor expanded in A around -inf 0.0%
Taylor expanded in B around -inf 5.9%
*-commutative5.9%
Simplified5.9%
if -9.8e148 < B < -1.70000000000000014e-48Initial program 37.7%
associate-*l*37.7%
unpow237.7%
+-commutative37.7%
unpow237.7%
associate-*l*37.7%
unpow237.7%
Simplified37.7%
Taylor expanded in A around 0 36.9%
unpow236.9%
unpow236.9%
hypot-def39.4%
Simplified39.4%
if -1.70000000000000014e-48 < B < 5.1999999999999997e82Initial program 21.9%
associate-*l*21.8%
unpow221.8%
+-commutative21.8%
unpow221.8%
associate-*l*21.8%
unpow221.8%
Simplified21.8%
Taylor expanded in A around -inf 16.2%
sqrt-prod19.7%
*-commutative19.7%
*-commutative19.7%
Applied egg-rr19.7%
associate-*r*19.7%
unpow219.7%
cancel-sign-sub-inv19.7%
unpow219.7%
metadata-eval19.7%
Simplified19.7%
if 5.1999999999999997e82 < B < 5.2000000000000003e279Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 5.2000000000000003e279 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Final simplification29.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 2.0))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -8.5e+131)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.15e-44)
(- (/ (sqrt (* (* 2.0 (* F t_1)) (- A (- B C)))) t_1))
(if (<= B 4e+80)
(- (/ (sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C)))))) t_1))
(if (<= B 1e+283)
(* (sqrt (+ (* C F) (* B F))) (/ t_0 B))
(* (sqrt (/ F B)) t_0)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -8.5e+131) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.15e-44) {
tmp = -(sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
} else if (B <= 4e+80) {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
} else if (B <= 1e+283) {
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = sqrt((F / B)) * t_0;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = -sqrt(2.0d0)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-8.5d+131)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-1.15d-44)) then
tmp = -(sqrt(((2.0d0 * (f * t_1)) * (a - (b - c)))) / t_1)
else if (b <= 4d+80) then
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / t_1)
else if (b <= 1d+283) then
tmp = sqrt(((c * f) + (b * f))) * (t_0 / b)
else
tmp = sqrt((f / b)) * t_0
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = -Math.sqrt(2.0);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -8.5e+131) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.15e-44) {
tmp = -(Math.sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
} else if (B <= 4e+80) {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
} else if (B <= 1e+283) {
tmp = Math.sqrt(((C * F) + (B * F))) * (t_0 / B);
} else {
tmp = Math.sqrt((F / B)) * t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -math.sqrt(2.0) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -8.5e+131: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.15e-44: tmp = -(math.sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1) elif B <= 4e+80: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1) elif B <= 1e+283: tmp = math.sqrt(((C * F) + (B * F))) * (t_0 / B) else: tmp = math.sqrt((F / B)) * t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-sqrt(2.0)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -8.5e+131) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.15e-44) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(A - Float64(B - C)))) / t_1)); elseif (B <= 4e+80) tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / t_1)); elseif (B <= 1e+283) tmp = Float64(sqrt(Float64(Float64(C * F) + Float64(B * F))) * Float64(t_0 / B)); else tmp = Float64(sqrt(Float64(F / B)) * t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -sqrt(2.0);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -8.5e+131)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.15e-44)
tmp = -(sqrt(((2.0 * (F * t_1)) * (A - (B - C)))) / t_1);
elseif (B <= 4e+80)
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
elseif (B <= 1e+283)
tmp = sqrt(((C * F) + (B * F))) * (t_0 / B);
else
tmp = sqrt((F / 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[2.0], $MachinePrecision])}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -8.5e+131], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.15e-44], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(A - N[(B - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[B, 4e+80], (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), If[LessEqual[B, 1e+283], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] + N[(B * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -\sqrt{2}\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -8.5 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.15 \cdot 10^{-44}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(A - \left(B - C\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 4 \cdot 10^{+80}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 10^{+283}:\\
\;\;\;\;\sqrt{C \cdot F + B \cdot F} \cdot \frac{t_0}{B}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot t_0\\
\end{array}
\end{array}
if B < -8.50000000000000063e131Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -8.50000000000000063e131 < B < -1.14999999999999999e-44Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in B around -inf 39.3%
mul-1-neg39.3%
unsub-neg39.3%
Simplified39.3%
if -1.14999999999999999e-44 < B < 4e80Initial program 21.9%
associate-*l*21.8%
unpow221.8%
+-commutative21.8%
unpow221.8%
associate-*l*21.8%
unpow221.8%
Simplified21.8%
Taylor expanded in A around -inf 16.2%
Taylor expanded in F around 0 16.2%
associate-*r*16.2%
*-commutative16.2%
cancel-sign-sub-inv16.2%
unpow216.2%
metadata-eval16.2%
*-commutative16.2%
Simplified16.2%
if 4e80 < B < 9.99999999999999955e282Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 9.99999999999999955e282 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Final simplification28.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) (* 4.0 (* A C)))))
(if (<= B -6.4e+131)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1e-42)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (- A (- B C)))) t_0))
(if (<= B 4.8e+82)
(- (/ (sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C)))))) t_0))
(if (<= B 3.8e+280)
(* (/ (sqrt 2.0) B) (- (sqrt (* B F))))
(* (sqrt (/ F B)) (- (sqrt 2.0)))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -6.4e+131) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1e-42) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else if (B <= 4.8e+82) {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
} else if (B <= 3.8e+280) {
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
} 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) - (4.0d0 * (a * c))
if (b <= (-6.4d+131)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-1d-42)) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (a - (b - c)))) / t_0)
else if (b <= 4.8d+82) then
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / t_0)
else if (b <= 3.8d+280) then
tmp = (sqrt(2.0d0) / b) * -sqrt((b * f))
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) - (4.0 * (A * C));
double tmp;
if (B <= -6.4e+131) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1e-42) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else if (B <= 4.8e+82) {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
} else if (B <= 3.8e+280) {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * F));
} 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) - (4.0 * (A * C)) tmp = 0 if B <= -6.4e+131: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1e-42: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0) elif B <= 4.8e+82: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0) elif B <= 3.8e+280: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * F)) 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(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -6.4e+131) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1e-42) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A - Float64(B - C)))) / t_0)); elseif (B <= 4.8e+82) tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / t_0)); elseif (B <= 3.8e+280) tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * F)))); 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) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -6.4e+131)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1e-42)
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
elseif (B <= 4.8e+82)
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
elseif (B <= 3.8e+280)
tmp = (sqrt(2.0) / B) * -sqrt((B * F));
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -6.4e+131], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1e-42], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A - N[(B - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 4.8e+82], (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 3.8e+280], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * F), $MachinePrecision]], $MachinePrecision])), $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 - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -6.4 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1 \cdot 10^{-42}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A - \left(B - C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4.8 \cdot 10^{+82}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.8 \cdot 10^{+280}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -6.4000000000000004e131Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -6.4000000000000004e131 < B < -1.00000000000000004e-42Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in B around -inf 39.3%
mul-1-neg39.3%
unsub-neg39.3%
Simplified39.3%
if -1.00000000000000004e-42 < B < 4.79999999999999996e82Initial program 21.9%
associate-*l*21.8%
unpow221.8%
+-commutative21.8%
unpow221.8%
associate-*l*21.8%
unpow221.8%
Simplified21.8%
Taylor expanded in A around -inf 16.2%
Taylor expanded in F around 0 16.2%
associate-*r*16.2%
*-commutative16.2%
cancel-sign-sub-inv16.2%
unpow216.2%
metadata-eval16.2%
*-commutative16.2%
Simplified16.2%
if 4.79999999999999996e82 < B < 3.79999999999999964e280Initial program 9.7%
Simplified10.0%
Taylor expanded in A around 0 16.4%
mul-1-neg16.4%
*-commutative16.4%
unpow216.4%
unpow216.4%
Simplified16.4%
Taylor expanded in C around 0 61.4%
if 3.79999999999999964e280 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around 0 0.0%
Taylor expanded in A around 0 64.2%
mul-1-neg64.2%
Simplified64.2%
Final simplification28.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) (* 4.0 (* A C)))))
(if (<= B -9.6e+131)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -7.5e-49)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (- A (- B C)))) t_0))
(if (<= B 4.2e+62)
(- (/ (sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C)))))) 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) - (4.0 * (A * C));
double tmp;
if (B <= -9.6e+131) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -7.5e-49) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else if (B <= 4.2e+62) {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / 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) - (4.0d0 * (a * c))
if (b <= (-9.6d+131)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-7.5d-49)) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (a - (b - c)))) / t_0)
else if (b <= 4.2d+62) then
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / 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) - (4.0 * (A * C));
double tmp;
if (B <= -9.6e+131) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -7.5e-49) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else if (B <= 4.2e+62) {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / 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) - (4.0 * (A * C)) tmp = 0 if B <= -9.6e+131: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -7.5e-49: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0) elif B <= 4.2e+62: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / 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(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -9.6e+131) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -7.5e-49) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A - Float64(B - C)))) / t_0)); elseif (B <= 4.2e+62) tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / 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) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -9.6e+131)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -7.5e-49)
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
elseif (B <= 4.2e+62)
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / 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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -9.6e+131], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -7.5e-49], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A - N[(B - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 4.2e+62], (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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 - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -9.6 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -7.5 \cdot 10^{-49}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A - \left(B - C\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 4.2 \cdot 10^{+62}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < -9.5999999999999998e131Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -9.5999999999999998e131 < B < -7.4999999999999998e-49Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in B around -inf 39.3%
mul-1-neg39.3%
unsub-neg39.3%
Simplified39.3%
if -7.4999999999999998e-49 < B < 4.2e62Initial program 22.2%
associate-*l*22.2%
unpow222.2%
+-commutative22.2%
unpow222.2%
associate-*l*22.2%
unpow222.2%
Simplified22.2%
Taylor expanded in A around -inf 16.5%
Taylor expanded in F around 0 16.5%
associate-*r*16.5%
*-commutative16.5%
cancel-sign-sub-inv16.5%
unpow216.5%
metadata-eval16.5%
*-commutative16.5%
Simplified16.5%
if 4.2e62 < B Initial program 7.7%
Simplified7.9%
Taylor expanded in C around 0 10.9%
Taylor expanded in A around 0 50.1%
mul-1-neg50.1%
Simplified50.1%
Final simplification25.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -4.5e+130)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -2.6e-40)
(- (/ (sqrt (* (* 2.0 (* F t_0)) (- A (- B C)))) t_0))
(- (/ (sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C)))))) t_0))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4.5e+130) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -2.6e-40) {
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= (-4.5d+130)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-2.6d-40)) then
tmp = -(sqrt(((2.0d0 * (f * t_0)) * (a - (b - c)))) / t_0)
else
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / t_0)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -4.5e+130) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -2.6e-40) {
tmp = -(Math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
} else {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -4.5e+130: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -2.6e-40: tmp = -(math.sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0) else: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -4.5e+130) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -2.6e-40) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(F * t_0)) * Float64(A - Float64(B - C)))) / t_0)); else tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / t_0)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -4.5e+130)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -2.6e-40)
tmp = -(sqrt(((2.0 * (F * t_0)) * (A - (B - C)))) / t_0);
else
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -4.5e+130], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -2.6e-40], (-N[(N[Sqrt[N[(N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision] * N[(A - N[(B - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision])]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -4.5 \cdot 10^{+130}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -2.6 \cdot 10^{-40}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot \left(F \cdot t_0\right)\right) \cdot \left(A - \left(B - C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -4.50000000000000039e130Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -4.50000000000000039e130 < B < -2.6000000000000001e-40Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in B around -inf 39.3%
mul-1-neg39.3%
unsub-neg39.3%
Simplified39.3%
if -2.6000000000000001e-40 < B Initial program 17.6%
associate-*l*17.5%
unpow217.5%
+-commutative17.5%
unpow217.5%
associate-*l*17.5%
unpow217.5%
Simplified17.5%
Taylor expanded in A around -inf 11.4%
Taylor expanded in F around 0 11.4%
associate-*r*11.4%
*-commutative11.4%
cancel-sign-sub-inv11.4%
unpow211.4%
metadata-eval11.4%
*-commutative11.4%
Simplified11.4%
Final simplification15.3%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -5.5e+14)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B 2.6e-71)
(- (/ (sqrt (* (* A -16.0) (* F (* C C)))) t_0))
(/ (- (sqrt (* B (* 2.0 (* F t_0))))) t_0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -5.5e+14) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= 2.6e-71) {
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / t_0);
} else {
tmp = -sqrt((B * (2.0 * (F * t_0)))) / t_0;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= (-5.5d+14)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= 2.6d-71) then
tmp = -(sqrt(((a * (-16.0d0)) * (f * (c * c)))) / t_0)
else
tmp = -sqrt((b * (2.0d0 * (f * t_0)))) / t_0
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -5.5e+14) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= 2.6e-71) {
tmp = -(Math.sqrt(((A * -16.0) * (F * (C * C)))) / t_0);
} else {
tmp = -Math.sqrt((B * (2.0 * (F * t_0)))) / t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -5.5e+14: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= 2.6e-71: tmp = -(math.sqrt(((A * -16.0) * (F * (C * C)))) / t_0) else: tmp = -math.sqrt((B * (2.0 * (F * t_0)))) / t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -5.5e+14) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= 2.6e-71) tmp = Float64(-Float64(sqrt(Float64(Float64(A * -16.0) * Float64(F * Float64(C * C)))) / t_0)); else tmp = Float64(Float64(-sqrt(Float64(B * Float64(2.0 * Float64(F * t_0))))) / t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -5.5e+14)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= 2.6e-71)
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / t_0);
else
tmp = -sqrt((B * (2.0 * (F * t_0)))) / t_0;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5.5e+14], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 2.6e-71], (-N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[((-N[Sqrt[N[(B * N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -5.5 \cdot 10^{+14}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 2.6 \cdot 10^{-71}:\\
\;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{B \cdot \left(2 \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -5.5e14Initial program 18.0%
associate-*l*18.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
associate-*l*18.0%
unpow218.0%
Simplified18.0%
Taylor expanded in A around -inf 2.8%
Taylor expanded in B around -inf 6.5%
*-commutative6.5%
Simplified6.5%
if -5.5e14 < B < 2.5999999999999999e-71Initial program 23.6%
associate-*l*23.5%
unpow223.5%
+-commutative23.5%
unpow223.5%
associate-*l*23.5%
unpow223.5%
Simplified23.5%
Taylor expanded in A around -inf 16.5%
Taylor expanded in B around 0 10.9%
associate-*r*10.9%
*-commutative10.9%
unpow210.9%
Simplified10.9%
if 2.5999999999999999e-71 < B Initial program 11.8%
associate-*l*11.8%
unpow211.8%
+-commutative11.8%
unpow211.8%
associate-*l*11.8%
unpow211.8%
Simplified11.8%
unpow211.8%
hypot-udef15.5%
*-un-lft-identity15.5%
Applied egg-rr15.5%
*-lft-identity15.5%
Simplified15.5%
Taylor expanded in B around inf 11.1%
Final simplification9.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 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)))
(if (<= B -4e+131)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(if (<= B -1.7e-40)
(/ (- (sqrt (* B (* 2.0 (* F (- t_0 (* B B))))))) t_1)
(- (/ (sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C)))))) t_1))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -4e+131) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-40) {
tmp = -sqrt((B * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
if (b <= (-4d+131)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else if (b <= (-1.7d-40)) then
tmp = -sqrt((b * (2.0d0 * (f * (t_0 - (b * b)))))) / t_1
else
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / t_1)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= -4e+131) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else if (B <= -1.7e-40) {
tmp = -Math.sqrt((B * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
} else {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 tmp = 0 if B <= -4e+131: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) elif B <= -1.7e-40: tmp = -math.sqrt((B * (2.0 * (F * (t_0 - (B * B)))))) / t_1 else: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (B <= -4e+131) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); elseif (B <= -1.7e-40) tmp = Float64(Float64(-sqrt(Float64(B * Float64(2.0 * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); else tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / t_1)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
tmp = 0.0;
if (B <= -4e+131)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
elseif (B <= -1.7e-40)
tmp = -sqrt((B * (2.0 * (F * (t_0 - (B * B)))))) / t_1;
else
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / t_1);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[B, -4e+131], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.7e-40], N[((-N[Sqrt[N[(B * N[(2.0 * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;B \leq -4 \cdot 10^{+131}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.7 \cdot 10^{-40}:\\
\;\;\;\;\frac{-\sqrt{B \cdot \left(2 \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -3.9999999999999996e131Initial program 2.4%
associate-*l*2.4%
unpow22.4%
+-commutative2.4%
unpow22.4%
associate-*l*2.4%
unpow22.4%
Simplified2.4%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 8.6%
*-commutative8.6%
Simplified8.6%
if -3.9999999999999996e131 < B < -1.69999999999999992e-40Initial program 38.9%
associate-*l*38.9%
unpow238.9%
+-commutative38.9%
unpow238.9%
associate-*l*38.9%
unpow238.9%
Simplified38.9%
unpow238.9%
hypot-udef44.1%
*-un-lft-identity44.1%
Applied egg-rr44.1%
*-lft-identity44.1%
Simplified44.1%
Taylor expanded in B around -inf 38.4%
mul-1-neg38.4%
Simplified38.4%
if -1.69999999999999992e-40 < B Initial program 17.6%
associate-*l*17.5%
unpow217.5%
+-commutative17.5%
unpow217.5%
associate-*l*17.5%
unpow217.5%
Simplified17.5%
Taylor expanded in A around -inf 11.4%
Taylor expanded in F around 0 11.4%
associate-*r*11.4%
*-commutative11.4%
cancel-sign-sub-inv11.4%
unpow211.4%
metadata-eval11.4%
*-commutative11.4%
Simplified11.4%
Final simplification15.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -6e+72)
(* 2.0 (* (sqrt (* C F)) (/ 1.0 B)))
(-
(/
(sqrt (* (* 4.0 C) (* F (+ (* B B) (* -4.0 (* A C))))))
(- (* B B) (* 4.0 (* A C)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -6e+72) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else {
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / ((B * B) - (4.0 * (A * C))));
}
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 <= (-6d+72)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else
tmp = -(sqrt(((4.0d0 * c) * (f * ((b * b) + ((-4.0d0) * (a * c)))))) / ((b * b) - (4.0d0 * (a * c))))
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 <= -6e+72) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else {
tmp = -(Math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / ((B * B) - (4.0 * (A * C))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -6e+72: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) else: tmp = -(math.sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / ((B * B) - (4.0 * (A * C)))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -6e+72) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); else tmp = Float64(-Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -6e+72)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
else
tmp = -(sqrt(((4.0 * C) * (F * ((B * B) + (-4.0 * (A * C)))))) / ((B * B) - (4.0 * (A * 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_] := If[LessEqual[B, -6e+72], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6 \cdot 10^{+72}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\end{array}
\end{array}
if B < -6.00000000000000006e72Initial program 12.8%
associate-*l*12.8%
unpow212.8%
+-commutative12.8%
unpow212.8%
associate-*l*12.8%
unpow212.8%
Simplified12.8%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around -inf 7.5%
*-commutative7.5%
Simplified7.5%
if -6.00000000000000006e72 < B Initial program 19.8%
associate-*l*19.8%
unpow219.8%
+-commutative19.8%
unpow219.8%
associate-*l*19.8%
unpow219.8%
Simplified19.8%
Taylor expanded in A around -inf 10.2%
Taylor expanded in F around 0 10.2%
associate-*r*10.2%
*-commutative10.2%
cancel-sign-sub-inv10.2%
unpow210.2%
metadata-eval10.2%
*-commutative10.2%
Simplified10.2%
Final simplification9.6%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -1.4e+17) (* 2.0 (* (sqrt (* C F)) (/ 1.0 B))) (- (/ (sqrt (* (* A -16.0) (* F (* C C)))) (- (* B B) (* 4.0 (* A C)))))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -1.4e+17) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else {
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C))));
}
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.4d+17)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else
tmp = -(sqrt(((a * (-16.0d0)) * (f * (c * c)))) / ((b * b) - (4.0d0 * (a * c))))
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.4e+17) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else {
tmp = -(Math.sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -1.4e+17: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) else: tmp = -(math.sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * C)))) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -1.4e+17) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); else tmp = Float64(-Float64(sqrt(Float64(Float64(A * -16.0) * Float64(F * Float64(C * C)))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -1.4e+17)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
else
tmp = -(sqrt(((A * -16.0) * (F * (C * C)))) / ((B * B) - (4.0 * (A * 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_] := If[LessEqual[B, -1.4e+17], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(N[(A * -16.0), $MachinePrecision] * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -1.4 \cdot 10^{+17}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(A \cdot -16\right) \cdot \left(F \cdot \left(C \cdot C\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\end{array}
\end{array}
if B < -1.4e17Initial program 18.0%
associate-*l*18.0%
unpow218.0%
+-commutative18.0%
unpow218.0%
associate-*l*18.0%
unpow218.0%
Simplified18.0%
Taylor expanded in A around -inf 2.8%
Taylor expanded in B around -inf 6.5%
*-commutative6.5%
Simplified6.5%
if -1.4e17 < B Initial program 18.3%
associate-*l*18.3%
unpow218.3%
+-commutative18.3%
unpow218.3%
associate-*l*18.3%
unpow218.3%
Simplified18.3%
Taylor expanded in A around -inf 10.7%
Taylor expanded in B around 0 7.6%
associate-*r*7.6%
*-commutative7.6%
unpow27.6%
Simplified7.6%
Final simplification7.3%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -2e-310) (* 2.0 (* (sqrt (* C F)) (/ 1.0 B))) (* -2.0 (* (/ 1.0 B) (pow (* C F) 0.5)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
} else {
tmp = -2.0 * ((1.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 <= (-2d-310)) then
tmp = 2.0d0 * (sqrt((c * f)) * (1.0d0 / b))
else
tmp = (-2.0d0) * ((1.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 <= -2e-310) {
tmp = 2.0 * (Math.sqrt((C * F)) * (1.0 / B));
} else {
tmp = -2.0 * ((1.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 <= -2e-310: tmp = 2.0 * (math.sqrt((C * F)) * (1.0 / B)) else: tmp = -2.0 * ((1.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 <= -2e-310) tmp = Float64(2.0 * Float64(sqrt(Float64(C * F)) * Float64(1.0 / B))); else tmp = Float64(-2.0 * Float64(Float64(1.0 / B) * (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 <= -2e-310)
tmp = 2.0 * (sqrt((C * F)) * (1.0 / B));
else
tmp = -2.0 * ((1.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, -2e-310], N[(2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(1.0 / B), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \left(\sqrt{C \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\frac{1}{B} \cdot {\left(C \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if B < -1.999999999999994e-310Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 7.9%
Taylor expanded in B around -inf 5.1%
*-commutative5.1%
Simplified5.1%
if -1.999999999999994e-310 < B Initial program 13.2%
associate-*l*13.2%
unpow213.2%
+-commutative13.2%
unpow213.2%
associate-*l*13.2%
unpow213.2%
Simplified13.2%
Taylor expanded in A around -inf 9.3%
Taylor expanded in B around inf 2.6%
*-commutative2.6%
Simplified2.6%
pow1/22.8%
Applied egg-rr2.8%
Final simplification4.0%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (let* ((t_0 (sqrt (* C F)))) (if (<= B -2e-310) (* 2.0 (* t_0 (/ 1.0 B))) (* -2.0 (/ t_0 B)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-2d-310)) then
tmp = 2.0d0 * (t_0 * (1.0d0 / b))
else
tmp = (-2.0d0) * (t_0 / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -2e-310) {
tmp = 2.0 * (t_0 * (1.0 / B));
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -2e-310: tmp = 2.0 * (t_0 * (1.0 / B)) else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -2e-310) tmp = Float64(2.0 * Float64(t_0 * Float64(1.0 / B))); else tmp = Float64(-2.0 * Float64(t_0 / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -2e-310)
tmp = 2.0 * (t_0 * (1.0 / B));
else
tmp = -2.0 * (t_0 / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -2e-310], N[(2.0 * N[(t$95$0 * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -2 \cdot 10^{-310}:\\
\;\;\;\;2 \cdot \left(t_0 \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -1.999999999999994e-310Initial program 23.2%
associate-*l*23.2%
unpow223.2%
+-commutative23.2%
unpow223.2%
associate-*l*23.2%
unpow223.2%
Simplified23.2%
Taylor expanded in A around -inf 7.9%
Taylor expanded in B around -inf 5.1%
*-commutative5.1%
Simplified5.1%
if -1.999999999999994e-310 < B Initial program 13.2%
associate-*l*13.2%
unpow213.2%
+-commutative13.2%
unpow213.2%
associate-*l*13.2%
unpow213.2%
Simplified13.2%
Taylor expanded in A around -inf 9.3%
Taylor expanded in B around inf 2.6%
*-commutative2.6%
Simplified2.6%
Taylor expanded in B around 0 2.6%
associate-*r/2.6%
*-commutative2.6%
*-rgt-identity2.6%
Simplified2.6%
Final simplification3.9%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* C F)) B)))
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((C * F)) / B);
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (sqrt((c * f)) / b)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((C * F)) / B);
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.sqrt((C * F)) / B)
A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B)) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (sqrt((C * F)) / B);
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{\sqrt{C \cdot F}}{B}
\end{array}
Initial program 18.2%
associate-*l*18.2%
unpow218.2%
+-commutative18.2%
unpow218.2%
associate-*l*18.2%
unpow218.2%
Simplified18.2%
Taylor expanded in A around -inf 8.6%
Taylor expanded in B around inf 2.1%
*-commutative2.1%
Simplified2.1%
Taylor expanded in B around 0 2.1%
associate-*r/2.1%
*-commutative2.1%
*-rgt-identity2.1%
Simplified2.1%
Final simplification2.1%
herbie shell --seed 2023181
(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))))