
(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 17 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 (fma B B (* A (* C -4.0))))
(t_1 (sqrt (+ C (+ A (hypot B (- A C))))))
(t_2 (- (* B B) (* 4.0 (* A C)))))
(if (<= A -2.25e+23)
(/
(- (sqrt (* (* 2.0 (* t_2 F)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_2)
(if (<= A 1.4e-304)
(/ (* (* (sqrt 2.0) (* (sqrt F) (sqrt t_0))) (- t_1)) t_2)
(/ (- (sqrt (* 2.0 (* F t_0)))) (/ (fma B B (* -4.0 (* A C))) t_1))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = sqrt((C + (A + hypot(B, (A - C)))));
double t_2 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= -2.25e+23) {
tmp = -sqrt(((2.0 * (t_2 * F)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_2;
} else if (A <= 1.4e-304) {
tmp = ((sqrt(2.0) * (sqrt(F) * sqrt(t_0))) * -t_1) / t_2;
} else {
tmp = -sqrt((2.0 * (F * t_0))) / (fma(B, B, (-4.0 * (A * C))) / t_1);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) t_2 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (A <= -2.25e+23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_2); elseif (A <= 1.4e-304) tmp = Float64(Float64(Float64(sqrt(2.0) * Float64(sqrt(F) * sqrt(t_0))) * Float64(-t_1)) / t_2); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * t_0)))) / Float64(fma(B, B, Float64(-4.0 * Float64(A * C))) / t_1)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -2.25e+23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[A, 1.4e-304], N[(N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-t$95$1)), $MachinePrecision] / t$95$2), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}\\
t_2 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq -2.25 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_2 \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_2}\\
\mathbf{elif}\;A \leq 1.4 \cdot 10^{-304}:\\
\;\;\;\;\frac{\left(\sqrt{2} \cdot \left(\sqrt{F} \cdot \sqrt{t_0}\right)\right) \cdot \left(-t_1\right)}{t_2}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot t_0\right)}}{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}{t_1}}\\
\end{array}
\end{array}
if A < -2.2499999999999999e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -2.2499999999999999e23 < A < 1.3999999999999999e-304Initial program 34.3%
associate-*l*34.3%
unpow234.3%
+-commutative34.3%
unpow234.3%
associate-*l*34.3%
unpow234.3%
Simplified34.3%
sqrt-prod36.2%
*-commutative36.2%
cancel-sign-sub-inv36.2%
metadata-eval36.2%
*-commutative36.2%
associate-+l+36.1%
unpow236.1%
hypot-udef47.8%
associate-+r+48.0%
+-commutative48.0%
Applied egg-rr48.3%
sqrt-prod48.3%
fma-def48.3%
associate-*r*48.3%
*-commutative48.3%
Applied egg-rr48.3%
sqrt-prod56.5%
Applied egg-rr56.5%
*-commutative56.5%
Simplified56.5%
if 1.3999999999999999e-304 < A Initial program 29.8%
associate-*l*29.8%
unpow229.8%
+-commutative29.8%
unpow229.8%
associate-*l*29.8%
unpow229.8%
Simplified29.8%
sqrt-prod31.8%
*-commutative31.8%
cancel-sign-sub-inv31.8%
metadata-eval31.8%
*-commutative31.8%
associate-+l+32.1%
unpow232.1%
hypot-udef45.4%
associate-+r+44.5%
+-commutative44.5%
Applied egg-rr44.5%
sqrt-prod44.5%
fma-def44.5%
associate-*r*44.5%
*-commutative44.5%
Applied egg-rr44.5%
div-inv44.4%
distribute-lft-neg-in44.4%
sqrt-unprod44.4%
cancel-sign-sub-inv44.4%
metadata-eval44.4%
Applied egg-rr44.4%
associate-*r/44.5%
*-rgt-identity44.5%
associate-/l*44.5%
*-commutative44.5%
fma-def44.5%
*-commutative44.5%
*-commutative44.5%
Simplified44.5%
Final simplification46.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 (fma B B (* A (* C -4.0)))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= A -1.55e+23)
(/
(- (sqrt (* (* 2.0 (* t_1 F)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_1)
(*
(sqrt (+ C (+ A (hypot B (- A C)))))
(/ (- (sqrt (* 2.0 (* F t_0)))) t_0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = fma(B, B, (A * (C * -4.0)));
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= -1.55e+23) {
tmp = -sqrt(((2.0 * (t_1 * F)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_1;
} else {
tmp = sqrt((C + (A + hypot(B, (A - C))))) * (-sqrt((2.0 * (F * t_0))) / t_0);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = fma(B, B, Float64(A * Float64(C * -4.0))) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (A <= -1.55e+23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_1); else tmp = Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(Float64(-sqrt(Float64(2.0 * Float64(F * t_0)))) / t_0)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.55e+23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[N[(2.0 * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \frac{-\sqrt{2 \cdot \left(F \cdot t_0\right)}}{t_0}\\
\end{array}
\end{array}
if A < -1.54999999999999985e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -1.54999999999999985e23 < A Initial program 31.3%
associate-*l*31.3%
unpow231.3%
+-commutative31.3%
unpow231.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
sqrt-prod33.2%
*-commutative33.2%
cancel-sign-sub-inv33.2%
metadata-eval33.2%
*-commutative33.2%
associate-+l+33.4%
unpow233.4%
hypot-udef46.2%
associate-+r+45.6%
+-commutative45.6%
Applied egg-rr45.7%
sqrt-prod45.7%
fma-def45.7%
associate-*r*45.7%
*-commutative45.7%
Applied egg-rr45.7%
div-inv45.7%
distribute-lft-neg-in45.7%
sqrt-unprod45.6%
cancel-sign-sub-inv45.6%
metadata-eval45.6%
Applied egg-rr45.6%
associate-*r/45.7%
*-rgt-identity45.7%
associate-/l*45.8%
*-commutative45.8%
fma-def45.8%
*-commutative45.8%
*-commutative45.8%
Simplified45.8%
associate-/r/45.8%
*-commutative45.8%
associate-*r*45.8%
Applied egg-rr45.8%
Final simplification44.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 (<= A -1.38e+23)
(/
(- (sqrt (* (* 2.0 (* t_0 F)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_0)
(/
(- (sqrt (* 2.0 (* F (fma B B (* A (* C -4.0)))))))
(/ (fma B B (* -4.0 (* A C))) (sqrt (+ C (+ A (hypot B (- A C))))))))))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 (A <= -1.38e+23) {
tmp = -sqrt(((2.0 * (t_0 * F)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else {
tmp = -sqrt((2.0 * (F * fma(B, B, (A * (C * -4.0)))))) / (fma(B, B, (-4.0 * (A * C))) / sqrt((C + (A + hypot(B, (A - C))))));
}
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 (A <= -1.38e+23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(F * fma(B, B, Float64(A * Float64(C * -4.0))))))) / Float64(fma(B, B, Float64(-4.0 * Float64(A * C))) / sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))))); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.38e+23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(F * N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $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)\\
\mathbf{if}\;A \leq -1.38 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(F \cdot \mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)\right)}}{\frac{\mathsf{fma}\left(B, B, -4 \cdot \left(A \cdot C\right)\right)}{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)}}}\\
\end{array}
\end{array}
if A < -1.38e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -1.38e23 < A Initial program 31.3%
associate-*l*31.3%
unpow231.3%
+-commutative31.3%
unpow231.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
sqrt-prod33.2%
*-commutative33.2%
cancel-sign-sub-inv33.2%
metadata-eval33.2%
*-commutative33.2%
associate-+l+33.4%
unpow233.4%
hypot-udef46.2%
associate-+r+45.6%
+-commutative45.6%
Applied egg-rr45.7%
sqrt-prod45.7%
fma-def45.7%
associate-*r*45.7%
*-commutative45.7%
Applied egg-rr45.7%
div-inv45.7%
distribute-lft-neg-in45.7%
sqrt-unprod45.6%
cancel-sign-sub-inv45.6%
metadata-eval45.6%
Applied egg-rr45.6%
associate-*r/45.7%
*-rgt-identity45.7%
associate-/l*45.8%
*-commutative45.8%
fma-def45.8%
*-commutative45.8%
*-commutative45.8%
Simplified45.8%
Final simplification44.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 (<= A -1.6e+23)
(/
(- (sqrt (* (* 2.0 (* t_0 F)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_0)
(/
(*
(sqrt (+ C (+ A (hypot B (- A C)))))
(- (sqrt (* 2.0 (* F (+ (* B B) (* -4.0 (* A C))))))))
t_0))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= -1.6e+23) {
tmp = -sqrt(((2.0 * (t_0 * F)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else {
tmp = (sqrt((C + (A + hypot(B, (A - C))))) * -sqrt((2.0 * (F * ((B * B) + (-4.0 * (A * C))))))) / t_0;
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (A <= -1.6e+23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(C + Float64(A + hypot(B, Float64(A - C))))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C)))))))) / t_0); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.6e+23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq -1.6 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(B \cdot B + -4 \cdot \left(A \cdot C\right)\right)\right)}\right)}{t_0}\\
\end{array}
\end{array}
if A < -1.6e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -1.6e23 < A Initial program 31.3%
associate-*l*31.3%
unpow231.3%
+-commutative31.3%
unpow231.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
sqrt-prod33.2%
*-commutative33.2%
cancel-sign-sub-inv33.2%
metadata-eval33.2%
*-commutative33.2%
associate-+l+33.4%
unpow233.4%
hypot-udef46.2%
associate-+r+45.6%
+-commutative45.6%
Applied egg-rr45.7%
Final simplification44.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 (* 2.0 (* t_0 F))))
(if (<= A -1.55e+23)
(/ (- (sqrt (* t_1 (fma 2.0 C (* -0.5 (/ (* B B) A)))))) t_0)
(/ (- (sqrt (* t_1 (+ C (hypot C B))))) t_0))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = 2.0 * (t_0 * F);
double tmp;
if (A <= -1.55e+23) {
tmp = -sqrt((t_1 * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_0;
} else {
tmp = -sqrt((t_1 * (C + hypot(C, B)))) / 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(2.0 * Float64(t_0 * F)) tmp = 0.0 if (A <= -1.55e+23) tmp = Float64(Float64(-sqrt(Float64(t_1 * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(C, B))))) / t_0); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[A, -1.55e+23], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(t_0 \cdot F\right)\\
\mathbf{if}\;A \leq -1.55 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}}{t_0}\\
\end{array}
\end{array}
if A < -1.54999999999999985e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -1.54999999999999985e23 < A Initial program 31.3%
associate-*l*31.3%
unpow231.3%
+-commutative31.3%
unpow231.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
Taylor expanded in A around 0 25.2%
+-commutative25.2%
unpow225.2%
unpow225.2%
hypot-def30.0%
Simplified30.0%
Final simplification32.6%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* -4.0 (* A C)))) (t_1 (- (* B B) (* 4.0 (* A C)))))
(if (<= A -2.25e+23)
(/
(- (sqrt (* (* 2.0 (* t_1 F)) (fma 2.0 C (* -0.5 (/ (* B B) A))))))
t_1)
(*
(sqrt (* 2.0 (* (+ C (+ A (hypot B (- A C)))) (* F t_0))))
(/ -1.0 t_0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (A * C));
double t_1 = (B * B) - (4.0 * (A * C));
double tmp;
if (A <= -2.25e+23) {
tmp = -sqrt(((2.0 * (t_1 * F)) * fma(2.0, C, (-0.5 * ((B * B) / A))))) / t_1;
} else {
tmp = sqrt((2.0 * ((C + (A + hypot(B, (A - C)))) * (F * t_0)))) * (-1.0 / t_0);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(A * C))) t_1 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (A <= -2.25e+23) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * fma(2.0, C, Float64(-0.5 * Float64(Float64(B * B) / A)))))) / t_1); else tmp = Float64(sqrt(Float64(2.0 * Float64(Float64(C + Float64(A + hypot(B, Float64(A - C)))) * Float64(F * t_0)))) * Float64(-1.0 / t_0)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(-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[A, -2.25e+23], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C + N[(-0.5 * N[(N[(B * B), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(N[(C + N[(A + N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + -4 \cdot \left(A \cdot C\right)\\
t_1 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;A \leq -2.25 \cdot 10^{+23}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \mathsf{fma}\left(2, C, -0.5 \cdot \frac{B \cdot B}{A}\right)}}{t_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2 \cdot \left(\left(C + \left(A + \mathsf{hypot}\left(B, A - C\right)\right)\right) \cdot \left(F \cdot t_0\right)\right)} \cdot \frac{-1}{t_0}\\
\end{array}
\end{array}
if A < -2.2499999999999999e23Initial program 1.6%
associate-*l*1.6%
unpow21.6%
+-commutative1.6%
unpow21.6%
associate-*l*1.6%
unpow21.6%
Simplified1.6%
Taylor expanded in A around -inf 41.7%
fma-def41.7%
unpow241.7%
Simplified41.7%
if -2.2499999999999999e23 < A Initial program 31.3%
associate-*l*31.3%
unpow231.3%
+-commutative31.3%
unpow231.3%
associate-*l*31.3%
unpow231.3%
Simplified31.3%
div-inv31.2%
Applied egg-rr37.5%
Final simplification38.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 (* 2.0 (* t_0 F))))
(if (<= C -5.8e-180)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0)))))))) t_0)
(if (<= C 1.45e+87)
(/ (- (sqrt (* t_1 (+ C (hypot C B))))) t_0)
(/ (* (sqrt t_1) (- (sqrt (* 2.0 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 = 2.0 * (t_0 * F);
double tmp;
if (C <= -5.8e-180) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (C <= 1.45e+87) {
tmp = -sqrt((t_1 * (C + hypot(C, B)))) / t_0;
} else {
tmp = (sqrt(t_1) * -sqrt((2.0 * C))) / t_0;
}
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 * (t_0 * F);
double tmp;
if (C <= -5.8e-180) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (C <= 1.45e+87) {
tmp = -Math.sqrt((t_1 * (C + Math.hypot(C, B)))) / t_0;
} else {
tmp = (Math.sqrt(t_1) * -Math.sqrt((2.0 * 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 = 2.0 * (t_0 * F) tmp = 0 if C <= -5.8e-180: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0 elif C <= 1.45e+87: tmp = -math.sqrt((t_1 * (C + math.hypot(C, B)))) / t_0 else: tmp = (math.sqrt(t_1) * -math.sqrt((2.0 * 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(2.0 * Float64(t_0 * F)) tmp = 0.0 if (C <= -5.8e-180) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / t_0); elseif (C <= 1.45e+87) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(C + hypot(C, B))))) / t_0); else tmp = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(2.0 * 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 = 2.0 * (t_0 * F);
tmp = 0.0;
if (C <= -5.8e-180)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
elseif (C <= 1.45e+87)
tmp = -sqrt((t_1 * (C + hypot(C, B)))) / t_0;
else
tmp = (sqrt(t_1) * -sqrt((2.0 * 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[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -5.8e-180], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 1.45e+87], N[((-N[Sqrt[N[(t$95$1 * N[(C + N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(t_0 \cdot F\right)\\
\mathbf{if}\;C \leq -5.8 \cdot 10^{-180}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 1.45 \cdot 10^{+87}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(C + \mathsf{hypot}\left(C, B\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{t_1} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\end{array}
\end{array}
if C < -5.79999999999999961e-180Initial 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 7.8%
Taylor expanded in F around 0 7.8%
cancel-sign-sub-inv7.8%
metadata-eval7.8%
unpow27.8%
associate-*r*7.8%
Simplified7.8%
if -5.79999999999999961e-180 < C < 1.4499999999999999e87Initial program 35.5%
associate-*l*35.5%
unpow235.5%
+-commutative35.5%
unpow235.5%
associate-*l*35.5%
unpow235.5%
Simplified35.5%
Taylor expanded in A around 0 33.1%
+-commutative33.1%
unpow233.1%
unpow233.1%
hypot-def33.6%
Simplified33.6%
if 1.4499999999999999e87 < C Initial program 6.6%
associate-*l*6.6%
unpow26.6%
+-commutative6.6%
unpow26.6%
associate-*l*6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in A around -inf 26.1%
sqrt-prod45.4%
*-commutative45.4%
cancel-sign-sub-inv45.4%
metadata-eval45.4%
*-commutative45.4%
fma-def45.4%
associate-*r*45.4%
*-commutative45.4%
Applied egg-rr45.4%
fma-udef45.4%
*-commutative45.4%
associate-*r*45.4%
*-commutative45.4%
metadata-eval45.4%
cancel-sign-sub-inv45.4%
Applied egg-rr45.4%
Final simplification26.9%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* 2.0 (* t_0 F))))
(if (<= C -1.7e-184)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0)))))))) t_0)
(if (<= C 3.5e-172)
(/ (- (sqrt (* t_1 (+ A (+ B C))))) t_0)
(/ (* (sqrt t_1) (- (sqrt (* 2.0 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 = 2.0 * (t_0 * F);
double tmp;
if (C <= -1.7e-184) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (C <= 3.5e-172) {
tmp = -sqrt((t_1 * (A + (B + C)))) / t_0;
} else {
tmp = (sqrt(t_1) * -sqrt((2.0 * 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 = 2.0d0 * (t_0 * f)
if (c <= (-1.7d-184)) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + (c * (a * (-4.0d0)))))))) / t_0
else if (c <= 3.5d-172) then
tmp = -sqrt((t_1 * (a + (b + c)))) / t_0
else
tmp = (sqrt(t_1) * -sqrt((2.0d0 * 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 = 2.0 * (t_0 * F);
double tmp;
if (C <= -1.7e-184) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (C <= 3.5e-172) {
tmp = -Math.sqrt((t_1 * (A + (B + C)))) / t_0;
} else {
tmp = (Math.sqrt(t_1) * -Math.sqrt((2.0 * 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 = 2.0 * (t_0 * F) tmp = 0 if C <= -1.7e-184: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0 elif C <= 3.5e-172: tmp = -math.sqrt((t_1 * (A + (B + C)))) / t_0 else: tmp = (math.sqrt(t_1) * -math.sqrt((2.0 * 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(2.0 * Float64(t_0 * F)) tmp = 0.0 if (C <= -1.7e-184) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / t_0); elseif (C <= 3.5e-172) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + Float64(B + C))))) / t_0); else tmp = Float64(Float64(sqrt(t_1) * Float64(-sqrt(Float64(2.0 * 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 = 2.0 * (t_0 * F);
tmp = 0.0;
if (C <= -1.7e-184)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
elseif (C <= 3.5e-172)
tmp = -sqrt((t_1 * (A + (B + C)))) / t_0;
else
tmp = (sqrt(t_1) * -sqrt((2.0 * 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[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[C, -1.7e-184], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 3.5e-172], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[t$95$1], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := 2 \cdot \left(t_0 \cdot F\right)\\
\mathbf{if}\;C \leq -1.7 \cdot 10^{-184}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 3.5 \cdot 10^{-172}:\\
\;\;\;\;\frac{-\sqrt{t_1 \cdot \left(A + \left(B + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{t_1} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\end{array}
\end{array}
if C < -1.70000000000000002e-184Initial 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 7.8%
Taylor expanded in F around 0 7.8%
cancel-sign-sub-inv7.8%
metadata-eval7.8%
unpow27.8%
associate-*r*7.8%
Simplified7.8%
if -1.70000000000000002e-184 < C < 3.50000000000000029e-172Initial program 38.7%
associate-*l*38.7%
unpow238.7%
+-commutative38.7%
unpow238.7%
associate-*l*38.7%
unpow238.7%
Simplified38.7%
Taylor expanded in B around inf 21.3%
if 3.50000000000000029e-172 < C 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 31.0%
sqrt-prod39.4%
*-commutative39.4%
cancel-sign-sub-inv39.4%
metadata-eval39.4%
*-commutative39.4%
fma-def39.4%
associate-*r*39.4%
*-commutative39.4%
Applied egg-rr39.4%
fma-udef39.4%
*-commutative39.4%
associate-*r*39.4%
*-commutative39.4%
metadata-eval39.4%
cancel-sign-sub-inv39.4%
Applied egg-rr39.4%
Final simplification23.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
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0)))))))) t_0)))
(if (<= C -1.7e-182)
t_1
(if (<= C 3.5e-171)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (+ A (+ B C))))) t_0)
(if (<= C 6.6e+87)
t_1
(/
(* (sqrt (* 2.0 (* F (* A (* C -4.0))))) (- (sqrt (* 2.0 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 = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
double tmp;
if (C <= -1.7e-182) {
tmp = t_1;
} else if (C <= 3.5e-171) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else if (C <= 6.6e+87) {
tmp = t_1;
} else {
tmp = (sqrt((2.0 * (F * (A * (C * -4.0))))) * -sqrt((2.0 * 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 = -sqrt((4.0d0 * (c * (f * ((b * b) + (c * (a * (-4.0d0)))))))) / t_0
if (c <= (-1.7d-182)) then
tmp = t_1
else if (c <= 3.5d-171) then
tmp = -sqrt(((2.0d0 * (t_0 * f)) * (a + (b + c)))) / t_0
else if (c <= 6.6d+87) then
tmp = t_1
else
tmp = (sqrt((2.0d0 * (f * (a * (c * (-4.0d0)))))) * -sqrt((2.0d0 * 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 = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
double tmp;
if (C <= -1.7e-182) {
tmp = t_1;
} else if (C <= 3.5e-171) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else if (C <= 6.6e+87) {
tmp = t_1;
} else {
tmp = (Math.sqrt((2.0 * (F * (A * (C * -4.0))))) * -Math.sqrt((2.0 * 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 = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0 tmp = 0 if C <= -1.7e-182: tmp = t_1 elif C <= 3.5e-171: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0 elif C <= 6.6e+87: tmp = t_1 else: tmp = (math.sqrt((2.0 * (F * (A * (C * -4.0))))) * -math.sqrt((2.0 * 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(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / t_0) tmp = 0.0 if (C <= -1.7e-182) tmp = t_1; elseif (C <= 3.5e-171) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(A + Float64(B + C))))) / t_0); elseif (C <= 6.6e+87) tmp = t_1; else tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * Float64(A * Float64(C * -4.0))))) * Float64(-sqrt(Float64(2.0 * 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 = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
tmp = 0.0;
if (C <= -1.7e-182)
tmp = t_1;
elseif (C <= 3.5e-171)
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
elseif (C <= 6.6e+87)
tmp = t_1;
else
tmp = (sqrt((2.0 * (F * (A * (C * -4.0))))) * -sqrt((2.0 * 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[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, If[LessEqual[C, -1.7e-182], t$95$1, If[LessEqual[C, 3.5e-171], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[C, 6.6e+87], t$95$1, N[(N[(N[Sqrt[N[(2.0 * N[(F * N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := \frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{t_0}\\
\mathbf{if}\;C \leq -1.7 \cdot 10^{-182}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;C \leq 3.5 \cdot 10^{-171}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(A + \left(B + C\right)\right)}}{t_0}\\
\mathbf{elif}\;C \leq 6.6 \cdot 10^{+87}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A \cdot \left(C \cdot -4\right)\right)\right)} \cdot \left(-\sqrt{2 \cdot C}\right)}{t_0}\\
\end{array}
\end{array}
if C < -1.69999999999999995e-182 or 3.49999999999999994e-171 < C < 6.6000000000000003e87Initial program 23.8%
associate-*l*23.8%
unpow223.8%
+-commutative23.8%
unpow223.8%
associate-*l*23.8%
unpow223.8%
Simplified23.8%
Taylor expanded in A around -inf 18.5%
Taylor expanded in F around 0 18.5%
cancel-sign-sub-inv18.5%
metadata-eval18.5%
unpow218.5%
associate-*r*18.5%
Simplified18.5%
if -1.69999999999999995e-182 < C < 3.49999999999999994e-171Initial program 38.7%
associate-*l*38.7%
unpow238.7%
+-commutative38.7%
unpow238.7%
associate-*l*38.7%
unpow238.7%
Simplified38.7%
Taylor expanded in B around inf 21.3%
if 6.6000000000000003e87 < C Initial program 6.6%
associate-*l*6.6%
unpow26.6%
+-commutative6.6%
unpow26.6%
associate-*l*6.6%
unpow26.6%
Simplified6.6%
Taylor expanded in A around -inf 26.1%
sqrt-prod45.4%
*-commutative45.4%
cancel-sign-sub-inv45.4%
metadata-eval45.4%
*-commutative45.4%
fma-def45.4%
associate-*r*45.4%
*-commutative45.4%
Applied egg-rr45.4%
Taylor expanded in B around 0 40.9%
*-commutative40.9%
associate-*r*40.9%
Simplified40.9%
Final simplification23.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 13600.0)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0)))))))) t_0)
(if (<= B 1.42e+107)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (+ A (+ B C))))) t_0)
(* -2.0 (* (* (sqrt F) (sqrt C)) (/ 1.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 tmp;
if (B <= 13600.0) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (B <= 1.42e+107) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else {
tmp = -2.0 * ((sqrt(F) * sqrt(C)) * (1.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 = (b * b) - (4.0d0 * (a * c))
if (b <= 13600.0d0) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + (c * (a * (-4.0d0)))))))) / t_0
else if (b <= 1.42d+107) then
tmp = -sqrt(((2.0d0 * (t_0 * f)) * (a + (b + c)))) / t_0
else
tmp = (-2.0d0) * ((sqrt(f) * sqrt(c)) * (1.0d0 / b))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 13600.0) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (B <= 1.42e+107) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else {
tmp = -2.0 * ((Math.sqrt(F) * Math.sqrt(C)) * (1.0 / B));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 13600.0: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0 elif B <= 1.42e+107: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0 else: tmp = -2.0 * ((math.sqrt(F) * math.sqrt(C)) * (1.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))) tmp = 0.0 if (B <= 13600.0) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / t_0); elseif (B <= 1.42e+107) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(A + Float64(B + C))))) / t_0); else tmp = Float64(-2.0 * Float64(Float64(sqrt(F) * sqrt(C)) * Float64(1.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));
tmp = 0.0;
if (B <= 13600.0)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
elseif (B <= 1.42e+107)
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
else
tmp = -2.0 * ((sqrt(F) * sqrt(C)) * (1.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]}, If[LessEqual[B, 13600.0], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.42e+107], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 13600:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.42 \cdot 10^{+107}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(A + \left(B + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\left(\sqrt{F} \cdot \sqrt{C}\right) \cdot \frac{1}{B}\right)\\
\end{array}
\end{array}
if B < 13600Initial program 24.5%
associate-*l*24.5%
unpow224.5%
+-commutative24.5%
unpow224.5%
associate-*l*24.5%
unpow224.5%
Simplified24.5%
Taylor expanded in A around -inf 19.6%
Taylor expanded in F around 0 19.6%
cancel-sign-sub-inv19.6%
metadata-eval19.6%
unpow219.6%
associate-*r*19.6%
Simplified19.6%
if 13600 < B < 1.42000000000000006e107Initial program 57.5%
associate-*l*57.5%
unpow257.5%
+-commutative57.5%
unpow257.5%
associate-*l*57.5%
unpow257.5%
Simplified57.5%
Taylor expanded in B around inf 52.7%
if 1.42000000000000006e107 < B Initial program 0.9%
associate-*l*0.9%
unpow20.9%
+-commutative0.9%
unpow20.9%
associate-*l*0.9%
unpow20.9%
Simplified0.9%
Taylor expanded in A around -inf 0.6%
Taylor expanded in B around inf 5.9%
sqrt-prod13.2%
Applied egg-rr13.2%
*-commutative13.2%
Simplified13.2%
Final simplification22.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 3.1)
(/ (- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0)))))))) t_0)
(if (<= B 3.9e+108)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (+ A (+ B C))))) t_0)
(* -2.0 (/ (sqrt (* C F)) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 3.1) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (B <= 3.9e+108) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else {
tmp = -2.0 * (sqrt((C * F)) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= 3.1d0) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + (c * (a * (-4.0d0)))))))) / t_0
else if (b <= 3.9d+108) then
tmp = -sqrt(((2.0d0 * (t_0 * f)) * (a + (b + c)))) / t_0
else
tmp = (-2.0d0) * (sqrt((c * f)) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 3.1) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
} else if (B <= 3.9e+108) {
tmp = -Math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
} else {
tmp = -2.0 * (Math.sqrt((C * F)) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 3.1: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0 elif B <= 3.9e+108: tmp = -math.sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0 else: tmp = -2.0 * (math.sqrt((C * F)) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 3.1) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / t_0); elseif (B <= 3.9e+108) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(A + Float64(B + C))))) / t_0); else tmp = Float64(-2.0 * Float64(sqrt(Float64(C * 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));
tmp = 0.0;
if (B <= 3.1)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / t_0;
elseif (B <= 3.9e+108)
tmp = -sqrt(((2.0 * (t_0 * F)) * (A + (B + C)))) / t_0;
else
tmp = -2.0 * (sqrt((C * F)) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 3.1], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 3.9e+108], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $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)\\
\mathbf{if}\;B \leq 3.1:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 3.9 \cdot 10^{+108}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(A + \left(B + C\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot F}}{B}\\
\end{array}
\end{array}
if B < 3.10000000000000009Initial program 24.5%
associate-*l*24.5%
unpow224.5%
+-commutative24.5%
unpow224.5%
associate-*l*24.5%
unpow224.5%
Simplified24.5%
Taylor expanded in A around -inf 19.6%
Taylor expanded in F around 0 19.6%
cancel-sign-sub-inv19.6%
metadata-eval19.6%
unpow219.6%
associate-*r*19.6%
Simplified19.6%
if 3.10000000000000009 < B < 3.89999999999999985e108Initial program 57.5%
associate-*l*57.5%
unpow257.5%
+-commutative57.5%
unpow257.5%
associate-*l*57.5%
unpow257.5%
Simplified57.5%
Taylor expanded in B around inf 52.7%
if 3.89999999999999985e108 < B Initial program 0.9%
associate-*l*0.9%
unpow20.9%
+-commutative0.9%
unpow20.9%
associate-*l*0.9%
unpow20.9%
Simplified0.9%
Taylor expanded in A around -inf 0.6%
Taylor expanded in B around inf 1.6%
Taylor expanded in A around 0 5.9%
associate-*r/5.9%
*-commutative5.9%
*-rgt-identity5.9%
Simplified5.9%
Final simplification21.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 1.1e+52)
(/
(- (sqrt (* 4.0 (* C (* F (+ (* B B) (* C (* A -4.0))))))))
(- (* B B) (* 4.0 (* A C))))
(* -2.0 (/ (sqrt (* C F)) B))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.1e+52) {
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (sqrt((C * 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) :: tmp
if (b <= 1.1d+52) then
tmp = -sqrt((4.0d0 * (c * (f * ((b * b) + (c * (a * (-4.0d0)))))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-2.0d0) * (sqrt((c * f)) / 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 <= 1.1e+52) {
tmp = -Math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (Math.sqrt((C * F)) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 1.1e+52: tmp = -math.sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -2.0 * (math.sqrt((C * F)) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 1.1e+52) tmp = Float64(Float64(-sqrt(Float64(4.0 * Float64(C * Float64(F * Float64(Float64(B * B) + Float64(C * Float64(A * -4.0)))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 1.1e+52)
tmp = -sqrt((4.0 * (C * (F * ((B * B) + (C * (A * -4.0))))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -2.0 * (sqrt((C * 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_] := If[LessEqual[B, 1.1e+52], N[((-N[Sqrt[N[(4.0 * N[(C * N[(F * N[(N[(B * B), $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.1 \cdot 10^{+52}:\\
\;\;\;\;\frac{-\sqrt{4 \cdot \left(C \cdot \left(F \cdot \left(B \cdot B + C \cdot \left(A \cdot -4\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot F}}{B}\\
\end{array}
\end{array}
if B < 1.1e52Initial program 27.6%
associate-*l*27.6%
unpow227.6%
+-commutative27.6%
unpow227.6%
associate-*l*27.6%
unpow227.6%
Simplified27.6%
Taylor expanded in A around -inf 18.9%
Taylor expanded in F around 0 18.9%
cancel-sign-sub-inv18.9%
metadata-eval18.9%
unpow218.9%
associate-*r*18.9%
Simplified18.9%
if 1.1e52 < B Initial program 12.9%
associate-*l*12.9%
unpow212.9%
+-commutative12.9%
unpow212.9%
associate-*l*12.9%
unpow212.9%
Simplified12.9%
Taylor expanded in A around -inf 3.2%
Taylor expanded in B around inf 1.8%
Taylor expanded in A around 0 7.3%
associate-*r/7.3%
*-commutative7.3%
*-rgt-identity7.3%
Simplified7.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 (if (<= B 1.45e+34) (/ (- (sqrt (* -16.0 (* A (* F (* C C)))))) (- (* B B) (* 4.0 (* A C)))) (* -2.0 (/ (sqrt (* C F)) B))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 1.45e+34) {
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (sqrt((C * 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) :: tmp
if (b <= 1.45d+34) then
tmp = -sqrt(((-16.0d0) * (a * (f * (c * c))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-2.0d0) * (sqrt((c * f)) / 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 <= 1.45e+34) {
tmp = -Math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (Math.sqrt((C * F)) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 1.45e+34: tmp = -math.sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -2.0 * (math.sqrt((C * F)) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 1.45e+34) tmp = Float64(Float64(-sqrt(Float64(-16.0 * Float64(A * Float64(F * Float64(C * C)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-2.0 * Float64(sqrt(Float64(C * F)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 1.45e+34)
tmp = -sqrt((-16.0 * (A * (F * (C * C))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -2.0 * (sqrt((C * 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_] := If[LessEqual[B, 1.45e+34], 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], N[(-2.0 * N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 1.45 \cdot 10^{+34}:\\
\;\;\;\;\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)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{C \cdot F}}{B}\\
\end{array}
\end{array}
if B < 1.4500000000000001e34Initial program 26.2%
associate-*l*26.2%
unpow226.2%
+-commutative26.2%
unpow226.2%
associate-*l*26.2%
unpow226.2%
Simplified26.2%
Taylor expanded in A around -inf 19.6%
Taylor expanded in B around 0 11.9%
unpow211.9%
Simplified11.9%
if 1.4500000000000001e34 < B Initial program 19.9%
associate-*l*19.9%
unpow219.9%
+-commutative19.9%
unpow219.9%
associate-*l*19.9%
unpow219.9%
Simplified19.9%
Taylor expanded in A around -inf 3.0%
Taylor expanded in B around inf 1.9%
Taylor expanded in A around 0 6.7%
associate-*r/6.7%
*-commutative6.7%
*-rgt-identity6.7%
Simplified6.7%
Final simplification10.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B 6.2e-305) (* (sqrt (* C F)) (/ 2.0 B)) (* -2.0 (* (/ 1.0 B) (pow (* C F) 0.5)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 6.2e-305) {
tmp = sqrt((C * F)) * (2.0 / B);
} else {
tmp = -2.0 * ((1.0 / B) * pow((C * F), 0.5));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= 6.2d-305) then
tmp = sqrt((c * f)) * (2.0d0 / b)
else
tmp = (-2.0d0) * ((1.0d0 / b) * ((c * f) ** 0.5d0))
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 6.2e-305) {
tmp = Math.sqrt((C * F)) * (2.0 / B);
} else {
tmp = -2.0 * ((1.0 / B) * Math.pow((C * F), 0.5));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 6.2e-305: tmp = math.sqrt((C * F)) * (2.0 / B) else: tmp = -2.0 * ((1.0 / B) * math.pow((C * F), 0.5)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 6.2e-305) tmp = Float64(sqrt(Float64(C * F)) * Float64(2.0 / B)); else tmp = Float64(-2.0 * Float64(Float64(1.0 / B) * (Float64(C * F) ^ 0.5))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 6.2e-305)
tmp = sqrt((C * F)) * (2.0 / B);
else
tmp = -2.0 * ((1.0 / B) * ((C * F) ^ 0.5));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 6.2e-305], N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(2.0 / B), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[(1.0 / B), $MachinePrecision] * N[Power[N[(C * F), $MachinePrecision], 0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 6.2 \cdot 10^{-305}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \frac{2}{B}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\frac{1}{B} \cdot {\left(C \cdot F\right)}^{0.5}\right)\\
\end{array}
\end{array}
if B < 6.1999999999999997e-305Initial program 23.9%
associate-*l*23.9%
unpow223.9%
+-commutative23.9%
unpow223.9%
associate-*l*23.9%
unpow223.9%
Simplified23.9%
Taylor expanded in A around -inf 16.1%
sqrt-prod18.1%
*-commutative18.1%
cancel-sign-sub-inv18.1%
metadata-eval18.1%
*-commutative18.1%
fma-def18.1%
associate-*r*18.1%
*-commutative18.1%
Applied egg-rr18.1%
Taylor expanded in B around -inf 5.8%
unpow25.8%
rem-square-sqrt5.9%
Simplified5.9%
if 6.1999999999999997e-305 < B Initial program 25.4%
associate-*l*25.4%
unpow225.4%
+-commutative25.4%
unpow225.4%
associate-*l*25.4%
unpow225.4%
Simplified25.4%
Taylor expanded in A around -inf 15.7%
Taylor expanded in B around inf 5.5%
pow1/25.6%
*-commutative5.6%
Applied egg-rr5.6%
Final simplification5.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (let* ((t_0 (sqrt (* C F)))) (if (<= B -5e-310) (* t_0 (/ 2.0 B)) (* -2.0 (/ t_0 B)))))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((C * F));
double tmp;
if (B <= -5e-310) {
tmp = t_0 * (2.0 / B);
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((c * f))
if (b <= (-5d-310)) then
tmp = t_0 * (2.0d0 / b)
else
tmp = (-2.0d0) * (t_0 / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((C * F));
double tmp;
if (B <= -5e-310) {
tmp = t_0 * (2.0 / B);
} else {
tmp = -2.0 * (t_0 / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((C * F)) tmp = 0 if B <= -5e-310: tmp = t_0 * (2.0 / B) else: tmp = -2.0 * (t_0 / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = sqrt(Float64(C * F)) tmp = 0.0 if (B <= -5e-310) tmp = Float64(t_0 * Float64(2.0 / B)); else tmp = Float64(-2.0 * Float64(t_0 / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((C * F));
tmp = 0.0;
if (B <= -5e-310)
tmp = t_0 * (2.0 / B);
else
tmp = -2.0 * (t_0 / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[B, -5e-310], N[(t$95$0 * N[(2.0 / B), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(t$95$0 / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot F}\\
\mathbf{if}\;B \leq -5 \cdot 10^{-310}:\\
\;\;\;\;t_0 \cdot \frac{2}{B}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{t_0}{B}\\
\end{array}
\end{array}
if B < -4.999999999999985e-310Initial program 24.1%
associate-*l*24.1%
unpow224.1%
+-commutative24.1%
unpow224.1%
associate-*l*24.1%
unpow224.1%
Simplified24.1%
Taylor expanded in A around -inf 16.2%
sqrt-prod18.2%
*-commutative18.2%
cancel-sign-sub-inv18.2%
metadata-eval18.2%
*-commutative18.2%
fma-def18.2%
associate-*r*18.2%
*-commutative18.2%
Applied egg-rr18.2%
Taylor expanded in B around -inf 5.9%
unpow25.9%
rem-square-sqrt5.9%
Simplified5.9%
if -4.999999999999985e-310 < B Initial program 25.3%
associate-*l*25.3%
unpow225.3%
+-commutative25.3%
unpow225.3%
associate-*l*25.3%
unpow225.3%
Simplified25.3%
Taylor expanded in A around -inf 15.6%
Taylor expanded in B around inf 3.5%
Taylor expanded in A around 0 5.5%
associate-*r/5.5%
*-commutative5.5%
*-rgt-identity5.5%
Simplified5.5%
Final simplification5.7%
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 24.8%
associate-*l*24.8%
unpow224.8%
+-commutative24.8%
unpow224.8%
associate-*l*24.8%
unpow224.8%
Simplified24.8%
Taylor expanded in A around -inf 15.9%
Taylor expanded in B around inf 2.5%
Taylor expanded in A around 0 3.7%
associate-*r/3.7%
*-commutative3.7%
*-rgt-identity3.7%
Simplified3.7%
Final simplification3.7%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (/ (- (sqrt (* C F))) B))
assert(A < C);
double code(double A, double B, double C, double F) {
return -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 = -sqrt((c * f)) / b
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return -Math.sqrt((C * F)) / B;
}
[A, C] = sort([A, C]) def code(A, B, C, F): return -math.sqrt((C * F)) / B
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(-sqrt(Float64(C * F))) / B) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -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[((-N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{-\sqrt{C \cdot F}}{B}
\end{array}
Initial program 24.8%
associate-*l*24.8%
unpow224.8%
+-commutative24.8%
unpow224.8%
associate-*l*24.8%
unpow224.8%
Simplified24.8%
Taylor expanded in A around -inf 15.9%
Taylor expanded in B around inf 2.5%
Taylor expanded in A around inf 2.3%
mul-1-neg2.3%
associate-*r/2.3%
*-commutative2.3%
*-rgt-identity2.3%
distribute-neg-frac2.3%
Simplified2.3%
Final simplification2.3%
herbie shell --seed 2023196
(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))))