
(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 13 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: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (fma B B (* A (* C -4.0)))))
(if (<= (pow B 2.0) 1e-124)
(/
(- (sqrt (* 2.0 (* t_0 (* F (+ A (+ A (* -0.5 (/ (* B B) (- C A))))))))))
t_0)
(if (<= (pow B 2.0) 2e+105)
(/
(- (sqrt (* 2.0 (* t_0 (* F (+ A (- C (hypot B (- A C)))))))))
(- (* B B) (* 4.0 (* A C))))
(* (sqrt (* F (- A (hypot A B)))) (/ (- (sqrt 2.0)) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double tmp;
if (pow(B, 2.0) <= 1e-124) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (A + (-0.5 * ((B * B) / (C - A))))))))) / t_0;
} else if (pow(B, 2.0) <= 2e+105) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + (C - hypot(B, (A - C)))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = sqrt((F * (A - hypot(A, B)))) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B ^ 2.0) <= 1e-124) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(A + Float64(-0.5 * Float64(Float64(B * B) / Float64(C - A)))))))))) / t_0); elseif ((B ^ 2.0) <= 2e+105) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-124], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(A + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / N[(C - A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 2e+105], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{-124}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(A + -0.5 \cdot \frac{B \cdot B}{C - A}\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;{B}^{2} \leq 2 \cdot 10^{+105}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 9.99999999999999933e-125Initial program 21.0%
Simplified28.5%
Taylor expanded in B around 0 20.7%
unpow220.7%
Simplified20.7%
if 9.99999999999999933e-125 < (pow.f64 B 2) < 1.9999999999999999e105Initial program 45.1%
Simplified45.0%
Applied egg-rr46.0%
*-lft-identity46.0%
*-commutative46.0%
fma-udef46.0%
unpow246.0%
hypot-def56.3%
fma-neg56.3%
*-commutative56.3%
*-commutative56.3%
associate-*r*56.3%
distribute-lft-neg-in56.3%
metadata-eval56.3%
*-commutative56.3%
associate-*r*56.3%
Simplified56.3%
if 1.9999999999999999e105 < (pow.f64 B 2) Initial program 11.9%
Simplified11.9%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
*-commutative10.8%
distribute-rgt-neg-in10.8%
unpow210.8%
unpow210.8%
hypot-def22.5%
Simplified22.5%
Final simplification28.5%
NOTE: B should be positive before calling this function
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 2.6e-62)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
(if (<= B 1.7e+56)
(/
(-
(sqrt
(*
2.0
(*
(fma B B (* A (* C -4.0)))
(* F (+ A (- C (hypot B (- A C)))))))))
(- (* B B) (* 4.0 (* A C))))
(* (sqrt (* F (- A (hypot A B)))) (/ (- (sqrt 2.0)) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 2.6e-62) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else if (B <= 1.7e+56) {
tmp = -sqrt((2.0 * (fma(B, B, (A * (C * -4.0))) * (F * (A + (C - hypot(B, (A - C)))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = sqrt((F * (A - hypot(A, B)))) * (-sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) 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 <= 2.6e-62) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0); elseif (B <= 1.7e+56) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(fma(B, B, Float64(A * Float64(C * -4.0))) * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(sqrt(Float64(F * Float64(A - hypot(A, B)))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
NOTE: B should be positive before calling this function
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, 2.6e-62], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.7e+56], N[((-N[Sqrt[N[(2.0 * N[(N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[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 2.6 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.7 \cdot 10^{+56}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right) \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - \mathsf{hypot}\left(A, B\right)\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < 2.5999999999999999e-62Initial program 24.5%
Simplified24.5%
Taylor expanded in C around inf 13.6%
cancel-sign-sub-inv13.6%
metadata-eval13.6%
*-lft-identity13.6%
Simplified13.6%
distribute-frac-neg13.6%
associate-*l*14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if 2.5999999999999999e-62 < B < 1.7e56Initial program 26.7%
Simplified26.7%
Applied egg-rr28.3%
*-lft-identity28.3%
*-commutative28.3%
fma-udef28.3%
unpow228.3%
hypot-def42.0%
fma-neg42.0%
*-commutative42.0%
*-commutative42.0%
associate-*r*42.0%
distribute-lft-neg-in42.0%
metadata-eval42.0%
*-commutative42.0%
associate-*r*42.0%
Simplified42.0%
if 1.7e56 < B Initial program 12.3%
Simplified12.3%
Taylor expanded in C around 0 19.5%
mul-1-neg19.5%
*-commutative19.5%
distribute-rgt-neg-in19.5%
unpow219.5%
unpow219.5%
hypot-def40.6%
Simplified40.6%
Final simplification22.5%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- A (hypot A B)))
(t_1 (- (* B B) (* 4.0 (* A C))))
(t_2 (+ (* B B) (* -4.0 (* A C)))))
(if (<= B 3.7e-62)
(/ (- (sqrt (* 2.0 (* t_2 (* F (+ A A)))))) t_2)
(if (<= B 5.8e+47)
(/ (- (sqrt (* 2.0 (* t_0 (* F t_1))))) t_1)
(* (sqrt (* F t_0)) (/ (- (sqrt 2.0)) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = A - hypot(A, B);
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 3.7e-62) {
tmp = -sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
} else if (B <= 5.8e+47) {
tmp = -sqrt((2.0 * (t_0 * (F * t_1)))) / t_1;
} else {
tmp = sqrt((F * t_0)) * (-sqrt(2.0) / B);
}
return tmp;
}
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = A - Math.hypot(A, B);
double t_1 = (B * B) - (4.0 * (A * C));
double t_2 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 3.7e-62) {
tmp = -Math.sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
} else if (B <= 5.8e+47) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * t_1)))) / t_1;
} else {
tmp = Math.sqrt((F * t_0)) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = A - math.hypot(A, B) t_1 = (B * B) - (4.0 * (A * C)) t_2 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 3.7e-62: tmp = -math.sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2 elif B <= 5.8e+47: tmp = -math.sqrt((2.0 * (t_0 * (F * t_1)))) / t_1 else: tmp = math.sqrt((F * t_0)) * (-math.sqrt(2.0) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(A - hypot(A, B)) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_2 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 3.7e-62) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(F * Float64(A + A)))))) / t_2); elseif (B <= 5.8e+47) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * t_1))))) / t_1); else tmp = Float64(sqrt(Float64(F * t_0)) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = A - hypot(A, B);
t_1 = (B * B) - (4.0 * (A * C));
t_2 = (B * B) + (-4.0 * (A * C));
tmp = 0.0;
if (B <= 3.7e-62)
tmp = -sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
elseif (B <= 5.8e+47)
tmp = -sqrt((2.0 * (t_0 * (F * t_1)))) / t_1;
else
tmp = sqrt((F * t_0)) * (-sqrt(2.0) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.7e-62], N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[B, 5.8e+47], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := A - \mathsf{hypot}\left(A, B\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_2 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 3.7 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_2}\\
\mathbf{elif}\;B \leq 5.8 \cdot 10^{+47}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot t_1\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot t_0} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < 3.6999999999999998e-62Initial program 24.5%
Simplified24.5%
Taylor expanded in C around inf 13.6%
cancel-sign-sub-inv13.6%
metadata-eval13.6%
*-lft-identity13.6%
Simplified13.6%
distribute-frac-neg13.6%
associate-*l*14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if 3.6999999999999998e-62 < B < 5.79999999999999961e47Initial program 26.7%
Simplified26.7%
Taylor expanded in C around 0 23.5%
unpow223.5%
unpow223.5%
hypot-def31.4%
Simplified31.4%
if 5.79999999999999961e47 < B Initial program 12.3%
Simplified12.3%
Taylor expanded in C around 0 19.5%
mul-1-neg19.5%
*-commutative19.5%
distribute-rgt-neg-in19.5%
unpow219.5%
unpow219.5%
hypot-def40.6%
Simplified40.6%
Final simplification21.5%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (+ (* B B) (* -4.0 (* A C)))))
(if (<= B 4.6e-62)
(/ (- (sqrt (* 2.0 (* t_1 (* F (+ A A)))))) t_1)
(if (<= B 1.95e+49)
(/ (- (sqrt (* 2.0 (* (- A (hypot A B)) (* F t_0))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A B)))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 4.6e-62) {
tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
} else if (B <= 1.95e+49) {
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * (F * t_0)))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - B)));
}
return tmp;
}
B = Math.abs(B);
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 = (B * B) + (-4.0 * (A * C));
double tmp;
if (B <= 4.6e-62) {
tmp = -Math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
} else if (B <= 1.95e+49) {
tmp = -Math.sqrt((2.0 * ((A - Math.hypot(A, B)) * (F * t_0)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - B)));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = (B * B) + (-4.0 * (A * C)) tmp = 0 if B <= 4.6e-62: tmp = -math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1 elif B <= 1.95e+49: tmp = -math.sqrt((2.0 * ((A - math.hypot(A, B)) * (F * t_0)))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - B))) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) tmp = 0.0 if (B <= 4.6e-62) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + A)))))) / t_1); elseif (B <= 1.95e+49) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A - hypot(A, B)) * Float64(F * t_0))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - B))))); end return tmp end
B = abs(B)
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 * B) + (-4.0 * (A * C));
tmp = 0.0;
if (B <= 4.6e-62)
tmp = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
elseif (B <= 1.95e+49)
tmp = -sqrt((2.0 * ((A - hypot(A, B)) * (F * t_0)))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - B)));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 4.6e-62], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 1.95e+49], N[((-N[Sqrt[N[(2.0 * N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 4.6 \cdot 10^{-62}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 1.95 \cdot 10^{+49}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(F \cdot t_0\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < 4.60000000000000001e-62Initial program 24.5%
Simplified24.5%
Taylor expanded in C around inf 13.6%
cancel-sign-sub-inv13.6%
metadata-eval13.6%
*-lft-identity13.6%
Simplified13.6%
distribute-frac-neg13.6%
associate-*l*14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
Applied egg-rr14.6%
if 4.60000000000000001e-62 < B < 1.95e49Initial program 26.7%
Simplified26.7%
Taylor expanded in C around 0 23.5%
unpow223.5%
unpow223.5%
hypot-def31.4%
Simplified31.4%
if 1.95e49 < B Initial program 12.3%
Simplified12.7%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
unsub-neg12.4%
Simplified12.4%
Taylor expanded in C around 0 39.7%
associate-*r*39.7%
neg-mul-139.7%
distribute-neg-frac39.7%
Simplified39.7%
Final simplification21.3%
NOTE: B should be positive before calling this function
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 (or (<= B 2.1e-54) (and (not (<= B 2.4e-25)) (<= B 175000.0)))
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- B))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double tmp;
if ((B <= 2.1e-54) || (!(B <= 2.4e-25) && (B <= 175000.0))) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * -B));
}
return tmp;
}
NOTE: B should be positive before calling this function
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 <= 2.1d-54) .or. (.not. (b <= 2.4d-25)) .and. (b <= 175000.0d0)) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + a))))) / t_0
else
tmp = (sqrt(2.0d0) / b) * -sqrt((f * -b))
end if
code = tmp
end function
B = Math.abs(B);
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 <= 2.1e-54) || (!(B <= 2.4e-25) && (B <= 175000.0))) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * -B));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) tmp = 0 if (B <= 2.1e-54) or (not (B <= 2.4e-25) and (B <= 175000.0)): tmp = -math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0 else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * -B)) return tmp
B = abs(B) 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 <= 2.1e-54) || (!(B <= 2.4e-25) && (B <= 175000.0))) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(-B))))); end return tmp end
B = abs(B)
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 <= 2.1e-54) || (~((B <= 2.4e-25)) && (B <= 175000.0)))
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
else
tmp = (sqrt(2.0) / B) * -sqrt((F * -B));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
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[Or[LessEqual[B, 2.1e-54], And[N[Not[LessEqual[B, 2.4e-25]], $MachinePrecision], LessEqual[B, 175000.0]]], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * (-B)), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[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 2.1 \cdot 10^{-54} \lor \neg \left(B \leq 2.4 \cdot 10^{-25}\right) \land B \leq 175000:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(-B\right)}\right)\\
\end{array}
\end{array}
if B < 2.1e-54 or 2.40000000000000009e-25 < B < 175000Initial program 24.0%
Simplified24.0%
Taylor expanded in C around inf 14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
*-lft-identity14.6%
Simplified14.6%
distribute-frac-neg14.6%
associate-*l*15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
Applied egg-rr15.6%
if 2.1e-54 < B < 2.40000000000000009e-25 or 175000 < B Initial program 17.4%
Simplified17.4%
Taylor expanded in C around 0 23.0%
mul-1-neg23.0%
*-commutative23.0%
distribute-rgt-neg-in23.0%
unpow223.0%
unpow223.0%
hypot-def39.3%
Simplified39.3%
Taylor expanded in A around 0 39.9%
associate-*r*39.9%
mul-1-neg39.9%
Simplified39.9%
Final simplification22.0%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B))
(t_1 (+ (* B B) (* -4.0 (* A C))))
(t_2 (/ (- (sqrt (* 2.0 (* t_1 (* F (+ A A)))))) t_1)))
(if (<= B 5.5e-55)
t_2
(if (<= B 2.3e-25)
(* t_0 (- (sqrt (* F (- A B)))))
(if (<= B 160000.0) t_2 (* t_0 (- (sqrt (* F (- B))))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt(2.0) / B;
double t_1 = (B * B) + (-4.0 * (A * C));
double t_2 = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
double tmp;
if (B <= 5.5e-55) {
tmp = t_2;
} else if (B <= 2.3e-25) {
tmp = t_0 * -sqrt((F * (A - B)));
} else if (B <= 160000.0) {
tmp = t_2;
} else {
tmp = t_0 * -sqrt((F * -B));
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = sqrt(2.0d0) / b
t_1 = (b * b) + ((-4.0d0) * (a * c))
t_2 = -sqrt((2.0d0 * (t_1 * (f * (a + a))))) / t_1
if (b <= 5.5d-55) then
tmp = t_2
else if (b <= 2.3d-25) then
tmp = t_0 * -sqrt((f * (a - b)))
else if (b <= 160000.0d0) then
tmp = t_2
else
tmp = t_0 * -sqrt((f * -b))
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt(2.0) / B;
double t_1 = (B * B) + (-4.0 * (A * C));
double t_2 = -Math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
double tmp;
if (B <= 5.5e-55) {
tmp = t_2;
} else if (B <= 2.3e-25) {
tmp = t_0 * -Math.sqrt((F * (A - B)));
} else if (B <= 160000.0) {
tmp = t_2;
} else {
tmp = t_0 * -Math.sqrt((F * -B));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt(2.0) / B t_1 = (B * B) + (-4.0 * (A * C)) t_2 = -math.sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1 tmp = 0 if B <= 5.5e-55: tmp = t_2 elif B <= 2.3e-25: tmp = t_0 * -math.sqrt((F * (A - B))) elif B <= 160000.0: tmp = t_2 else: tmp = t_0 * -math.sqrt((F * -B)) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(2.0) / B) t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) t_2 = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + A)))))) / t_1) tmp = 0.0 if (B <= 5.5e-55) tmp = t_2; elseif (B <= 2.3e-25) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(A - B))))); elseif (B <= 160000.0) tmp = t_2; else tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(-B))))); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt(2.0) / B;
t_1 = (B * B) + (-4.0 * (A * C));
t_2 = -sqrt((2.0 * (t_1 * (F * (A + A))))) / t_1;
tmp = 0.0;
if (B <= 5.5e-55)
tmp = t_2;
elseif (B <= 2.3e-25)
tmp = t_0 * -sqrt((F * (A - B)));
elseif (B <= 160000.0)
tmp = t_2;
else
tmp = t_0 * -sqrt((F * -B));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]}, If[LessEqual[B, 5.5e-55], t$95$2, If[LessEqual[B, 2.3e-25], N[(t$95$0 * (-N[Sqrt[N[(F * N[(A - B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[B, 160000.0], t$95$2, N[(t$95$0 * (-N[Sqrt[N[(F * (-B)), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B}\\
t_1 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_2 := \frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_1}\\
\mathbf{if}\;B \leq 5.5 \cdot 10^{-55}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;B \leq 2.3 \cdot 10^{-25}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\mathbf{elif}\;B \leq 160000:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(-\sqrt{F \cdot \left(-B\right)}\right)\\
\end{array}
\end{array}
if B < 5.4999999999999999e-55 or 2.2999999999999999e-25 < B < 1.6e5Initial program 24.0%
Simplified24.0%
Taylor expanded in C around inf 14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
*-lft-identity14.6%
Simplified14.6%
distribute-frac-neg14.6%
associate-*l*15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
Applied egg-rr15.6%
if 5.4999999999999999e-55 < B < 2.2999999999999999e-25Initial program 26.7%
Simplified31.1%
Taylor expanded in B around inf 28.0%
mul-1-neg28.0%
unsub-neg28.0%
Simplified28.0%
Taylor expanded in C around 0 25.9%
associate-*r*25.9%
neg-mul-125.9%
distribute-neg-frac25.9%
Simplified25.9%
if 1.6e5 < B Initial program 16.8%
Simplified16.8%
Taylor expanded in C around 0 22.7%
mul-1-neg22.7%
*-commutative22.7%
distribute-rgt-neg-in22.7%
unpow222.7%
unpow222.7%
hypot-def40.1%
Simplified40.1%
Taylor expanded in A around 0 40.6%
associate-*r*40.6%
mul-1-neg40.6%
Simplified40.6%
Final simplification21.9%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (or (<= B 2.1e-54) (and (not (<= B 2.2e-25)) (<= B 160000.0)))
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
(/ (- (sqrt (* 2.0 (* (* F t_1) (- (+ A C) B))))) t_1))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if ((B <= 2.1e-54) || (!(B <= 2.2e-25) && (B <= 160000.0))) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -sqrt((2.0 * ((F * t_1) * ((A + C) - B)))) / t_1;
}
return tmp;
}
NOTE: B should be positive before calling this function
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 = (b * b) - (4.0d0 * (a * c))
if ((b <= 2.1d-54) .or. (.not. (b <= 2.2d-25)) .and. (b <= 160000.0d0)) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + a))))) / t_0
else
tmp = -sqrt((2.0d0 * ((f * t_1) * ((a + c) - b)))) / t_1
end if
code = tmp
end function
B = Math.abs(B);
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 = (B * B) - (4.0 * (A * C));
double tmp;
if ((B <= 2.1e-54) || (!(B <= 2.2e-25) && (B <= 160000.0))) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * ((F * t_1) * ((A + C) - B)))) / t_1;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) t_1 = (B * B) - (4.0 * (A * C)) tmp = 0 if (B <= 2.1e-54) or (not (B <= 2.2e-25) and (B <= 160000.0)): tmp = -math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0 else: tmp = -math.sqrt((2.0 * ((F * t_1) * ((A + C) - B)))) / t_1 return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if ((B <= 2.1e-54) || (!(B <= 2.2e-25) && (B <= 160000.0))) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(Float64(A + C) - B))))) / t_1); end return tmp end
B = abs(B)
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 * B) - (4.0 * (A * C));
tmp = 0.0;
if ((B <= 2.1e-54) || (~((B <= 2.2e-25)) && (B <= 160000.0)))
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
else
tmp = -sqrt((2.0 * ((F * t_1) * ((A + C) - B)))) / t_1;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[B, 2.1e-54], And[N[Not[LessEqual[B, 2.2e-25]], $MachinePrecision], LessEqual[B, 160000.0]]], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 2.1 \cdot 10^{-54} \lor \neg \left(B \leq 2.2 \cdot 10^{-25}\right) \land B \leq 160000:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(\left(A + C\right) - B\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < 2.1e-54 or 2.2000000000000002e-25 < B < 1.6e5Initial program 24.0%
Simplified24.0%
Taylor expanded in C around inf 14.6%
cancel-sign-sub-inv14.6%
metadata-eval14.6%
*-lft-identity14.6%
Simplified14.6%
distribute-frac-neg14.6%
associate-*l*15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
cancel-sign-sub-inv15.6%
metadata-eval15.6%
Applied egg-rr15.6%
if 2.1e-54 < B < 2.2000000000000002e-25 or 1.6e5 < B Initial program 17.4%
Simplified17.4%
Taylor expanded in B around inf 18.2%
Final simplification16.3%
NOTE: B should be positive before calling this function
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 (* 4.0 (* A C))))
(if (or (<= B 7.2e-62) (and (not (<= B 5.6e-25)) (<= B 175000.0)))
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
(/ (- (sqrt (* 2.0 (* B (* F (- t_1 (* B B))))))) (- (* B B) t_1)))))B = abs(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 = 4.0 * (A * C);
double tmp;
if ((B <= 7.2e-62) || (!(B <= 5.6e-25) && (B <= 175000.0))) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / ((B * B) - t_1);
}
return tmp;
}
NOTE: B should be positive before calling this function
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 = 4.0d0 * (a * c)
if ((b <= 7.2d-62) .or. (.not. (b <= 5.6d-25)) .and. (b <= 175000.0d0)) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + a))))) / t_0
else
tmp = -sqrt((2.0d0 * (b * (f * (t_1 - (b * b)))))) / ((b * b) - t_1)
end if
code = tmp
end function
B = Math.abs(B);
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 = 4.0 * (A * C);
double tmp;
if ((B <= 7.2e-62) || (!(B <= 5.6e-25) && (B <= 175000.0))) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / ((B * B) - t_1);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (A * C)) t_1 = 4.0 * (A * C) tmp = 0 if (B <= 7.2e-62) or (not (B <= 5.6e-25) and (B <= 175000.0)): tmp = -math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0 else: tmp = -math.sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / ((B * B) - t_1) return tmp
B = abs(B) 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(4.0 * Float64(A * C)) tmp = 0.0 if ((B <= 7.2e-62) || (!(B <= 5.6e-25) && (B <= 175000.0))) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_1 - Float64(B * B))))))) / Float64(Float64(B * B) - t_1)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + (-4.0 * (A * C));
t_1 = 4.0 * (A * C);
tmp = 0.0;
if ((B <= 7.2e-62) || (~((B <= 5.6e-25)) && (B <= 175000.0)))
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
else
tmp = -sqrt((2.0 * (B * (F * (t_1 - (B * B)))))) / ((B * B) - t_1);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
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[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[B, 7.2e-62], And[N[Not[LessEqual[B, 5.6e-25]], $MachinePrecision], LessEqual[B, 175000.0]]], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$1 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_1 := 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 7.2 \cdot 10^{-62} \lor \neg \left(B \leq 5.6 \cdot 10^{-25}\right) \land B \leq 175000:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_1 - B \cdot B\right)\right)\right)}}{B \cdot B - t_1}\\
\end{array}
\end{array}
if B < 7.1999999999999999e-62 or 5.59999999999999976e-25 < B < 175000Initial program 24.1%
Simplified24.1%
Taylor expanded in C around inf 14.7%
cancel-sign-sub-inv14.7%
metadata-eval14.7%
*-lft-identity14.7%
Simplified14.7%
distribute-frac-neg14.7%
associate-*l*15.7%
cancel-sign-sub-inv15.7%
metadata-eval15.7%
cancel-sign-sub-inv15.7%
metadata-eval15.7%
Applied egg-rr15.7%
if 7.1999999999999999e-62 < B < 5.59999999999999976e-25 or 175000 < B Initial program 17.2%
Simplified17.2%
Taylor expanded in A around 0 17.5%
+-commutative17.5%
unpow217.5%
unpow217.5%
hypot-def19.0%
Simplified19.0%
Taylor expanded in C around 0 17.6%
mul-1-neg17.6%
Simplified17.6%
Final simplification16.2%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C)))
(t_1 (- (* B B) t_0))
(t_2 (+ (* B B) (* -4.0 (* A C))))
(t_3 (/ (- (sqrt (* 2.0 (* t_2 (* F (+ A A)))))) t_2)))
(if (<= B 1.1e-48)
t_3
(if (<= B 2.55e-25)
(/ (- (sqrt (* 2.0 (* (* F t_1) (- C B))))) t_1)
(if (<= B 175000.0)
t_3
(/ (- (sqrt (* 2.0 (* B (* F (- t_0 (* B B))))))) t_1))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = (B * B) + (-4.0 * (A * C));
double t_3 = -sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
double tmp;
if (B <= 1.1e-48) {
tmp = t_3;
} else if (B <= 2.55e-25) {
tmp = -sqrt((2.0 * ((F * t_1) * (C - B)))) / t_1;
} else if (B <= 175000.0) {
tmp = t_3;
} else {
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_0 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
t_2 = (b * b) + ((-4.0d0) * (a * c))
t_3 = -sqrt((2.0d0 * (t_2 * (f * (a + a))))) / t_2
if (b <= 1.1d-48) then
tmp = t_3
else if (b <= 2.55d-25) then
tmp = -sqrt((2.0d0 * ((f * t_1) * (c - b)))) / t_1
else if (b <= 175000.0d0) then
tmp = t_3
else
tmp = -sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double t_2 = (B * B) + (-4.0 * (A * C));
double t_3 = -Math.sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
double tmp;
if (B <= 1.1e-48) {
tmp = t_3;
} else if (B <= 2.55e-25) {
tmp = -Math.sqrt((2.0 * ((F * t_1) * (C - B)))) / t_1;
} else if (B <= 175000.0) {
tmp = t_3;
} else {
tmp = -Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 t_2 = (B * B) + (-4.0 * (A * C)) t_3 = -math.sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2 tmp = 0 if B <= 1.1e-48: tmp = t_3 elif B <= 2.55e-25: tmp = -math.sqrt((2.0 * ((F * t_1) * (C - B)))) / t_1 elif B <= 175000.0: tmp = t_3 else: tmp = -math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1 return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) t_2 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) t_3 = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_2 * Float64(F * Float64(A + A)))))) / t_2) tmp = 0.0 if (B <= 1.1e-48) tmp = t_3; elseif (B <= 2.55e-25) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_1) * Float64(C - B))))) / t_1); elseif (B <= 175000.0) tmp = t_3; else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
t_2 = (B * B) + (-4.0 * (A * C));
t_3 = -sqrt((2.0 * (t_2 * (F * (A + A))))) / t_2;
tmp = 0.0;
if (B <= 1.1e-48)
tmp = t_3;
elseif (B <= 2.55e-25)
tmp = -sqrt((2.0 * ((F * t_1) * (C - B)))) / t_1;
elseif (B <= 175000.0)
tmp = t_3;
else
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(2.0 * N[(t$95$2 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[B, 1.1e-48], t$95$3, If[LessEqual[B, 2.55e-25], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$1), $MachinePrecision] * N[(C - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 175000.0], t$95$3, N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
t_2 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_3 := \frac{-\sqrt{2 \cdot \left(t_2 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_2}\\
\mathbf{if}\;B \leq 1.1 \cdot 10^{-48}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;B \leq 2.55 \cdot 10^{-25}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_1\right) \cdot \left(C - B\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 175000:\\
\;\;\;\;t_3\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < 1.10000000000000006e-48 or 2.5500000000000001e-25 < B < 175000Initial program 23.9%
Simplified23.9%
Taylor expanded in C around inf 14.5%
cancel-sign-sub-inv14.5%
metadata-eval14.5%
*-lft-identity14.5%
Simplified14.5%
distribute-frac-neg14.5%
associate-*l*15.5%
cancel-sign-sub-inv15.5%
metadata-eval15.5%
cancel-sign-sub-inv15.5%
metadata-eval15.5%
Applied egg-rr15.5%
if 1.10000000000000006e-48 < B < 2.5500000000000001e-25Initial program 34.2%
Simplified34.2%
Taylor expanded in A around 0 34.2%
+-commutative34.2%
unpow234.2%
unpow234.2%
hypot-def34.2%
Simplified34.2%
Taylor expanded in C around 0 35.9%
mul-1-neg35.9%
sub-neg35.9%
Simplified35.9%
if 175000 < B Initial program 16.8%
Simplified16.8%
Taylor expanded in A around 0 17.1%
+-commutative17.1%
unpow217.1%
unpow217.1%
hypot-def18.7%
Simplified18.7%
Taylor expanded in C around 0 17.3%
mul-1-neg17.3%
Simplified17.3%
Final simplification16.2%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))) (t_1 (- (* B B) t_0)))
(if (<= B 9.8e-64)
(- (/ (sqrt (* 2.0 (* (+ A A) (* -4.0 (* A (* C F)))))) t_1))
(/ (- (sqrt (* 2.0 (* B (* F (- t_0 (* B B))))))) t_1))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= 9.8e-64) {
tmp = -(sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / t_1);
} else {
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = 4.0d0 * (a * c)
t_1 = (b * b) - t_0
if (b <= 9.8d-64) then
tmp = -(sqrt((2.0d0 * ((a + a) * ((-4.0d0) * (a * (c * f)))))) / t_1)
else
tmp = -sqrt((2.0d0 * (b * (f * (t_0 - (b * b)))))) / t_1
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = (B * B) - t_0;
double tmp;
if (B <= 9.8e-64) {
tmp = -(Math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / t_1);
} else {
tmp = -Math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = 4.0 * (A * C) t_1 = (B * B) - t_0 tmp = 0 if B <= 9.8e-64: tmp = -(math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / t_1) else: tmp = -math.sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1 return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = Float64(Float64(B * B) - t_0) tmp = 0.0 if (B <= 9.8e-64) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(-4.0 * Float64(A * Float64(C * F)))))) / t_1)); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(B * Float64(F * Float64(t_0 - Float64(B * B))))))) / t_1); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = 4.0 * (A * C);
t_1 = (B * B) - t_0;
tmp = 0.0;
if (B <= 9.8e-64)
tmp = -(sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / t_1);
else
tmp = -sqrt((2.0 * (B * (F * (t_0 - (B * B)))))) / t_1;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[B, 9.8e-64], (-N[(N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), N[((-N[Sqrt[N[(2.0 * N[(B * N[(F * N[(t$95$0 - N[(B * B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - t_0\\
\mathbf{if}\;B \leq 9.8 \cdot 10^{-64}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(B \cdot \left(F \cdot \left(t_0 - B \cdot B\right)\right)\right)}}{t_1}\\
\end{array}
\end{array}
if B < 9.8000000000000003e-64Initial program 24.8%
Simplified24.8%
Taylor expanded in C around inf 13.7%
cancel-sign-sub-inv13.7%
metadata-eval13.7%
*-lft-identity13.7%
Simplified13.7%
Taylor expanded in B around 0 11.3%
if 9.8000000000000003e-64 < B Initial program 16.5%
Simplified16.5%
Taylor expanded in A around 0 16.7%
+-commutative16.7%
unpow216.7%
unpow216.7%
hypot-def18.1%
Simplified18.1%
Taylor expanded in C around 0 15.7%
mul-1-neg15.7%
Simplified15.7%
Final simplification12.6%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (- (/ (sqrt (* 2.0 (* (+ A A) (* -4.0 (* A (* C F)))))) (- (* B B) (* 4.0 (* A C))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return -(sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))));
}
NOTE: B should be positive before calling this function
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((2.0d0 * ((a + a) * ((-4.0d0) * (a * (c * f)))))) / ((b * b) - (4.0d0 * (a * c))))
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return -(Math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))));
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return -(math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))))
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(-4.0 * Float64(A * Float64(C * F)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -(sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))));
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := (-N[(N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-\frac{\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\end{array}
Initial program 22.3%
Simplified22.3%
Taylor expanded in C around inf 12.3%
cancel-sign-sub-inv12.3%
metadata-eval12.3%
*-lft-identity12.3%
Simplified12.3%
Taylor expanded in B around 0 10.5%
Final simplification10.5%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (- (/ (sqrt (* 2.0 (* -8.0 (* (* C F) (* A A))))) (- (* B B) (* 4.0 (* A C))))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return -(sqrt((2.0 * (-8.0 * ((C * F) * (A * A))))) / ((B * B) - (4.0 * (A * C))));
}
NOTE: B should be positive before calling this function
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((2.0d0 * ((-8.0d0) * ((c * f) * (a * a))))) / ((b * b) - (4.0d0 * (a * c))))
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return -(Math.sqrt((2.0 * (-8.0 * ((C * F) * (A * A))))) / ((B * B) - (4.0 * (A * C))));
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return -(math.sqrt((2.0 * (-8.0 * ((C * F) * (A * A))))) / ((B * B) - (4.0 * (A * C))))
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(-Float64(sqrt(Float64(2.0 * Float64(-8.0 * Float64(Float64(C * F) * Float64(A * A))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))))) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -(sqrt((2.0 * (-8.0 * ((C * F) * (A * A))))) / ((B * B) - (4.0 * (A * C))));
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := (-N[(N[Sqrt[N[(2.0 * N[(-8.0 * N[(N[(C * F), $MachinePrecision] * N[(A * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-\frac{\sqrt{2 \cdot \left(-8 \cdot \left(\left(C \cdot F\right) \cdot \left(A \cdot A\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}
\end{array}
Initial program 22.3%
Simplified22.3%
Taylor expanded in C around inf 12.3%
cancel-sign-sub-inv12.3%
metadata-eval12.3%
*-lft-identity12.3%
Simplified12.3%
Taylor expanded in B around 0 9.1%
unpow29.1%
Simplified9.1%
Final simplification9.1%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (* (sqrt (* A F)) (/ 1.0 B))))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((A * F)) * (1.0 / B));
}
NOTE: B should be positive before calling this function
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((a * f)) * (1.0d0 / b))
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((A * F)) * (1.0 / B));
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.sqrt((A * F)) * (1.0 / B))
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (sqrt((A * F)) * (1.0 / B));
end
NOTE: B should be positive before calling this function 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[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)
\end{array}
Initial program 22.3%
Simplified22.3%
Taylor expanded in C around inf 12.3%
cancel-sign-sub-inv12.3%
metadata-eval12.3%
*-lft-identity12.3%
Simplified12.3%
Taylor expanded in B around inf 1.4%
Final simplification1.4%
herbie shell --seed 2023271
(FPCore (A B C F)
:name "ABCF->ab-angle b"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))