
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 22 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (- (pow B 2.0) (* (* 4.0 A) C)))
(t_2
(-
(/
(sqrt
(*
(* 2.0 (* t_1 F))
(+ (+ A C) (sqrt (+ (pow B 2.0) (pow (- A C) 2.0))))))
t_1)))
(t_3 (sqrt (* 2.0 (* F t_0)))))
(if (<= t_2 -2e-198)
(/ (* t_3 (- (sqrt (+ C (+ A (hypot B (- A C))))))) t_0)
(if (<= t_2 INFINITY)
(/ (* (sqrt (+ C (+ C (* -0.5 (/ (* B B) A))))) (- t_3)) t_0)
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = pow(B, 2.0) - ((4.0 * A) * C);
double t_2 = -(sqrt(((2.0 * (t_1 * F)) * ((A + C) + sqrt((pow(B, 2.0) + pow((A - C), 2.0)))))) / t_1);
double t_3 = sqrt((2.0 * (F * t_0)));
double tmp;
if (t_2 <= -2e-198) {
tmp = (t_3 * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
} else if (t_2 <= ((double) INFINITY)) {
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -t_3) / t_0;
} else {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = Math.pow(B, 2.0) - ((4.0 * A) * C);
double t_2 = -(Math.sqrt(((2.0 * (t_1 * F)) * ((A + C) + Math.sqrt((Math.pow(B, 2.0) + Math.pow((A - C), 2.0)))))) / t_1);
double t_3 = Math.sqrt((2.0 * (F * t_0)));
double tmp;
if (t_2 <= -2e-198) {
tmp = (t_3 * -Math.sqrt((C + (A + Math.hypot(B, (A - C)))))) / t_0;
} else if (t_2 <= Double.POSITIVE_INFINITY) {
tmp = (Math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -t_3) / t_0;
} else {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = math.pow(B, 2.0) - ((4.0 * A) * C) t_2 = -(math.sqrt(((2.0 * (t_1 * F)) * ((A + C) + math.sqrt((math.pow(B, 2.0) + math.pow((A - C), 2.0)))))) / t_1) t_3 = math.sqrt((2.0 * (F * t_0))) tmp = 0 if t_2 <= -2e-198: tmp = (t_3 * -math.sqrt((C + (A + math.hypot(B, (A - C)))))) / t_0 elif t_2 <= math.inf: tmp = (math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -t_3) / t_0 else: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = Float64(-Float64(sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(Float64(A + C) + sqrt(Float64((B ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_1)) t_3 = sqrt(Float64(2.0 * Float64(F * t_0))) tmp = 0.0 if (t_2 <= -2e-198) tmp = Float64(Float64(t_3 * Float64(-sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))) / t_0); elseif (t_2 <= Inf) tmp = Float64(Float64(sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))) * Float64(-t_3)) / t_0); else tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = (B ^ 2.0) - ((4.0 * A) * C);
t_2 = -(sqrt(((2.0 * (t_1 * F)) * ((A + C) + sqrt(((B ^ 2.0) + ((A - C) ^ 2.0)))))) / t_1);
t_3 = sqrt((2.0 * (F * t_0)));
tmp = 0.0;
if (t_2 <= -2e-198)
tmp = (t_3 * -sqrt((C + (A + hypot(B, (A - C)))))) / t_0;
elseif (t_2 <= Inf)
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -t_3) / t_0;
else
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[Sqrt[N[(N[(2.0 * N[(t$95$1 * 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$1), $MachinePrecision])}, Block[{t$95$3 = N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$2, -2e-198], N[(N[(t$95$3 * (-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[t$95$2, Infinity], N[(N[(N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-t$95$3)), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := -\frac{\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B}^{2} + {\left(A - C\right)}^{2}}\right)}}{t_1}\\
t_3 := \sqrt{2 \cdot \left(F \cdot t_0\right)}\\
\mathbf{if}\;t_2 \leq -2 \cdot 10^{-198}:\\
\;\;\;\;\frac{t_3 \cdot \left(-\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\right)}{t_0}\\
\mathbf{elif}\;t_2 \leq \infty:\\
\;\;\;\;\frac{\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)} \cdot \left(-t_3\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\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))) < -1.9999999999999998e-198Initial program 47.0%
associate-*l*47.0%
unpow247.0%
+-commutative47.0%
unpow247.0%
associate-*l*47.0%
unpow247.0%
Simplified47.0%
sqrt-prod52.2%
*-commutative52.2%
*-commutative52.2%
associate-+l+52.2%
unpow252.2%
hypot-udef68.0%
associate-+r+67.5%
+-commutative67.5%
associate-+r+68.0%
Applied egg-rr68.0%
if -1.9999999999999998e-198 < (/.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 17.4%
associate-*l*17.4%
unpow217.4%
+-commutative17.4%
unpow217.4%
associate-*l*17.4%
unpow217.4%
Simplified17.4%
sqrt-prod22.0%
*-commutative22.0%
*-commutative22.0%
associate-+l+22.9%
unpow222.9%
hypot-udef26.3%
associate-+r+25.4%
+-commutative25.4%
associate-+r+26.6%
Applied egg-rr26.6%
Taylor expanded in A around -inf 18.6%
unpow218.6%
Simplified18.6%
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.9%
Taylor expanded in A around 0 2.1%
mul-1-neg2.1%
*-commutative2.1%
distribute-rgt-neg-in2.1%
*-commutative2.1%
unpow22.1%
unpow22.1%
hypot-def23.4%
Simplified23.4%
Final simplification38.8%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (/ -1.0 t_0))
(t_2 (* F t_0))
(t_3
(/
(* (sqrt (+ C (+ C (* -0.5 (/ (* B B) A))))) (- (sqrt (* 2.0 t_2))))
t_0)))
(if (<= B -3.9e+34)
(* (sqrt (* 2.0 (* t_2 (+ C (+ A (hypot B (- A C))))))) t_1)
(if (<= B -1.7e-27)
t_3
(if (<= B -5.8e-156)
(* (sqrt (* 2.0 (* t_2 (* 2.0 C)))) t_1)
(if (<= B 8.5e-17)
t_3
(* (sqrt (* F (+ C (hypot B C)))) (/ (- (sqrt 2.0)) B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt((2.0 * t_2))) / t_0;
double tmp;
if (B <= -3.9e+34) {
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
} else if (B <= -1.7e-27) {
tmp = t_3;
} else if (B <= -5.8e-156) {
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else if (B <= 8.5e-17) {
tmp = t_3;
} else {
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = (Math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -Math.sqrt((2.0 * t_2))) / t_0;
double tmp;
if (B <= -3.9e+34) {
tmp = Math.sqrt((2.0 * (t_2 * (C + (A + Math.hypot(B, (A - C))))))) * t_1;
} else if (B <= -1.7e-27) {
tmp = t_3;
} else if (B <= -5.8e-156) {
tmp = Math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else if (B <= 8.5e-17) {
tmp = t_3;
} else {
tmp = Math.sqrt((F * (C + Math.hypot(B, C)))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -1.0 / t_0 t_2 = F * t_0 t_3 = (math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -math.sqrt((2.0 * t_2))) / t_0 tmp = 0 if B <= -3.9e+34: tmp = math.sqrt((2.0 * (t_2 * (C + (A + math.hypot(B, (A - C))))))) * t_1 elif B <= -1.7e-27: tmp = t_3 elif B <= -5.8e-156: tmp = math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1 elif B <= 8.5e-17: tmp = t_3 else: tmp = math.sqrt((F * (C + math.hypot(B, C)))) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(-1.0 / t_0) t_2 = Float64(F * t_0) t_3 = Float64(Float64(sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))) * Float64(-sqrt(Float64(2.0 * t_2)))) / t_0) tmp = 0.0 if (B <= -3.9e+34) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(C + Float64(A + hypot(B, Float64(A - C))))))) * t_1); elseif (B <= -1.7e-27) tmp = t_3; elseif (B <= -5.8e-156) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * C)))) * t_1); elseif (B <= 8.5e-17) tmp = t_3; else tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B, C)))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = -1.0 / t_0;
t_2 = F * t_0;
t_3 = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt((2.0 * t_2))) / t_0;
tmp = 0.0;
if (B <= -3.9e+34)
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
elseif (B <= -1.7e-27)
tmp = t_3;
elseif (B <= -5.8e-156)
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
elseif (B <= 8.5e-17)
tmp = t_3;
else
tmp = sqrt((F * (C + hypot(B, C)))) * (-sqrt(2.0) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-1.0 / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[B, -3.9e+34], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, -1.7e-27], t$95$3, If[LessEqual[B, -5.8e-156], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, 8.5e-17], t$95$3, N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-1}{t_0}\\
t_2 := F \cdot t_0\\
t_3 := \frac{\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)} \cdot \left(-\sqrt{2 \cdot t_2}\right)}{t_0}\\
\mathbf{if}\;B \leq -3.9 \cdot 10^{+34}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)} \cdot t_1\\
\mathbf{elif}\;B \leq -1.7 \cdot 10^{-27}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B \leq -5.8 \cdot 10^{-156}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot C\right)\right)} \cdot t_1\\
\mathbf{elif}\;B \leq 8.5 \cdot 10^{-17}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B, C\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -3.90000000000000019e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
div-inv26.0%
Applied egg-rr26.1%
if -3.90000000000000019e34 < B < -1.69999999999999985e-27 or -5.80000000000000041e-156 < B < 8.5e-17Initial program 17.7%
associate-*l*17.7%
unpow217.7%
+-commutative17.7%
unpow217.7%
associate-*l*17.7%
unpow217.7%
Simplified17.7%
sqrt-prod22.9%
*-commutative22.9%
*-commutative22.9%
associate-+l+23.2%
unpow223.2%
hypot-udef33.3%
associate-+r+32.5%
+-commutative32.5%
associate-+r+33.3%
Applied egg-rr33.3%
Taylor expanded in A around -inf 23.4%
unpow223.4%
Simplified23.4%
if -1.69999999999999985e-27 < B < -5.80000000000000041e-156Initial program 20.2%
associate-*l*20.2%
unpow220.2%
+-commutative20.2%
unpow220.2%
associate-*l*20.2%
unpow220.2%
Simplified20.2%
Taylor expanded in A around -inf 20.7%
div-inv20.7%
associate-*l*20.7%
*-commutative20.7%
*-commutative20.7%
*-commutative20.7%
Applied egg-rr20.7%
if 8.5e-17 < B Initial program 22.4%
Simplified23.9%
Taylor expanded in A around 0 31.8%
mul-1-neg31.8%
*-commutative31.8%
distribute-rgt-neg-in31.8%
*-commutative31.8%
unpow231.8%
unpow231.8%
hypot-def62.8%
Simplified62.8%
Final simplification34.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 (/ -1.0 t_0))
(t_2 (* F t_0))
(t_3 (* 2.0 t_2)))
(if (<= B -4.2e+34)
(* (sqrt (* 2.0 (* t_2 (+ C (+ A (hypot B (- A C))))))) t_1)
(if (<= B -2.4e-22)
(/ (* (sqrt (+ C (+ C (* -0.5 (/ (* B B) A))))) (- (sqrt t_3))) t_0)
(if (<= B -7.5e-77)
(- (/ (sqrt (* (+ C (hypot B C)) t_3)) t_0))
(if (<= B 9.5e+17)
(* (sqrt (* 2.0 (* t_2 (* 2.0 C)))) t_1)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ A (hypot B A))))))))))))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 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = 2.0 * t_2;
double tmp;
if (B <= -4.2e+34) {
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
} else if (B <= -2.4e-22) {
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt(t_3)) / t_0;
} else if (B <= -7.5e-77) {
tmp = -(sqrt(((C + hypot(B, C)) * t_3)) / t_0);
} else if (B <= 9.5e+17) {
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A))));
}
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 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = 2.0 * t_2;
double tmp;
if (B <= -4.2e+34) {
tmp = Math.sqrt((2.0 * (t_2 * (C + (A + Math.hypot(B, (A - C))))))) * t_1;
} else if (B <= -2.4e-22) {
tmp = (Math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -Math.sqrt(t_3)) / t_0;
} else if (B <= -7.5e-77) {
tmp = -(Math.sqrt(((C + Math.hypot(B, C)) * t_3)) / t_0);
} else if (B <= 9.5e+17) {
tmp = Math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A + Math.hypot(B, A))));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -1.0 / t_0 t_2 = F * t_0 t_3 = 2.0 * t_2 tmp = 0 if B <= -4.2e+34: tmp = math.sqrt((2.0 * (t_2 * (C + (A + math.hypot(B, (A - C))))))) * t_1 elif B <= -2.4e-22: tmp = (math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -math.sqrt(t_3)) / t_0 elif B <= -7.5e-77: tmp = -(math.sqrt(((C + math.hypot(B, C)) * t_3)) / t_0) elif B <= 9.5e+17: tmp = math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A + math.hypot(B, A)))) 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(-1.0 / t_0) t_2 = Float64(F * t_0) t_3 = Float64(2.0 * t_2) tmp = 0.0 if (B <= -4.2e+34) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(C + Float64(A + hypot(B, Float64(A - C))))))) * t_1); elseif (B <= -2.4e-22) tmp = Float64(Float64(sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))) * Float64(-sqrt(t_3))) / t_0); elseif (B <= -7.5e-77) tmp = Float64(-Float64(sqrt(Float64(Float64(C + hypot(B, C)) * t_3)) / t_0)); elseif (B <= 9.5e+17) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * C)))) * t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A + hypot(B, A)))))); 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 = -1.0 / t_0;
t_2 = F * t_0;
t_3 = 2.0 * t_2;
tmp = 0.0;
if (B <= -4.2e+34)
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
elseif (B <= -2.4e-22)
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt(t_3)) / t_0;
elseif (B <= -7.5e-77)
tmp = -(sqrt(((C + hypot(B, C)) * t_3)) / t_0);
elseif (B <= 9.5e+17)
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A + hypot(B, A))));
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[(-1.0 / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * t$95$2), $MachinePrecision]}, If[LessEqual[B, -4.2e+34], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, -2.4e-22], N[(N[(N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$3], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -7.5e-77], (-N[(N[Sqrt[N[(N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 9.5e+17], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A + N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-1}{t_0}\\
t_2 := F \cdot t_0\\
t_3 := 2 \cdot t_2\\
\mathbf{if}\;B \leq -4.2 \cdot 10^{+34}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)} \cdot t_1\\
\mathbf{elif}\;B \leq -2.4 \cdot 10^{-22}:\\
\;\;\;\;\frac{\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)} \cdot \left(-\sqrt{t_3}\right)}{t_0}\\
\mathbf{elif}\;B \leq -7.5 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\sqrt{\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot t_3}}{t_0}\\
\mathbf{elif}\;B \leq 9.5 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot C\right)\right)} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B, A\right)\right)}\right)\\
\end{array}
\end{array}
if B < -4.20000000000000035e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
div-inv26.0%
Applied egg-rr26.1%
if -4.20000000000000035e34 < B < -2.40000000000000002e-22Initial program 11.9%
associate-*l*11.9%
unpow211.9%
+-commutative11.9%
unpow211.9%
associate-*l*11.9%
unpow211.9%
Simplified11.9%
sqrt-prod20.5%
*-commutative20.5%
*-commutative20.5%
associate-+l+20.2%
unpow220.2%
hypot-udef48.3%
associate-+r+47.2%
+-commutative47.2%
associate-+r+46.4%
Applied egg-rr46.4%
Taylor expanded in A around -inf 36.7%
unpow236.7%
Simplified36.7%
if -2.40000000000000002e-22 < B < -7.5000000000000006e-77Initial program 28.5%
associate-*l*28.5%
unpow228.5%
+-commutative28.5%
unpow228.5%
associate-*l*28.5%
unpow228.5%
Simplified28.5%
Taylor expanded in A around 0 35.2%
unpow235.2%
unpow235.2%
hypot-def42.1%
Simplified42.1%
if -7.5000000000000006e-77 < B < 9.5e17Initial program 18.4%
associate-*l*18.4%
unpow218.4%
+-commutative18.4%
unpow218.4%
associate-*l*18.4%
unpow218.4%
Simplified18.4%
Taylor expanded in A around -inf 18.2%
div-inv18.2%
associate-*l*18.2%
*-commutative18.2%
*-commutative18.2%
*-commutative18.2%
Applied egg-rr18.2%
if 9.5e17 < B Initial program 21.0%
Simplified22.5%
Taylor expanded in C around 0 31.2%
mul-1-neg31.2%
*-commutative31.2%
distribute-rgt-neg-in31.2%
unpow231.2%
unpow231.2%
hypot-def65.4%
Simplified65.4%
Final simplification33.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (/ -1.0 t_0))
(t_2 (* F t_0))
(t_3 (* 2.0 t_2)))
(if (<= B -6.6e+34)
(* (sqrt (* 2.0 (* t_2 (+ C (+ A (hypot B (- A C))))))) t_1)
(if (<= B -5.8e-22)
(/ (* (sqrt (+ C (+ C (* -0.5 (/ (* B B) A))))) (- (sqrt t_3))) t_0)
(if (<= B -6.8e-77)
(- (/ (sqrt (* (+ C (hypot B C)) t_3)) t_0))
(if (<= B 2.3e+18)
(* (sqrt (* 2.0 (* t_2 (* 2.0 C)))) t_1)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))))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 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = 2.0 * t_2;
double tmp;
if (B <= -6.6e+34) {
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
} else if (B <= -5.8e-22) {
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt(t_3)) / t_0;
} else if (B <= -6.8e-77) {
tmp = -(sqrt(((C + hypot(B, C)) * t_3)) / t_0);
} else if (B <= 2.3e+18) {
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
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 = -1.0 / t_0;
double t_2 = F * t_0;
double t_3 = 2.0 * t_2;
double tmp;
if (B <= -6.6e+34) {
tmp = Math.sqrt((2.0 * (t_2 * (C + (A + Math.hypot(B, (A - C))))))) * t_1;
} else if (B <= -5.8e-22) {
tmp = (Math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -Math.sqrt(t_3)) / t_0;
} else if (B <= -6.8e-77) {
tmp = -(Math.sqrt(((C + Math.hypot(B, C)) * t_3)) / t_0);
} else if (B <= 2.3e+18) {
tmp = Math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = -1.0 / t_0 t_2 = F * t_0 t_3 = 2.0 * t_2 tmp = 0 if B <= -6.6e+34: tmp = math.sqrt((2.0 * (t_2 * (C + (A + math.hypot(B, (A - C))))))) * t_1 elif B <= -5.8e-22: tmp = (math.sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -math.sqrt(t_3)) / t_0 elif B <= -6.8e-77: tmp = -(math.sqrt(((C + math.hypot(B, C)) * t_3)) / t_0) elif B <= 2.3e+18: tmp = math.sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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(-1.0 / t_0) t_2 = Float64(F * t_0) t_3 = Float64(2.0 * t_2) tmp = 0.0 if (B <= -6.6e+34) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(C + Float64(A + hypot(B, Float64(A - C))))))) * t_1); elseif (B <= -5.8e-22) tmp = Float64(Float64(sqrt(Float64(C + Float64(C + Float64(-0.5 * Float64(Float64(B * B) / A))))) * Float64(-sqrt(t_3))) / t_0); elseif (B <= -6.8e-77) tmp = Float64(-Float64(sqrt(Float64(Float64(C + hypot(B, C)) * t_3)) / t_0)); elseif (B <= 2.3e+18) tmp = Float64(sqrt(Float64(2.0 * Float64(t_2 * Float64(2.0 * C)))) * t_1); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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 = -1.0 / t_0;
t_2 = F * t_0;
t_3 = 2.0 * t_2;
tmp = 0.0;
if (B <= -6.6e+34)
tmp = sqrt((2.0 * (t_2 * (C + (A + hypot(B, (A - C))))))) * t_1;
elseif (B <= -5.8e-22)
tmp = (sqrt((C + (C + (-0.5 * ((B * B) / A))))) * -sqrt(t_3)) / t_0;
elseif (B <= -6.8e-77)
tmp = -(sqrt(((C + hypot(B, C)) * t_3)) / t_0);
elseif (B <= 2.3e+18)
tmp = sqrt((2.0 * (t_2 * (2.0 * C)))) * t_1;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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[(-1.0 / t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * t$95$2), $MachinePrecision]}, If[LessEqual[B, -6.6e+34], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[B, -5.8e-22], N[(N[(N[Sqrt[N[(C + N[(C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[t$95$3], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[B, -6.8e-77], (-N[(N[Sqrt[N[(N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 2.3e+18], N[(N[Sqrt[N[(2.0 * N[(t$95$2 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-1}{t_0}\\
t_2 := F \cdot t_0\\
t_3 := 2 \cdot t_2\\
\mathbf{if}\;B \leq -6.6 \cdot 10^{+34}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)} \cdot t_1\\
\mathbf{elif}\;B \leq -5.8 \cdot 10^{-22}:\\
\;\;\;\;\frac{\sqrt{C + \left(C + -0.5 \cdot \frac{B \cdot B}{A}\right)} \cdot \left(-\sqrt{t_3}\right)}{t_0}\\
\mathbf{elif}\;B \leq -6.8 \cdot 10^{-77}:\\
\;\;\;\;-\frac{\sqrt{\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot t_3}}{t_0}\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{+18}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_2 \cdot \left(2 \cdot C\right)\right)} \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -6.59999999999999976e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
div-inv26.0%
Applied egg-rr26.1%
if -6.59999999999999976e34 < B < -5.8000000000000003e-22Initial program 11.9%
associate-*l*11.9%
unpow211.9%
+-commutative11.9%
unpow211.9%
associate-*l*11.9%
unpow211.9%
Simplified11.9%
sqrt-prod20.5%
*-commutative20.5%
*-commutative20.5%
associate-+l+20.2%
unpow220.2%
hypot-udef48.3%
associate-+r+47.2%
+-commutative47.2%
associate-+r+46.4%
Applied egg-rr46.4%
Taylor expanded in A around -inf 36.7%
unpow236.7%
Simplified36.7%
if -5.8000000000000003e-22 < B < -6.79999999999999966e-77Initial program 28.5%
associate-*l*28.5%
unpow228.5%
+-commutative28.5%
unpow228.5%
associate-*l*28.5%
unpow228.5%
Simplified28.5%
Taylor expanded in A around 0 35.2%
unpow235.2%
unpow235.2%
hypot-def42.1%
Simplified42.1%
if -6.79999999999999966e-77 < B < 2.3e18Initial program 18.4%
associate-*l*18.4%
unpow218.4%
+-commutative18.4%
unpow218.4%
associate-*l*18.4%
unpow218.4%
Simplified18.4%
Taylor expanded in A around -inf 18.2%
div-inv18.2%
associate-*l*18.2%
*-commutative18.2%
*-commutative18.2%
*-commutative18.2%
Applied egg-rr18.2%
if 2.3e18 < B Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in B around inf 21.2%
associate-+r+21.2%
Simplified21.2%
Taylor expanded in C around 0 63.7%
mul-1-neg63.7%
Simplified63.7%
Final simplification33.5%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C))))
(t_1 (* F t_0))
(t_2 (/ (- (sqrt (* 2.0 (* (+ C (hypot C B)) (* F (* B B)))))) t_0))
(t_3 (/ (* (sqrt (* 2.0 t_1)) (- (sqrt (+ C C)))) t_0)))
(if (<= B -2.8e+28)
t_2
(if (<= B -2.5e-17)
t_3
(if (<= B -6.2e-28)
t_2
(if (<= B -7.5e-157)
(* (sqrt (* 2.0 (* t_1 (* 2.0 C)))) (/ -1.0 t_0))
(if (<= B 1.65e-21)
t_3
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A))))))))))))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 t_2 = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
double t_3 = (sqrt((2.0 * t_1)) * -sqrt((C + C))) / t_0;
double tmp;
if (B <= -2.8e+28) {
tmp = t_2;
} else if (B <= -2.5e-17) {
tmp = t_3;
} else if (B <= -6.2e-28) {
tmp = t_2;
} else if (B <= -7.5e-157) {
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else if (B <= 1.65e-21) {
tmp = t_3;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
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 t_2 = -Math.sqrt((2.0 * ((C + Math.hypot(C, B)) * (F * (B * B))))) / t_0;
double t_3 = (Math.sqrt((2.0 * t_1)) * -Math.sqrt((C + C))) / t_0;
double tmp;
if (B <= -2.8e+28) {
tmp = t_2;
} else if (B <= -2.5e-17) {
tmp = t_3;
} else if (B <= -6.2e-28) {
tmp = t_2;
} else if (B <= -7.5e-157) {
tmp = Math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else if (B <= 1.65e-21) {
tmp = t_3;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
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 t_2 = -math.sqrt((2.0 * ((C + math.hypot(C, B)) * (F * (B * B))))) / t_0 t_3 = (math.sqrt((2.0 * t_1)) * -math.sqrt((C + C))) / t_0 tmp = 0 if B <= -2.8e+28: tmp = t_2 elif B <= -2.5e-17: tmp = t_3 elif B <= -6.2e-28: tmp = t_2 elif B <= -7.5e-157: tmp = math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0) elif B <= 1.65e-21: tmp = t_3 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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) t_2 = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + hypot(C, B)) * Float64(F * Float64(B * B)))))) / t_0) t_3 = Float64(Float64(sqrt(Float64(2.0 * t_1)) * Float64(-sqrt(Float64(C + C)))) / t_0) tmp = 0.0 if (B <= -2.8e+28) tmp = t_2; elseif (B <= -2.5e-17) tmp = t_3; elseif (B <= -6.2e-28) tmp = t_2; elseif (B <= -7.5e-157) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); elseif (B <= 1.65e-21) tmp = t_3; else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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;
t_2 = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
t_3 = (sqrt((2.0 * t_1)) * -sqrt((C + C))) / t_0;
tmp = 0.0;
if (B <= -2.8e+28)
tmp = t_2;
elseif (B <= -2.5e-17)
tmp = t_3;
elseif (B <= -6.2e-28)
tmp = t_2;
elseif (B <= -7.5e-157)
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
elseif (B <= 1.65e-21)
tmp = t_3;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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]}, Block[{t$95$2 = N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]}, If[LessEqual[B, -2.8e+28], t$95$2, If[LessEqual[B, -2.5e-17], t$95$3, If[LessEqual[B, -6.2e-28], t$95$2, If[LessEqual[B, -7.5e-157], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.65e-21], t$95$3, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
t_2 := \frac{-\sqrt{2 \cdot \left(\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{t_0}\\
t_3 := \frac{\sqrt{2 \cdot t_1} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{if}\;B \leq -2.8 \cdot 10^{+28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq -2.5 \cdot 10^{-17}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B \leq -6.2 \cdot 10^{-28}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq -7.5 \cdot 10^{-157}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{elif}\;B \leq 1.65 \cdot 10^{-21}:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -2.8000000000000001e28 or -2.4999999999999999e-17 < B < -6.19999999999999984e-28Initial program 28.1%
associate-*l*28.1%
unpow228.1%
+-commutative28.1%
unpow228.1%
associate-*l*28.1%
unpow228.1%
Simplified28.1%
Taylor expanded in A around 0 26.1%
unpow226.1%
unpow226.1%
hypot-def26.1%
Simplified26.1%
Taylor expanded in A around 0 24.4%
+-commutative24.4%
unpow224.4%
unpow224.4%
hypot-def24.5%
unpow224.5%
Simplified24.5%
if -2.8000000000000001e28 < B < -2.4999999999999999e-17 or -7.500000000000001e-157 < B < 1.65000000000000004e-21Initial program 16.7%
associate-*l*16.7%
unpow216.7%
+-commutative16.7%
unpow216.7%
associate-*l*16.7%
unpow216.7%
Simplified16.7%
sqrt-prod22.2%
*-commutative22.2%
*-commutative22.2%
associate-+l+22.6%
unpow222.6%
hypot-udef33.2%
associate-+r+32.3%
+-commutative32.3%
associate-+r+33.1%
Applied egg-rr33.1%
Taylor expanded in A around -inf 24.6%
if -6.19999999999999984e-28 < B < -7.500000000000001e-157Initial program 16.4%
associate-*l*16.4%
unpow216.4%
+-commutative16.4%
unpow216.4%
associate-*l*16.4%
unpow216.4%
Simplified16.4%
Taylor expanded in A around -inf 21.6%
div-inv21.7%
associate-*l*21.7%
*-commutative21.7%
*-commutative21.7%
*-commutative21.7%
Applied egg-rr21.7%
if 1.65000000000000004e-21 < B Initial program 22.4%
associate-*l*22.4%
unpow222.4%
+-commutative22.4%
unpow222.4%
associate-*l*22.4%
unpow222.4%
Simplified22.4%
Taylor expanded in B around inf 21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in C around 0 60.9%
mul-1-neg60.9%
Simplified60.9%
Final simplification34.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* F t_0)))
(if (<= B -5e+34)
(* (sqrt (* 2.0 (* t_1 (+ C (+ A (hypot B (- A C))))))) (/ -1.0 t_0))
(if (<= B 4.2e-10)
(/ (* (sqrt (* 2.0 t_1)) (- (sqrt (+ C C)))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))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 <= -5e+34) {
tmp = sqrt((2.0 * (t_1 * (C + (A + hypot(B, (A - C))))))) * (-1.0 / t_0);
} else if (B <= 4.2e-10) {
tmp = (sqrt((2.0 * t_1)) * -sqrt((C + C))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
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 <= -5e+34) {
tmp = Math.sqrt((2.0 * (t_1 * (C + (A + Math.hypot(B, (A - C))))))) * (-1.0 / t_0);
} else if (B <= 4.2e-10) {
tmp = (Math.sqrt((2.0 * t_1)) * -Math.sqrt((C + C))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
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 <= -5e+34: tmp = math.sqrt((2.0 * (t_1 * (C + (A + math.hypot(B, (A - C))))))) * (-1.0 / t_0) elif B <= 4.2e-10: tmp = (math.sqrt((2.0 * t_1)) * -math.sqrt((C + C))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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 <= -5e+34) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(C + Float64(A + hypot(B, Float64(A - C))))))) * Float64(-1.0 / t_0)); elseif (B <= 4.2e-10) tmp = Float64(Float64(sqrt(Float64(2.0 * t_1)) * Float64(-sqrt(Float64(C + C)))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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 <= -5e+34)
tmp = sqrt((2.0 * (t_1 * (C + (A + hypot(B, (A - C))))))) * (-1.0 / t_0);
elseif (B <= 4.2e-10)
tmp = (sqrt((2.0 * t_1)) * -sqrt((C + C))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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, -5e+34], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 4.2e-10], N[(N[(N[Sqrt[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -5 \cdot 10^{+34}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{elif}\;B \leq 4.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{\sqrt{2 \cdot t_1} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -4.9999999999999998e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
div-inv26.0%
Applied egg-rr26.1%
if -4.9999999999999998e34 < B < 4.2e-10Initial program 18.1%
associate-*l*18.1%
unpow218.1%
+-commutative18.1%
unpow218.1%
associate-*l*18.1%
unpow218.1%
Simplified18.1%
sqrt-prod22.4%
*-commutative22.4%
*-commutative22.4%
associate-+l+22.8%
unpow222.8%
hypot-udef31.9%
associate-+r+31.2%
+-commutative31.2%
associate-+r+32.0%
Applied egg-rr32.0%
Taylor expanded in A around -inf 21.9%
if 4.2e-10 < B Initial program 22.4%
associate-*l*22.4%
unpow222.4%
+-commutative22.4%
unpow222.4%
associate-*l*22.4%
unpow222.4%
Simplified22.4%
Taylor expanded in B around inf 21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in C around 0 60.9%
mul-1-neg60.9%
Simplified60.9%
Final simplification33.3%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* F t_0))))
(if (<= B -9e+25)
(- (/ (sqrt (* (+ C (hypot B C)) t_1)) t_0))
(if (<= B 5.2e-11)
(/ (* (sqrt t_1) (- (sqrt (+ C C)))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))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 = 2.0 * (F * t_0);
double tmp;
if (B <= -9e+25) {
tmp = -(sqrt(((C + hypot(B, C)) * t_1)) / t_0);
} else if (B <= 5.2e-11) {
tmp = (sqrt(t_1) * -sqrt((C + C))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
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 = 2.0 * (F * t_0);
double tmp;
if (B <= -9e+25) {
tmp = -(Math.sqrt(((C + Math.hypot(B, C)) * t_1)) / t_0);
} else if (B <= 5.2e-11) {
tmp = (Math.sqrt(t_1) * -Math.sqrt((C + C))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = 2.0 * (F * t_0) tmp = 0 if B <= -9e+25: tmp = -(math.sqrt(((C + math.hypot(B, C)) * t_1)) / t_0) elif B <= 5.2e-11: tmp = (math.sqrt(t_1) * -math.sqrt((C + C))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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(2.0 * Float64(F * t_0)) tmp = 0.0 if (B <= -9e+25) tmp = Float64(-Float64(sqrt(Float64(Float64(C + hypot(B, C)) * t_1)) / t_0)); elseif (B <= 5.2e-11) tmp = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(C + C)))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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 = 2.0 * (F * t_0);
tmp = 0.0;
if (B <= -9e+25)
tmp = -(sqrt(((C + hypot(B, C)) * t_1)) / t_0);
elseif (B <= 5.2e-11)
tmp = (sqrt(t_1) * -sqrt((C + C))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -9e+25], (-N[(N[Sqrt[N[(N[(C + N[Sqrt[B ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 5.2e-11], N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(C + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(F \cdot t_0\right)\\
\mathbf{if}\;B \leq -9 \cdot 10^{+25}:\\
\;\;\;\;-\frac{\sqrt{\left(C + \mathsf{hypot}\left(B, C\right)\right) \cdot t_1}}{t_0}\\
\mathbf{elif}\;B \leq 5.2 \cdot 10^{-11}:\\
\;\;\;\;\frac{\sqrt{t_1} \cdot \left(-\sqrt{C + C}\right)}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -9.0000000000000006e25Initial program 25.6%
associate-*l*25.6%
unpow225.6%
+-commutative25.6%
unpow225.6%
associate-*l*25.6%
unpow225.6%
Simplified25.6%
Taylor expanded in A around 0 21.7%
unpow221.7%
unpow221.7%
hypot-def21.7%
Simplified21.7%
if -9.0000000000000006e25 < B < 5.2000000000000001e-11Initial program 18.3%
associate-*l*18.3%
unpow218.3%
+-commutative18.3%
unpow218.3%
associate-*l*18.3%
unpow218.3%
Simplified18.3%
sqrt-prod22.6%
*-commutative22.6%
*-commutative22.6%
associate-+l+22.9%
unpow222.9%
hypot-udef32.1%
associate-+r+31.4%
+-commutative31.4%
associate-+r+32.2%
Applied egg-rr32.2%
Taylor expanded in A around -inf 22.1%
if 5.2000000000000001e-11 < B Initial program 22.4%
associate-*l*22.4%
unpow222.4%
+-commutative22.4%
unpow222.4%
associate-*l*22.4%
unpow222.4%
Simplified22.4%
Taylor expanded in B around inf 21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in C around 0 60.9%
mul-1-neg60.9%
Simplified60.9%
Final simplification32.5%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -1.25e-27)
(/ (- (sqrt (* 2.0 (* (+ C (hypot C B)) (* F (* B B)))))) t_0)
(if (<= B 7.8e+17)
(* (sqrt (* 2.0 (* (* F t_0) (* 2.0 C)))) (/ -1.0 t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))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.25e-27) {
tmp = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
} else if (B <= 7.8e+17) {
tmp = sqrt((2.0 * ((F * t_0) * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
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.25e-27) {
tmp = -Math.sqrt((2.0 * ((C + Math.hypot(C, B)) * (F * (B * B))))) / t_0;
} else if (B <= 7.8e+17) {
tmp = Math.sqrt((2.0 * ((F * t_0) * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
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.25e-27: tmp = -math.sqrt((2.0 * ((C + math.hypot(C, B)) * (F * (B * B))))) / t_0 elif B <= 7.8e+17: tmp = math.sqrt((2.0 * ((F * t_0) * (2.0 * C)))) * (-1.0 / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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.25e-27) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(C + hypot(C, B)) * Float64(F * Float64(B * B)))))) / t_0); elseif (B <= 7.8e+17) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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.25e-27)
tmp = -sqrt((2.0 * ((C + hypot(C, B)) * (F * (B * B))))) / t_0;
elseif (B <= 7.8e+17)
tmp = sqrt((2.0 * ((F * t_0) * (2.0 * C)))) * (-1.0 / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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.25e-27], N[((-N[Sqrt[N[(2.0 * N[(N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 7.8e+17], N[(N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -1.25 \cdot 10^{-27}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(C + \mathsf{hypot}\left(C, B\right)\right) \cdot \left(F \cdot \left(B \cdot B\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 7.8 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -1.25e-27Initial program 26.3%
associate-*l*26.3%
unpow226.3%
+-commutative26.3%
unpow226.3%
associate-*l*26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in A around 0 24.6%
unpow224.6%
unpow224.6%
hypot-def26.1%
Simplified26.1%
Taylor expanded in A around 0 23.2%
+-commutative23.2%
unpow223.2%
unpow223.2%
hypot-def23.5%
unpow223.5%
Simplified23.5%
if -1.25e-27 < B < 7.8e17Initial program 17.9%
associate-*l*17.9%
unpow217.9%
+-commutative17.9%
unpow217.9%
associate-*l*17.9%
unpow217.9%
Simplified17.9%
Taylor expanded in A around -inf 18.6%
div-inv18.6%
associate-*l*18.6%
*-commutative18.6%
*-commutative18.6%
*-commutative18.6%
Applied egg-rr18.6%
if 7.8e17 < B Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in B around inf 21.2%
associate-+r+21.2%
Simplified21.2%
Taylor expanded in C around 0 63.7%
mul-1-neg63.7%
Simplified63.7%
Final simplification31.2%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* F t_0)))
(if (<= B -5.8e+34)
(- (/ (sqrt (* (* 2.0 t_1) (+ A (- C B)))) t_0))
(if (<= B 1.3e+18)
(* (sqrt (* 2.0 (* t_1 (* 2.0 C)))) (/ -1.0 t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* F (+ B A)))))))))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 <= -5.8e+34) {
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 1.3e+18) {
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = f * t_0
if (b <= (-5.8d+34)) then
tmp = -(sqrt(((2.0d0 * t_1) * (a + (c - b)))) / t_0)
else if (b <= 1.3d+18) then
tmp = sqrt((2.0d0 * (t_1 * (2.0d0 * c)))) * ((-1.0d0) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -sqrt((f * (b + a)))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = F * t_0;
double tmp;
if (B <= -5.8e+34) {
tmp = -(Math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 1.3e+18) {
tmp = Math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (B + A)));
}
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 <= -5.8e+34: tmp = -(math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0) elif B <= 1.3e+18: tmp = math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (B + A))) 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 <= -5.8e+34) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * t_1) * Float64(A + Float64(C - B)))) / t_0)); elseif (B <= 1.3e+18) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(B + A))))); 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 <= -5.8e+34)
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
elseif (B <= 1.3e+18)
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (B + A)));
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, -5.8e+34], (-N[(N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 1.3e+18], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -5.8 \cdot 10^{+34}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot t_1\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.3 \cdot 10^{+18}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(B + A\right)}\right)\\
\end{array}
\end{array}
if B < -5.8000000000000003e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
Taylor expanded in B around -inf 22.6%
mul-1-neg22.6%
unsub-neg22.6%
Simplified22.6%
if -5.8000000000000003e34 < B < 1.3e18Initial program 19.0%
associate-*l*19.0%
unpow219.0%
+-commutative19.0%
unpow219.0%
associate-*l*19.0%
unpow219.0%
Simplified19.0%
Taylor expanded in A around -inf 18.7%
div-inv18.6%
associate-*l*18.6%
*-commutative18.6%
*-commutative18.6%
*-commutative18.6%
Applied egg-rr18.6%
if 1.3e18 < B Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in B around inf 21.2%
associate-+r+21.2%
Simplified21.2%
Taylor expanded in C around 0 63.7%
mul-1-neg63.7%
Simplified63.7%
Final simplification30.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 -7.5e+23)
(- (/ (sqrt (* (* 2.0 t_1) (+ A (- C B)))) t_0))
(if (<= B 110000000000.0)
(* (sqrt (* 2.0 (* t_1 (* 2.0 C)))) (/ -1.0 t_0))
(* (sqrt 2.0) (- (sqrt (/ F B))))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = F * t_0;
double tmp;
if (B <= -7.5e+23) {
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 110000000000.0) {
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = sqrt(2.0) * -sqrt((F / B));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = f * t_0
if (b <= (-7.5d+23)) then
tmp = -(sqrt(((2.0d0 * t_1) * (a + (c - b)))) / t_0)
else if (b <= 110000000000.0d0) then
tmp = sqrt((2.0d0 * (t_1 * (2.0d0 * c)))) * ((-1.0d0) / t_0)
else
tmp = sqrt(2.0d0) * -sqrt((f / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = F * t_0;
double tmp;
if (B <= -7.5e+23) {
tmp = -(Math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 110000000000.0) {
tmp = Math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = Math.sqrt(2.0) * -Math.sqrt((F / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = F * t_0 tmp = 0 if B <= -7.5e+23: tmp = -(math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0) elif B <= 110000000000.0: tmp = math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0) else: tmp = math.sqrt(2.0) * -math.sqrt((F / B)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -7.5e+23) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * t_1) * Float64(A + Float64(C - B)))) / t_0)); elseif (B <= 110000000000.0) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); else tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F / 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 <= -7.5e+23)
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
elseif (B <= 110000000000.0)
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
else
tmp = sqrt(2.0) * -sqrt((F / B));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -7.5e+23], (-N[(N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 110000000000.0], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F / B), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -7.5 \cdot 10^{+23}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot t_1\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 110000000000:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{\frac{F}{B}}\right)\\
\end{array}
\end{array}
if B < -7.49999999999999987e23Initial program 25.2%
associate-*l*25.2%
unpow225.2%
+-commutative25.2%
unpow225.2%
associate-*l*25.2%
unpow225.2%
Simplified25.2%
Taylor expanded in B around -inf 21.8%
mul-1-neg21.8%
unsub-neg21.8%
Simplified21.8%
if -7.49999999999999987e23 < B < 1.1e11Initial program 19.3%
associate-*l*19.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
associate-*l*19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in A around -inf 19.1%
div-inv19.0%
associate-*l*19.0%
*-commutative19.0%
*-commutative19.0%
*-commutative19.0%
Applied egg-rr19.0%
if 1.1e11 < B Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
Taylor expanded in A around 0 20.7%
unpow220.7%
unpow220.7%
hypot-def22.2%
Simplified22.2%
Taylor expanded in C around 0 60.2%
mul-1-neg60.2%
Simplified60.2%
Final simplification30.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* F t_0)) (t_2 (* 2.0 t_1)))
(if (<= B -3.9e+34)
(- (/ (sqrt (* t_2 (+ A (- C B)))) t_0))
(if (<= B 9e+17)
(* (sqrt (* 2.0 (* t_1 (* 2.0 C)))) (/ -1.0 t_0))
(- (/ (sqrt (* t_2 (+ B (+ 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 t_1 = F * t_0;
double t_2 = 2.0 * t_1;
double tmp;
if (B <= -3.9e+34) {
tmp = -(sqrt((t_2 * (A + (C - B)))) / t_0);
} else if (B <= 9e+17) {
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = -(sqrt((t_2 * (B + (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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = f * t_0
t_2 = 2.0d0 * t_1
if (b <= (-3.9d+34)) then
tmp = -(sqrt((t_2 * (a + (c - b)))) / t_0)
else if (b <= 9d+17) then
tmp = sqrt((2.0d0 * (t_1 * (2.0d0 * c)))) * ((-1.0d0) / t_0)
else
tmp = -(sqrt((t_2 * (b + (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 t_1 = F * t_0;
double t_2 = 2.0 * t_1;
double tmp;
if (B <= -3.9e+34) {
tmp = -(Math.sqrt((t_2 * (A + (C - B)))) / t_0);
} else if (B <= 9e+17) {
tmp = Math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = -(Math.sqrt((t_2 * (B + (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)) t_1 = F * t_0 t_2 = 2.0 * t_1 tmp = 0 if B <= -3.9e+34: tmp = -(math.sqrt((t_2 * (A + (C - B)))) / t_0) elif B <= 9e+17: tmp = math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0) else: tmp = -(math.sqrt((t_2 * (B + (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))) t_1 = Float64(F * t_0) t_2 = Float64(2.0 * t_1) tmp = 0.0 if (B <= -3.9e+34) tmp = Float64(-Float64(sqrt(Float64(t_2 * Float64(A + Float64(C - B)))) / t_0)); elseif (B <= 9e+17) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); else tmp = Float64(-Float64(sqrt(Float64(t_2 * Float64(B + 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));
t_1 = F * t_0;
t_2 = 2.0 * t_1;
tmp = 0.0;
if (B <= -3.9e+34)
tmp = -(sqrt((t_2 * (A + (C - B)))) / t_0);
elseif (B <= 9e+17)
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
else
tmp = -(sqrt((t_2 * (B + (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]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * t$95$1), $MachinePrecision]}, If[LessEqual[B, -3.9e+34], (-N[(N[Sqrt[N[(t$95$2 * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 9e+17], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], (-N[(N[Sqrt[N[(t$95$2 * N[(B + N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision])]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
t_2 := 2 \cdot t_1\\
\mathbf{if}\;B \leq -3.9 \cdot 10^{+34}:\\
\;\;\;\;-\frac{\sqrt{t_2 \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 9 \cdot 10^{+17}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{t_2 \cdot \left(B + \left(A + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -3.90000000000000019e34Initial program 26.1%
associate-*l*26.1%
unpow226.1%
+-commutative26.1%
unpow226.1%
associate-*l*26.1%
unpow226.1%
Simplified26.1%
Taylor expanded in B around -inf 22.6%
mul-1-neg22.6%
unsub-neg22.6%
Simplified22.6%
if -3.90000000000000019e34 < B < 9e17Initial program 19.0%
associate-*l*19.0%
unpow219.0%
+-commutative19.0%
unpow219.0%
associate-*l*19.0%
unpow219.0%
Simplified19.0%
Taylor expanded in A around -inf 18.7%
div-inv18.6%
associate-*l*18.6%
*-commutative18.6%
*-commutative18.6%
*-commutative18.6%
Applied egg-rr18.6%
if 9e17 < B Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in B around inf 21.2%
associate-+r+21.2%
Simplified21.2%
Final simplification20.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 (* F (* B B))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -9e+15)
(/ (- (sqrt (* (+ A (- C B)) (* 2.0 t_0)))) t_1)
(if (<= B 48000000000000.0)
(* (sqrt (* 2.0 (* (* F t_1) (* 2.0 C)))) (/ -1.0 t_1))
(/ (- (sqrt (* 2.0 (* t_0 (+ B C))))) t_1)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -9e+15) {
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 48000000000000.0) {
tmp = sqrt((2.0 * ((F * t_1) * (2.0 * C)))) * (-1.0 / t_1);
} else {
tmp = -sqrt((2.0 * (t_0 * (B + 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 = f * (b * b)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-9d+15)) then
tmp = -sqrt(((a + (c - b)) * (2.0d0 * t_0))) / t_1
else if (b <= 48000000000000.0d0) then
tmp = sqrt((2.0d0 * ((f * t_1) * (2.0d0 * c)))) * ((-1.0d0) / t_1)
else
tmp = -sqrt((2.0d0 * (t_0 * (b + 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 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -9e+15) {
tmp = -Math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 48000000000000.0) {
tmp = Math.sqrt((2.0 * ((F * t_1) * (2.0 * C)))) * (-1.0 / t_1);
} else {
tmp = -Math.sqrt((2.0 * (t_0 * (B + C)))) / t_1;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = F * (B * B) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -9e+15: tmp = -math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1 elif B <= 48000000000000.0: tmp = math.sqrt((2.0 * ((F * t_1) * (2.0 * C)))) * (-1.0 / t_1) else: tmp = -math.sqrt((2.0 * (t_0 * (B + C)))) / t_1 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -9e+15) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C - B)) * Float64(2.0 * t_0)))) / t_1); elseif (B <= 48000000000000.0) tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(2.0 * C)))) * Float64(-1.0 / t_1)); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(B + C))))) / t_1); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = F * (B * B);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -9e+15)
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
elseif (B <= 48000000000000.0)
tmp = sqrt((2.0 * ((F * t_1) * (2.0 * C)))) * (-1.0 / t_1);
else
tmp = -sqrt((2.0 * (t_0 * (B + 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[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -9e+15], N[((-N[Sqrt[N[(N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 48000000000000.0], N[(N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -9 \cdot 10^{+15}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C - B\right)\right) \cdot \left(2 \cdot t_0\right)}}{t_1}\\
\mathbf{elif}\;B \leq 48000000000000:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(B + C\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -9e15Initial program 24.4%
associate-*l*24.4%
unpow224.4%
+-commutative24.4%
unpow224.4%
associate-*l*24.4%
unpow224.4%
Simplified24.4%
Taylor expanded in B around -inf 21.2%
mul-1-neg21.2%
unsub-neg21.2%
Simplified21.2%
Taylor expanded in B around inf 21.1%
unpow221.1%
Simplified21.1%
if -9e15 < B < 4.8e13Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
Taylor expanded in A around -inf 19.3%
div-inv19.3%
associate-*l*19.3%
*-commutative19.3%
*-commutative19.3%
*-commutative19.3%
Applied egg-rr19.3%
if 4.8e13 < B Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
Taylor expanded in B around inf 20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in A around 0 20.7%
unpow220.7%
Simplified20.7%
Final simplification20.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* F t_0)))
(if (<= B -2.1e+20)
(- (/ (sqrt (* (* 2.0 t_1) (+ A (- C B)))) t_0))
(if (<= B 6.6e+16)
(* (sqrt (* 2.0 (* t_1 (* 2.0 C)))) (/ -1.0 t_0))
(/ (- (sqrt (* 2.0 (* (* F (* B B)) (+ B 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 t_1 = F * t_0;
double tmp;
if (B <= -2.1e+20) {
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 6.6e+16) {
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = -sqrt((2.0 * ((F * (B * B)) * (B + 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) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = f * t_0
if (b <= (-2.1d+20)) then
tmp = -(sqrt(((2.0d0 * t_1) * (a + (c - b)))) / t_0)
else if (b <= 6.6d+16) then
tmp = sqrt((2.0d0 * (t_1 * (2.0d0 * c)))) * ((-1.0d0) / t_0)
else
tmp = -sqrt((2.0d0 * ((f * (b * b)) * (b + 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 t_1 = F * t_0;
double tmp;
if (B <= -2.1e+20) {
tmp = -(Math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
} else if (B <= 6.6e+16) {
tmp = Math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
} else {
tmp = -Math.sqrt((2.0 * ((F * (B * B)) * (B + C)))) / t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = F * t_0 tmp = 0 if B <= -2.1e+20: tmp = -(math.sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0) elif B <= 6.6e+16: tmp = math.sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0) else: tmp = -math.sqrt((2.0 * ((F * (B * B)) * (B + C)))) / t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -2.1e+20) tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * t_1) * Float64(A + Float64(C - B)))) / t_0)); elseif (B <= 6.6e+16) tmp = Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(2.0 * C)))) * Float64(-1.0 / t_0)); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(B * B)) * Float64(B + C))))) / t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -2.1e+20)
tmp = -(sqrt(((2.0 * t_1) * (A + (C - B)))) / t_0);
elseif (B <= 6.6e+16)
tmp = sqrt((2.0 * (t_1 * (2.0 * C)))) * (-1.0 / t_0);
else
tmp = -sqrt((2.0 * ((F * (B * B)) * (B + C)))) / t_0;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -2.1e+20], (-N[(N[Sqrt[N[(N[(2.0 * t$95$1), $MachinePrecision] * N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 6.6e+16], N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision] * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -2.1 \cdot 10^{+20}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot t_1\right) \cdot \left(A + \left(C - B\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 6.6 \cdot 10^{+16}:\\
\;\;\;\;\sqrt{2 \cdot \left(t_1 \cdot \left(2 \cdot C\right)\right)} \cdot \frac{-1}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B\right)\right) \cdot \left(B + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -2.1e20Initial program 25.2%
associate-*l*25.2%
unpow225.2%
+-commutative25.2%
unpow225.2%
associate-*l*25.2%
unpow225.2%
Simplified25.2%
Taylor expanded in B around -inf 21.8%
mul-1-neg21.8%
unsub-neg21.8%
Simplified21.8%
if -2.1e20 < B < 6.6e16Initial program 19.3%
associate-*l*19.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
associate-*l*19.3%
unpow219.3%
Simplified19.3%
Taylor expanded in A around -inf 19.1%
div-inv19.0%
associate-*l*19.0%
*-commutative19.0%
*-commutative19.0%
*-commutative19.0%
Applied egg-rr19.0%
if 6.6e16 < B Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
Taylor expanded in B around inf 20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in A around 0 20.7%
unpow220.7%
Simplified20.7%
Final simplification20.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 (* F (* B B))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -6.9e+15)
(/ (- (sqrt (* (+ A (- C B)) (* 2.0 t_0)))) t_1)
(if (<= B 60000000000000.0)
(/ (- (sqrt (* (* 2.0 (* F t_1)) (* 2.0 C)))) t_1)
(/ (- (sqrt (* 2.0 (* t_0 (+ B C))))) t_1)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -6.9e+15) {
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 60000000000000.0) {
tmp = -sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1;
} else {
tmp = -sqrt((2.0 * (t_0 * (B + 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 = f * (b * b)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-6.9d+15)) then
tmp = -sqrt(((a + (c - b)) * (2.0d0 * t_0))) / t_1
else if (b <= 60000000000000.0d0) then
tmp = -sqrt(((2.0d0 * (f * t_1)) * (2.0d0 * c))) / t_1
else
tmp = -sqrt((2.0d0 * (t_0 * (b + 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 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -6.9e+15) {
tmp = -Math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 60000000000000.0) {
tmp = -Math.sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1;
} else {
tmp = -Math.sqrt((2.0 * (t_0 * (B + C)))) / t_1;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = F * (B * B) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -6.9e+15: tmp = -math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1 elif B <= 60000000000000.0: tmp = -math.sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1 else: tmp = -math.sqrt((2.0 * (t_0 * (B + C)))) / t_1 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -6.9e+15) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C - B)) * Float64(2.0 * t_0)))) / t_1); elseif (B <= 60000000000000.0) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(F * t_1)) * Float64(2.0 * C)))) / t_1); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(B + C))))) / t_1); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = F * (B * B);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -6.9e+15)
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
elseif (B <= 60000000000000.0)
tmp = -sqrt(((2.0 * (F * t_1)) * (2.0 * C))) / t_1;
else
tmp = -sqrt((2.0 * (t_0 * (B + 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[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -6.9e+15], N[((-N[Sqrt[N[(N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 60000000000000.0], N[((-N[Sqrt[N[(N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -6.9 \cdot 10^{+15}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C - B\right)\right) \cdot \left(2 \cdot t_0\right)}}{t_1}\\
\mathbf{elif}\;B \leq 60000000000000:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(F \cdot t_1\right)\right) \cdot \left(2 \cdot C\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(B + C\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -6.9e15Initial program 24.4%
associate-*l*24.4%
unpow224.4%
+-commutative24.4%
unpow224.4%
associate-*l*24.4%
unpow224.4%
Simplified24.4%
Taylor expanded in B around -inf 21.2%
mul-1-neg21.2%
unsub-neg21.2%
Simplified21.2%
Taylor expanded in B around inf 21.1%
unpow221.1%
Simplified21.1%
if -6.9e15 < B < 6e13Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
Taylor expanded in A around -inf 19.3%
if 6e13 < B Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
Taylor expanded in B around inf 20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in A around 0 20.7%
unpow220.7%
Simplified20.7%
Final simplification20.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 (* F (* B B))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -6.9e+15)
(/ (- (sqrt (* (+ A (- C B)) (* 2.0 t_0)))) t_1)
(if (<= B 2.5e+14)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* (* A C) -4.0))))))) t_1)
(/ (- (sqrt (* 2.0 (* t_0 (+ B C))))) t_1)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -6.9e+15) {
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 2.5e+14) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + ((A * C) * -4.0)))))) / t_1;
} else {
tmp = -sqrt((2.0 * (t_0 * (B + 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 = f * (b * b)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-6.9d+15)) then
tmp = -sqrt(((a + (c - b)) * (2.0d0 * t_0))) / t_1
else if (b <= 2.5d+14) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + ((a * c) * (-4.0d0))))))) / t_1
else
tmp = -sqrt((2.0d0 * (t_0 * (b + 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 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -6.9e+15) {
tmp = -Math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 2.5e+14) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + ((A * C) * -4.0)))))) / t_1;
} else {
tmp = -Math.sqrt((2.0 * (t_0 * (B + C)))) / t_1;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = F * (B * B) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -6.9e+15: tmp = -math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1 elif B <= 2.5e+14: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + ((A * C) * -4.0)))))) / t_1 else: tmp = -math.sqrt((2.0 * (t_0 * (B + C)))) / t_1 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -6.9e+15) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C - B)) * Float64(2.0 * t_0)))) / t_1); elseif (B <= 2.5e+14) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0))))))) / t_1); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(B + C))))) / t_1); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = F * (B * B);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -6.9e+15)
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
elseif (B <= 2.5e+14)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + ((A * C) * -4.0)))))) / t_1;
else
tmp = -sqrt((2.0 * (t_0 * (B + 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[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -6.9e+15], N[((-N[Sqrt[N[(N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 2.5e+14], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -6.9 \cdot 10^{+15}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C - B\right)\right) \cdot \left(2 \cdot t_0\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.5 \cdot 10^{+14}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + \left(A \cdot C\right) \cdot -4\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(B + C\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -6.9e15Initial program 24.4%
associate-*l*24.4%
unpow224.4%
+-commutative24.4%
unpow224.4%
associate-*l*24.4%
unpow224.4%
Simplified24.4%
Taylor expanded in B around -inf 21.2%
mul-1-neg21.2%
unsub-neg21.2%
Simplified21.2%
Taylor expanded in B around inf 21.1%
unpow221.1%
Simplified21.1%
if -6.9e15 < B < 2.5e14Initial program 19.6%
associate-*l*19.6%
unpow219.6%
+-commutative19.6%
unpow219.6%
associate-*l*19.6%
unpow219.6%
Simplified19.6%
Taylor expanded in A around -inf 19.3%
Taylor expanded in F around 0 19.3%
cancel-sign-sub-inv19.3%
unpow219.3%
metadata-eval19.3%
Simplified19.3%
if 2.5e14 < B Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
Taylor expanded in B around inf 20.9%
associate-+r+20.9%
Simplified20.9%
Taylor expanded in A around 0 20.7%
unpow220.7%
Simplified20.7%
Final simplification20.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -5.8e+102)
(* (/ 2.0 B) (sqrt (* C F)))
(if (<= B -9.2e-29)
(- (/ (sqrt (* 2.0 (* F (* (* B B) (- C B))))) t_0))
(if (<= B 8.6e-9)
(/ (- (sqrt (* -16.0 (* A (* F (* C C)))))) t_0)
(/ (- (sqrt (* 2.0 (* (* F (* B B)) (+ B 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 <= -5.8e+102) {
tmp = (2.0 / B) * sqrt((C * F));
} else if (B <= -9.2e-29) {
tmp = -(sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
} else if (B <= 8.6e-9) {
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / t_0;
} else {
tmp = -sqrt((2.0 * ((F * (B * B)) * (B + 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 <= (-5.8d+102)) then
tmp = (2.0d0 / b) * sqrt((c * f))
else if (b <= (-9.2d-29)) then
tmp = -(sqrt((2.0d0 * (f * ((b * b) * (c - b))))) / t_0)
else if (b <= 8.6d-9) then
tmp = -sqrt(((-16.0d0) * (a * (f * (c * c))))) / t_0
else
tmp = -sqrt((2.0d0 * ((f * (b * b)) * (b + 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 <= -5.8e+102) {
tmp = (2.0 / B) * Math.sqrt((C * F));
} else if (B <= -9.2e-29) {
tmp = -(Math.sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
} else if (B <= 8.6e-9) {
tmp = -Math.sqrt((-16.0 * (A * (F * (C * C))))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * ((F * (B * B)) * (B + 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 <= -5.8e+102: tmp = (2.0 / B) * math.sqrt((C * F)) elif B <= -9.2e-29: tmp = -(math.sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0) elif B <= 8.6e-9: tmp = -math.sqrt((-16.0 * (A * (F * (C * C))))) / t_0 else: tmp = -math.sqrt((2.0 * ((F * (B * B)) * (B + C)))) / t_0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -5.8e+102) tmp = Float64(Float64(2.0 / B) * sqrt(Float64(C * F))); elseif (B <= -9.2e-29) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) * Float64(C - B))))) / t_0)); elseif (B <= 8.6e-9) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * C)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(B * B)) * Float64(B + C))))) / t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -5.8e+102)
tmp = (2.0 / B) * sqrt((C * F));
elseif (B <= -9.2e-29)
tmp = -(sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
elseif (B <= 8.6e-9)
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / t_0;
else
tmp = -sqrt((2.0 * ((F * (B * B)) * (B + C)))) / t_0;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -5.8e+102], N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -9.2e-29], (-N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] * N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 8.6e-9], N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(N[(F * N[(B * B), $MachinePrecision]), $MachinePrecision] * N[(B + C), $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.8 \cdot 10^{+102}:\\
\;\;\;\;\frac{2}{B} \cdot \sqrt{C \cdot F}\\
\mathbf{elif}\;B \leq -9.2 \cdot 10^{-29}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(\left(B \cdot B\right) \cdot \left(C - B\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 8.6 \cdot 10^{-9}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B\right)\right) \cdot \left(B + C\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -5.8000000000000005e102Initial program 13.6%
associate-*l*13.6%
unpow213.6%
+-commutative13.6%
unpow213.6%
associate-*l*13.6%
unpow213.6%
Simplified13.6%
sqrt-prod16.0%
*-commutative16.0%
*-commutative16.0%
associate-+l+16.0%
unpow216.0%
hypot-udef18.5%
associate-+r+18.6%
+-commutative18.6%
associate-+r+18.6%
Applied egg-rr18.6%
Taylor expanded in A around -inf 3.2%
Taylor expanded in B around -inf 5.0%
unpow25.0%
rem-square-sqrt5.0%
Simplified5.0%
if -5.8000000000000005e102 < B < -9.19999999999999965e-29Initial program 40.9%
associate-*l*40.9%
unpow240.9%
+-commutative40.9%
unpow240.9%
associate-*l*40.9%
unpow240.9%
Simplified40.9%
Taylor expanded in B around -inf 36.0%
mul-1-neg36.0%
unsub-neg36.0%
Simplified36.0%
Taylor expanded in A around 0 36.1%
unpow236.1%
Simplified36.1%
if -9.19999999999999965e-29 < B < 8.59999999999999925e-9Initial program 16.9%
associate-*l*16.9%
unpow216.9%
+-commutative16.9%
unpow216.9%
associate-*l*16.9%
unpow216.9%
Simplified16.9%
Taylor expanded in A around -inf 19.0%
Taylor expanded in B around 0 10.5%
unpow210.5%
Simplified10.5%
if 8.59999999999999925e-9 < B Initial program 22.4%
associate-*l*22.4%
unpow222.4%
+-commutative22.4%
unpow222.4%
associate-*l*22.4%
unpow222.4%
Simplified22.4%
Taylor expanded in B around inf 21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in A around 0 21.3%
unpow221.3%
Simplified21.3%
Final simplification15.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 -5.8e+102)
(* (/ 2.0 B) (sqrt (* C F)))
(if (<= B -6.8e-31)
(- (/ (sqrt (* 2.0 (* F (* (* B B) (- C B))))) t_0))
(/ (- (sqrt (* -16.0 (* A (* F (* C 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 <= -5.8e+102) {
tmp = (2.0 / B) * sqrt((C * F));
} else if (B <= -6.8e-31) {
tmp = -(sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
} else {
tmp = -sqrt((-16.0 * (A * (F * (C * 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 <= (-5.8d+102)) then
tmp = (2.0d0 / b) * sqrt((c * f))
else if (b <= (-6.8d-31)) then
tmp = -(sqrt((2.0d0 * (f * ((b * b) * (c - b))))) / t_0)
else
tmp = -sqrt(((-16.0d0) * (a * (f * (c * 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 <= -5.8e+102) {
tmp = (2.0 / B) * Math.sqrt((C * F));
} else if (B <= -6.8e-31) {
tmp = -(Math.sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
} else {
tmp = -Math.sqrt((-16.0 * (A * (F * (C * 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 <= -5.8e+102: tmp = (2.0 / B) * math.sqrt((C * F)) elif B <= -6.8e-31: tmp = -(math.sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0) else: tmp = -math.sqrt((-16.0 * (A * (F * (C * 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 <= -5.8e+102) tmp = Float64(Float64(2.0 / B) * sqrt(Float64(C * F))); elseif (B <= -6.8e-31) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) * Float64(C - B))))) / t_0)); else tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * 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 <= -5.8e+102)
tmp = (2.0 / B) * sqrt((C * F));
elseif (B <= -6.8e-31)
tmp = -(sqrt((2.0 * (F * ((B * B) * (C - B))))) / t_0);
else
tmp = -sqrt((-16.0 * (A * (F * (C * 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, -5.8e+102], N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -6.8e-31], (-N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] * N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[(C * C), $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 -5.8 \cdot 10^{+102}:\\
\;\;\;\;\frac{2}{B} \cdot \sqrt{C \cdot F}\\
\mathbf{elif}\;B \leq -6.8 \cdot 10^{-31}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(F \cdot \left(\left(B \cdot B\right) \cdot \left(C - B\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -5.8000000000000005e102Initial program 13.6%
associate-*l*13.6%
unpow213.6%
+-commutative13.6%
unpow213.6%
associate-*l*13.6%
unpow213.6%
Simplified13.6%
sqrt-prod16.0%
*-commutative16.0%
*-commutative16.0%
associate-+l+16.0%
unpow216.0%
hypot-udef18.5%
associate-+r+18.6%
+-commutative18.6%
associate-+r+18.6%
Applied egg-rr18.6%
Taylor expanded in A around -inf 3.2%
Taylor expanded in B around -inf 5.0%
unpow25.0%
rem-square-sqrt5.0%
Simplified5.0%
if -5.8000000000000005e102 < B < -6.8000000000000002e-31Initial program 40.9%
associate-*l*40.9%
unpow240.9%
+-commutative40.9%
unpow240.9%
associate-*l*40.9%
unpow240.9%
Simplified40.9%
Taylor expanded in B around -inf 36.0%
mul-1-neg36.0%
unsub-neg36.0%
Simplified36.0%
Taylor expanded in A around 0 36.1%
unpow236.1%
Simplified36.1%
if -6.8000000000000002e-31 < B Initial program 19.0%
associate-*l*19.0%
unpow219.0%
+-commutative19.0%
unpow219.0%
associate-*l*19.0%
unpow219.0%
Simplified19.0%
Taylor expanded in A around -inf 13.1%
Taylor expanded in B around 0 7.6%
unpow27.6%
Simplified7.6%
Final simplification10.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 (* F (* B B))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= B -2.25e-29)
(/ (- (sqrt (* (+ A (- C B)) (* 2.0 t_0)))) t_1)
(if (<= B 3.1e-25)
(/ (- (sqrt (* -16.0 (* A (* F (* C C)))))) t_1)
(/ (- (sqrt (* 2.0 (* t_0 (+ B C))))) t_1)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.25e-29) {
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 3.1e-25) {
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / t_1;
} else {
tmp = -sqrt((2.0 * (t_0 * (B + 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 = f * (b * b)
t_1 = (b * b) - (4.0d0 * (a * c))
if (b <= (-2.25d-29)) then
tmp = -sqrt(((a + (c - b)) * (2.0d0 * t_0))) / t_1
else if (b <= 3.1d-25) then
tmp = -sqrt(((-16.0d0) * (a * (f * (c * c))))) / t_1
else
tmp = -sqrt((2.0d0 * (t_0 * (b + 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 = F * (B * B);
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= -2.25e-29) {
tmp = -Math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
} else if (B <= 3.1e-25) {
tmp = -Math.sqrt((-16.0 * (A * (F * (C * C))))) / t_1;
} else {
tmp = -Math.sqrt((2.0 * (t_0 * (B + C)))) / t_1;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = F * (B * B) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= -2.25e-29: tmp = -math.sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1 elif B <= 3.1e-25: tmp = -math.sqrt((-16.0 * (A * (F * (C * C))))) / t_1 else: tmp = -math.sqrt((2.0 * (t_0 * (B + C)))) / t_1 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(F * Float64(B * B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= -2.25e-29) tmp = Float64(Float64(-sqrt(Float64(Float64(A + Float64(C - B)) * Float64(2.0 * t_0)))) / t_1); elseif (B <= 3.1e-25) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * C)))))) / t_1); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(B + C))))) / t_1); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = F * (B * B);
t_1 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= -2.25e-29)
tmp = -sqrt(((A + (C - B)) * (2.0 * t_0))) / t_1;
elseif (B <= 3.1e-25)
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / t_1;
else
tmp = -sqrt((2.0 * (t_0 * (B + 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[(F * N[(B * B), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -2.25e-29], N[((-N[Sqrt[N[(N[(A + N[(C - B), $MachinePrecision]), $MachinePrecision] * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 3.1e-25], N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[(C * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(B \cdot B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq -2.25 \cdot 10^{-29}:\\
\;\;\;\;\frac{-\sqrt{\left(A + \left(C - B\right)\right) \cdot \left(2 \cdot t_0\right)}}{t_1}\\
\mathbf{elif}\;B \leq 3.1 \cdot 10^{-25}:\\
\;\;\;\;\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(B + C\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < -2.2499999999999999e-29Initial program 26.3%
associate-*l*26.3%
unpow226.3%
+-commutative26.3%
unpow226.3%
associate-*l*26.3%
unpow226.3%
Simplified26.3%
Taylor expanded in B around -inf 22.4%
mul-1-neg22.4%
unsub-neg22.4%
Simplified22.4%
Taylor expanded in B around inf 22.3%
unpow222.3%
Simplified22.3%
if -2.2499999999999999e-29 < B < 3.09999999999999995e-25Initial program 16.9%
associate-*l*16.9%
unpow216.9%
+-commutative16.9%
unpow216.9%
associate-*l*16.9%
unpow216.9%
Simplified16.9%
Taylor expanded in A around -inf 19.0%
Taylor expanded in B around 0 10.5%
unpow210.5%
Simplified10.5%
if 3.09999999999999995e-25 < B Initial program 22.4%
associate-*l*22.4%
unpow222.4%
+-commutative22.4%
unpow222.4%
associate-*l*22.4%
unpow222.4%
Simplified22.4%
Taylor expanded in B around inf 21.5%
associate-+r+21.5%
Simplified21.5%
Taylor expanded in A around 0 21.3%
unpow221.3%
Simplified21.3%
Final simplification16.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (- (sqrt (* -16.0 (* A (* F (* C C)))))) (- (* B B) (* 4.0 (* A C)))))
assert(A < C);
double code(double A, double B, double C, double F) {
return -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(((-16.0d0) * (a * (f * (c * c))))) / ((b * b) - (4.0d0 * (a * c)))
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -Math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)))
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * C)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[((-N[Sqrt[N[(-16.0 * N[(A * N[(F * N[(C * C), $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])\\
\\
\frac{-\sqrt{-16 \cdot \left(A \cdot \left(F \cdot \left(C \cdot C\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\end{array}
Initial program 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in A around -inf 10.9%
Taylor expanded in B around 0 6.5%
unpow26.5%
Simplified6.5%
Final simplification6.5%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -7.4e-296) (* (/ 2.0 B) (sqrt (* C F))) (* -2.0 (/ (pow (* C F) 0.5) B))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -7.4e-296) {
tmp = (2.0 / B) * sqrt((C * F));
} else {
tmp = -2.0 * (pow((C * F), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-7.4d-296)) then
tmp = (2.0d0 / b) * sqrt((c * f))
else
tmp = (-2.0d0) * (((c * f) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -7.4e-296) {
tmp = (2.0 / B) * Math.sqrt((C * F));
} else {
tmp = -2.0 * (Math.pow((C * F), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -7.4e-296: tmp = (2.0 / B) * math.sqrt((C * F)) else: tmp = -2.0 * (math.pow((C * F), 0.5) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -7.4e-296) tmp = Float64(Float64(2.0 / B) * sqrt(Float64(C * F))); else tmp = Float64(-2.0 * Float64((Float64(C * F) ^ 0.5) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -7.4e-296)
tmp = (2.0 / B) * sqrt((C * F));
else
tmp = -2.0 * (((C * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -7.4e-296], N[(N[(2.0 / B), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -7.4 \cdot 10^{-296}:\\
\;\;\;\;\frac{2}{B} \cdot \sqrt{C \cdot F}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(C \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -7.40000000000000053e-296Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
sqrt-prod23.8%
*-commutative23.8%
*-commutative23.8%
associate-+l+24.0%
unpow224.0%
hypot-udef30.4%
associate-+r+29.9%
+-commutative29.9%
associate-+r+30.4%
Applied egg-rr30.4%
Taylor expanded in A around -inf 11.1%
Taylor expanded in B around -inf 3.5%
unpow23.5%
rem-square-sqrt3.5%
Simplified3.5%
if -7.40000000000000053e-296 < B Initial program 21.3%
associate-*l*21.3%
unpow221.3%
+-commutative21.3%
unpow221.3%
associate-*l*21.3%
unpow221.3%
Simplified21.3%
Taylor expanded in A around -inf 11.2%
Taylor expanded in B around inf 3.4%
un-div-inv3.4%
*-commutative3.4%
Applied egg-rr3.4%
pow1/23.5%
Applied egg-rr3.5%
Final simplification3.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 (* C F)))) (if (<= B -7.4e-296) (* (/ 2.0 B) t_0) (* -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 <= -7.4e-296) {
tmp = (2.0 / B) * t_0;
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-7.4d-296)) then
tmp = (2.0d0 / b) * t_0
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 <= -7.4e-296) {
tmp = (2.0 / B) * t_0;
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -7.4e-296: tmp = (2.0 / B) * t_0 else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -7.4e-296) tmp = Float64(Float64(2.0 / B) * t_0); else tmp = Float64(-2.0 * Float64(t_0 / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -7.4e-296)
tmp = (2.0 / B) * t_0;
else
tmp = -2.0 * (t_0 / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -7.4e-296], N[(N[(2.0 / B), $MachinePrecision] * t$95$0), $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 -7.4 \cdot 10^{-296}:\\
\;\;\;\;\frac{2}{B} \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -7.40000000000000053e-296Initial program 20.7%
associate-*l*20.7%
unpow220.7%
+-commutative20.7%
unpow220.7%
associate-*l*20.7%
unpow220.7%
Simplified20.7%
sqrt-prod23.8%
*-commutative23.8%
*-commutative23.8%
associate-+l+24.0%
unpow224.0%
hypot-udef30.4%
associate-+r+29.9%
+-commutative29.9%
associate-+r+30.4%
Applied egg-rr30.4%
Taylor expanded in A around -inf 11.1%
Taylor expanded in B around -inf 3.5%
unpow23.5%
rem-square-sqrt3.5%
Simplified3.5%
if -7.40000000000000053e-296 < B Initial program 21.3%
associate-*l*21.3%
unpow221.3%
+-commutative21.3%
unpow221.3%
associate-*l*21.3%
unpow221.3%
Simplified21.3%
Taylor expanded in A around -inf 11.2%
Taylor expanded in B around inf 3.4%
un-div-inv3.4%
*-commutative3.4%
Applied egg-rr3.4%
Final simplification3.5%
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 21.0%
associate-*l*21.0%
unpow221.0%
+-commutative21.0%
unpow221.0%
associate-*l*21.0%
unpow221.0%
Simplified21.0%
Taylor expanded in A around -inf 10.9%
Taylor expanded in B around inf 2.2%
un-div-inv2.2%
*-commutative2.2%
Applied egg-rr2.2%
Final simplification2.2%
herbie shell --seed 2023187
(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))))