
(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 15 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* C A)))))
(if (<= B -3.6e-94)
(/
(*
(sqrt (fma B B (* C (* A -4.0))))
(- (sqrt (* 2.0 (* F (+ A (- C (hypot (- A C) B))))))))
(fma B B (* A (* C -4.0))))
(if (<= B 9.5e-28)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* A 2.0))))) t_0)
(- (/ (sqrt (* (* 2.0 F) (- A (hypot B A)))) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double tmp;
if (B <= -3.6e-94) {
tmp = (sqrt(fma(B, B, (C * (A * -4.0)))) * -sqrt((2.0 * (F * (A + (C - hypot((A - C), B))))))) / fma(B, B, (A * (C * -4.0)));
} else if (B <= 9.5e-28) {
tmp = -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
} else {
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / B);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) tmp = 0.0 if (B <= -3.6e-94) tmp = Float64(Float64(sqrt(fma(B, B, Float64(C * Float64(A * -4.0)))) * Float64(-sqrt(Float64(2.0 * Float64(F * Float64(A + Float64(C - hypot(Float64(A - C), B)))))))) / fma(B, B, Float64(A * Float64(C * -4.0)))); elseif (B <= 9.5e-28) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A * 2.0))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(B, A)))) / B)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -3.6e-94], N[(N[(N[Sqrt[N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(F * N[(A + N[(C - N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B * B + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 9.5e-28], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision])]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;B \leq -3.6 \cdot 10^{-94}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)} \cdot \left(-\sqrt{2 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(A - C, B\right)\right)\right)\right)}\right)}{\mathsf{fma}\left(B, B, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B \leq 9.5 \cdot 10^{-28}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\\
\end{array}
\end{array}
if B < -3.6e-94Initial program 22.4%
Simplified24.0%
sqrt-prod35.0%
associate-*r*35.0%
*-commutative35.0%
associate-*l*35.0%
associate--r-35.0%
+-commutative35.0%
Applied egg-rr35.0%
hypot-def28.5%
unpow228.5%
unpow228.5%
+-commutative28.5%
unpow228.5%
unpow228.5%
hypot-def35.0%
Simplified35.0%
if -3.6e-94 < B < 9.50000000000000001e-28Initial program 23.2%
Simplified23.2%
Taylor expanded in A around -inf 25.0%
*-commutative25.0%
Simplified25.0%
if 9.50000000000000001e-28 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
associate-*l/12.0%
hypot-def37.8%
Applied egg-rr37.8%
pow137.8%
sqrt-unprod37.9%
Applied egg-rr37.9%
unpow137.9%
associate-*r*37.9%
Simplified37.9%
Final simplification30.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 (* C A)))) (t_1 (fma B B (* C (* A -4.0)))))
(if (<= B -1.8e-115)
(/ (- (sqrt (* (* 2.0 (* t_1 F)) (+ A (- C (hypot B (- A C))))))) t_1)
(if (<= B 2.8e-28)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* A 2.0))))) t_0)
(- (/ (sqrt (* (* 2.0 F) (- A (hypot B A)))) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = fma(B, B, (C * (A * -4.0)));
double tmp;
if (B <= -1.8e-115) {
tmp = -sqrt(((2.0 * (t_1 * F)) * (A + (C - hypot(B, (A - C)))))) / t_1;
} else if (B <= 2.8e-28) {
tmp = -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
} else {
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / B);
}
return tmp;
}
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) t_1 = fma(B, B, Float64(C * Float64(A * -4.0))) tmp = 0.0 if (B <= -1.8e-115) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(A + Float64(C - hypot(B, Float64(A - C))))))) / t_1); elseif (B <= 2.8e-28) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A * 2.0))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(B, A)))) / B)); end return tmp end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B * B + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.8e-115], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 2.8e-28], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision])]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := \mathsf{fma}\left(B, B, C \cdot \left(A \cdot -4\right)\right)\\
\mathbf{if}\;B \leq -1.8 \cdot 10^{-115}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t_1 \cdot F\right)\right) \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 2.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\\
\end{array}
\end{array}
if B < -1.80000000000000005e-115Initial program 23.9%
Simplified26.5%
if -1.80000000000000005e-115 < B < 2.7999999999999998e-28Initial program 22.3%
Simplified22.3%
Taylor expanded in A around -inf 25.7%
*-commutative25.7%
Simplified25.7%
if 2.7999999999999998e-28 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
associate-*l/12.0%
hypot-def37.8%
Applied egg-rr37.8%
pow137.8%
sqrt-unprod37.9%
Applied egg-rr37.9%
unpow137.9%
associate-*r*37.9%
Simplified37.9%
Final simplification28.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 (* C A)))) (t_1 (+ (* B B) (* -4.0 (* C A)))))
(if (<= B -1.1e-109)
(/ (- (sqrt (* 2.0 (* t_1 (* F (+ A (- C (hypot B (- A C))))))))) t_1)
(if (<= B 6.4e-28)
(/ (- (sqrt (* 2.0 (* (* F t_0) (* A 2.0))))) t_0)
(- (/ (sqrt (* (* 2.0 F) (- A (hypot B A)))) B))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = (B * B) + (-4.0 * (C * A));
double tmp;
if (B <= -1.1e-109) {
tmp = -sqrt((2.0 * (t_1 * (F * (A + (C - hypot(B, (A - C)))))))) / t_1;
} else if (B <= 6.4e-28) {
tmp = -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
} else {
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = (B * B) + (-4.0 * (C * A));
double tmp;
if (B <= -1.1e-109) {
tmp = -Math.sqrt((2.0 * (t_1 * (F * (A + (C - Math.hypot(B, (A - C)))))))) / t_1;
} else if (B <= 6.4e-28) {
tmp = -Math.sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
} else {
tmp = -(Math.sqrt(((2.0 * F) * (A - Math.hypot(B, A)))) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) t_1 = (B * B) + (-4.0 * (C * A)) tmp = 0 if B <= -1.1e-109: tmp = -math.sqrt((2.0 * (t_1 * (F * (A + (C - math.hypot(B, (A - C)))))))) / t_1 elif B <= 6.4e-28: tmp = -math.sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0 else: tmp = -(math.sqrt(((2.0 * F) * (A - math.hypot(B, A)))) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) t_1 = Float64(Float64(B * B) + Float64(-4.0 * Float64(C * A))) tmp = 0.0 if (B <= -1.1e-109) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(F * Float64(A + Float64(C - hypot(B, Float64(A - C))))))))) / t_1); elseif (B <= 6.4e-28) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A * 2.0))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(B, A)))) / 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 * (C * A));
t_1 = (B * B) + (-4.0 * (C * A));
tmp = 0.0;
if (B <= -1.1e-109)
tmp = -sqrt((2.0 * (t_1 * (F * (A + (C - hypot(B, (A - C)))))))) / t_1;
elseif (B <= 6.4e-28)
tmp = -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
else
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / 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[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(B * B), $MachinePrecision] + N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -1.1e-109], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(F * N[(A + N[(C - N[Sqrt[B ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[B, 6.4e-28], N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision])]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := B \cdot B + -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;B \leq -1.1 \cdot 10^{-109}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(F \cdot \left(A + \left(C - \mathsf{hypot}\left(B, A - C\right)\right)\right)\right)\right)}}{t_1}\\
\mathbf{elif}\;B \leq 6.4 \cdot 10^{-28}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\\
\end{array}
\end{array}
if B < -1.1e-109Initial program 23.9%
Simplified23.9%
distribute-frac-neg23.9%
Applied egg-rr26.5%
if -1.1e-109 < B < 6.39999999999999964e-28Initial program 22.3%
Simplified22.3%
Taylor expanded in A around -inf 25.7%
*-commutative25.7%
Simplified25.7%
if 6.39999999999999964e-28 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
associate-*l/12.0%
hypot-def37.8%
Applied egg-rr37.8%
pow137.8%
sqrt-unprod37.9%
Applied egg-rr37.9%
unpow137.9%
associate-*r*37.9%
Simplified37.9%
Final simplification28.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 (* C A)))) (t_1 (* F t_0)))
(if (<= B -8.6e+151)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -5.2e-48)
(/ (- (sqrt (* 2.0 (* t_1 (- C (hypot C B)))))) (* B B))
(if (<= B 6.8e-28)
(/ (- (sqrt (* 2.0 (* t_1 (* A 2.0))))) t_0)
(- (/ (sqrt (* (* 2.0 F) (- A (hypot B A)))) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -8.6e+151) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -5.2e-48) {
tmp = -sqrt((2.0 * (t_1 * (C - hypot(C, B))))) / (B * B);
} else if (B <= 6.8e-28) {
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -8.6e+151) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -5.2e-48) {
tmp = -Math.sqrt((2.0 * (t_1 * (C - Math.hypot(C, B))))) / (B * B);
} else if (B <= 6.8e-28) {
tmp = -Math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = -(Math.sqrt(((2.0 * F) * (A - Math.hypot(B, A)))) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) t_1 = F * t_0 tmp = 0 if B <= -8.6e+151: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -5.2e-48: tmp = -math.sqrt((2.0 * (t_1 * (C - math.hypot(C, B))))) / (B * B) elif B <= 6.8e-28: tmp = -math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0 else: tmp = -(math.sqrt(((2.0 * F) * (A - math.hypot(B, A)))) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -8.6e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -5.2e-48) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(C - hypot(C, B)))))) / Float64(B * B)); elseif (B <= 6.8e-28) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A * 2.0))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(B, A)))) / 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 * (C * A));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -8.6e+151)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -5.2e-48)
tmp = -sqrt((2.0 * (t_1 * (C - hypot(C, B))))) / (B * B);
elseif (B <= 6.8e-28)
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
else
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / 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[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -8.6e+151], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -5.2e-48], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(C - N[Sqrt[C ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(B * B), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 6.8e-28], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision])]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -8.6 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -5.2 \cdot 10^{-48}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(C - \mathsf{hypot}\left(C, B\right)\right)\right)}}{B \cdot B}\\
\mathbf{elif}\;B \leq 6.8 \cdot 10^{-28}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\\
\end{array}
\end{array}
if B < -8.59999999999999965e151Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in B around -inf 6.9%
*-commutative6.9%
Simplified6.9%
if -8.59999999999999965e151 < B < -5.19999999999999975e-48Initial program 41.2%
Simplified41.2%
Taylor expanded in A around 0 37.6%
+-commutative37.6%
unpow237.6%
unpow237.6%
hypot-def37.8%
Simplified37.8%
Taylor expanded in B around inf 37.8%
unpow237.8%
Simplified37.8%
if -5.19999999999999975e-48 < B < 6.8000000000000001e-28Initial program 22.9%
Simplified22.9%
Taylor expanded in A around -inf 24.7%
*-commutative24.7%
Simplified24.7%
if 6.8000000000000001e-28 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
associate-*l/12.0%
hypot-def37.8%
Applied egg-rr37.8%
pow137.8%
sqrt-unprod37.9%
Applied egg-rr37.9%
unpow137.9%
associate-*r*37.9%
Simplified37.9%
Final simplification27.3%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* C A)))) (t_1 (* F t_0)))
(if (<= B -7.8e+151)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -1.05e-47)
(/ (- (sqrt (* 2.0 (* t_1 (+ A (+ B C)))))) t_0)
(if (<= B 6.5e-29)
(/ (- (sqrt (* 2.0 (* t_1 (* A 2.0))))) t_0)
(- (/ (sqrt (* (* 2.0 F) (- A (hypot B A)))) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -7.8e+151) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.05e-47) {
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else if (B <= 6.5e-29) {
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / B);
}
return tmp;
}
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -7.8e+151) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.05e-47) {
tmp = -Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else if (B <= 6.5e-29) {
tmp = -Math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = -(Math.sqrt(((2.0 * F) * (A - Math.hypot(B, A)))) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) t_1 = F * t_0 tmp = 0 if B <= -7.8e+151: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -1.05e-47: tmp = -math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0 elif B <= 6.5e-29: tmp = -math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0 else: tmp = -(math.sqrt(((2.0 * F) * (A - math.hypot(B, A)))) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -7.8e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -1.05e-47) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C)))))) / t_0); elseif (B <= 6.5e-29) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A * 2.0))))) / t_0); else tmp = Float64(-Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A - hypot(B, A)))) / 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 * (C * A));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -7.8e+151)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -1.05e-47)
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
elseif (B <= 6.5e-29)
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
else
tmp = -(sqrt(((2.0 * F) * (A - hypot(B, A)))) / 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[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -7.8e+151], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.05e-47], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 6.5e-29], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], (-N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A - N[Sqrt[B ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision])]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -7.8 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.05 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 6.5 \cdot 10^{-29}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A - \mathsf{hypot}\left(B, A\right)\right)}}{B}\\
\end{array}
\end{array}
if B < -7.79999999999999952e151Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in B around -inf 6.9%
*-commutative6.9%
Simplified6.9%
if -7.79999999999999952e151 < B < -1.05e-47Initial program 41.2%
Simplified41.2%
Taylor expanded in B around -inf 35.6%
if -1.05e-47 < B < 6.5e-29Initial program 22.9%
Simplified22.9%
Taylor expanded in A around -inf 24.7%
*-commutative24.7%
Simplified24.7%
if 6.5e-29 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
associate-*l/12.0%
hypot-def37.8%
Applied egg-rr37.8%
pow137.8%
sqrt-unprod37.9%
Applied egg-rr37.9%
unpow137.9%
associate-*r*37.9%
Simplified37.9%
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 (* C A)))) (t_1 (* F t_0)))
(if (<= B -7.5e+151)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -1.35e-49)
(/ (- (sqrt (* 2.0 (* t_1 (+ A (+ B C)))))) t_0)
(if (<= B 1.1e-27)
(/ (- (sqrt (* 2.0 (* t_1 (* A 2.0))))) t_0)
(* (sqrt (* F (- A B))) (/ (- (sqrt 2.0)) B)))))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -7.5e+151) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.35e-49) {
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else if (B <= 1.1e-27) {
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = sqrt((F * (A - B))) * (-sqrt(2.0) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (c * a))
t_1 = f * t_0
if (b <= (-7.5d+151)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-1.35d-49)) then
tmp = -sqrt((2.0d0 * (t_1 * (a + (b + c))))) / t_0
else if (b <= 1.1d-27) then
tmp = -sqrt((2.0d0 * (t_1 * (a * 2.0d0)))) / t_0
else
tmp = sqrt((f * (a - b))) * (-sqrt(2.0d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -7.5e+151) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.35e-49) {
tmp = -Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else if (B <= 1.1e-27) {
tmp = -Math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
} else {
tmp = Math.sqrt((F * (A - B))) * (-Math.sqrt(2.0) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) t_1 = F * t_0 tmp = 0 if B <= -7.5e+151: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -1.35e-49: tmp = -math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0 elif B <= 1.1e-27: tmp = -math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0 else: tmp = math.sqrt((F * (A - B))) * (-math.sqrt(2.0) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -7.5e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -1.35e-49) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C)))))) / t_0); elseif (B <= 1.1e-27) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A * 2.0))))) / t_0); else tmp = Float64(sqrt(Float64(F * Float64(A - B))) * Float64(Float64(-sqrt(2.0)) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (C * A));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -7.5e+151)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -1.35e-49)
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
elseif (B <= 1.1e-27)
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
else
tmp = sqrt((F * (A - B))) * (-sqrt(2.0) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -7.5e+151], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.35e-49], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[B, 1.1e-27], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[Sqrt[N[(F * N[(A - B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[((-N[Sqrt[2.0], $MachinePrecision]) / B), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -7.5 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.35 \cdot 10^{-49}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 1.1 \cdot 10^{-27}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F \cdot \left(A - B\right)} \cdot \frac{-\sqrt{2}}{B}\\
\end{array}
\end{array}
if B < -7.49999999999999977e151Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in B around -inf 6.9%
*-commutative6.9%
Simplified6.9%
if -7.49999999999999977e151 < B < -1.35e-49Initial program 41.2%
Simplified41.2%
Taylor expanded in B around -inf 35.6%
if -1.35e-49 < B < 1.09999999999999993e-27Initial program 22.9%
Simplified22.9%
Taylor expanded in A around -inf 24.7%
*-commutative24.7%
Simplified24.7%
if 1.09999999999999993e-27 < B Initial program 10.0%
Simplified10.0%
Taylor expanded in C around 0 12.0%
mul-1-neg12.0%
*-commutative12.0%
unpow212.0%
unpow212.0%
Simplified12.0%
Taylor expanded in B around inf 35.9%
Final simplification26.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 (* C A)))) (t_1 (* F t_0)))
(if (<= B -9e+151)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B -1.08e-47)
(/ (- (sqrt (* 2.0 (* t_1 (+ A (+ B C)))))) t_0)
(/ (- (sqrt (* 2.0 (* t_1 (* A 2.0))))) t_0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -9e+151) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.08e-47) {
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else {
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (c * a))
t_1 = f * t_0
if (b <= (-9d+151)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= (-1.08d-47)) then
tmp = -sqrt((2.0d0 * (t_1 * (a + (b + c))))) / t_0
else
tmp = -sqrt((2.0d0 * (t_1 * (a * 2.0d0)))) / 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 * (C * A));
double t_1 = F * t_0;
double tmp;
if (B <= -9e+151) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= -1.08e-47) {
tmp = -Math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
} else {
tmp = -Math.sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) t_1 = F * t_0 tmp = 0 if B <= -9e+151: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= -1.08e-47: tmp = -math.sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0 else: tmp = -math.sqrt((2.0 * (t_1 * (A * 2.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(C * A))) t_1 = Float64(F * t_0) tmp = 0.0 if (B <= -9e+151) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= -1.08e-47) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A + Float64(B + C)))))) / t_0); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(A * 2.0))))) / t_0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (C * A));
t_1 = F * t_0;
tmp = 0.0;
if (B <= -9e+151)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= -1.08e-47)
tmp = -sqrt((2.0 * (t_1 * (A + (B + C))))) / t_0;
else
tmp = -sqrt((2.0 * (t_1 * (A * 2.0)))) / t_0;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(F * t$95$0), $MachinePrecision]}, If[LessEqual[B, -9e+151], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, -1.08e-47], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + N[(B + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
t_1 := F \cdot t_0\\
\mathbf{if}\;B \leq -9 \cdot 10^{+151}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq -1.08 \cdot 10^{-47}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A + \left(B + C\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(A \cdot 2\right)\right)}}{t_0}\\
\end{array}
\end{array}
if B < -8.9999999999999997e151Initial program 0.1%
Simplified0.1%
Taylor expanded in A around -inf 0.2%
*-commutative0.2%
Simplified0.2%
Taylor expanded in B around -inf 6.9%
*-commutative6.9%
Simplified6.9%
if -8.9999999999999997e151 < B < -1.08000000000000005e-47Initial program 41.2%
Simplified41.2%
Taylor expanded in B around -inf 35.6%
if -1.08000000000000005e-47 < B Initial program 19.1%
Simplified19.1%
Taylor expanded in A around -inf 17.6%
*-commutative17.6%
Simplified17.6%
Final simplification19.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 (* C A))))) (/ (- (sqrt (* 2.0 (* t_0 (* F (* A 2.0)))))) t_0)))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (C * A));
return -sqrt((2.0 * (t_0 * (F * (A * 2.0))))) / t_0;
}
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
t_0 = (b * b) + ((-4.0d0) * (c * a))
code = -sqrt((2.0d0 * (t_0 * (f * (a * 2.0d0))))) / t_0
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + (-4.0 * (C * A));
return -Math.sqrt((2.0 * (t_0 * (F * (A * 2.0))))) / t_0;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + (-4.0 * (C * A)) return -math.sqrt((2.0 * (t_0 * (F * (A * 2.0))))) / t_0
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(-4.0 * Float64(C * A))) return Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A * 2.0)))))) / t_0) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
t_0 = (B * B) + (-4.0 * (C * A));
tmp = -sqrt((2.0 * (t_0 * (F * (A * 2.0))))) / t_0;
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[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A * 2.0), $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(C \cdot A\right)\\
\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A \cdot 2\right)\right)\right)}}{t_0}
\end{array}
\end{array}
Initial program 20.2%
Simplified20.2%
Taylor expanded in A around -inf 13.4%
*-commutative13.4%
Simplified13.4%
distribute-frac-neg13.4%
associate-*l*12.9%
cancel-sign-sub-inv12.9%
metadata-eval12.9%
*-commutative12.9%
cancel-sign-sub-inv12.9%
metadata-eval12.9%
Applied egg-rr12.9%
Final simplification12.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 (* C A))))) (/ (- (sqrt (* 2.0 (* (* F t_0) (* A 2.0))))) t_0)))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
return -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
}
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
t_0 = (b * b) - (4.0d0 * (c * a))
code = -sqrt((2.0d0 * ((f * t_0) * (a * 2.0d0)))) / t_0
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (C * A));
return -Math.sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (C * A)) return -math.sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(C * A))) return Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * t_0) * Float64(A * 2.0))))) / t_0) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (C * A));
tmp = -sqrt((2.0 * ((F * t_0) * (A * 2.0)))) / t_0;
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[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(2.0 * N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(C \cdot A\right)\\
\frac{-\sqrt{2 \cdot \left(\left(F \cdot t_0\right) \cdot \left(A \cdot 2\right)\right)}}{t_0}
\end{array}
\end{array}
Initial program 20.2%
Simplified20.2%
Taylor expanded in A around -inf 13.4%
*-commutative13.4%
Simplified13.4%
Final simplification13.4%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -9e+39)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(if (<= B 1.7e-37)
(/
(- (sqrt (* 2.0 (* (* -8.0 (* A A)) (* C F)))))
(- (* B B) (* 4.0 (* C A))))
(* -2.0 (/ (pow (* A F) 0.5) B)))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -9e+39) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else if (B <= 1.7e-37) {
tmp = -sqrt((2.0 * ((-8.0 * (A * A)) * (C * F)))) / ((B * B) - (4.0 * (C * A)));
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-9d+39)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else if (b <= 1.7d-37) then
tmp = -sqrt((2.0d0 * (((-8.0d0) * (a * a)) * (c * f)))) / ((b * b) - (4.0d0 * (c * a)))
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -9e+39) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else if (B <= 1.7e-37) {
tmp = -Math.sqrt((2.0 * ((-8.0 * (A * A)) * (C * F)))) / ((B * B) - (4.0 * (C * A)));
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -9e+39: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) elif B <= 1.7e-37: tmp = -math.sqrt((2.0 * ((-8.0 * (A * A)) * (C * F)))) / ((B * B) - (4.0 * (C * A))) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -9e+39) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); elseif (B <= 1.7e-37) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(-8.0 * Float64(A * A)) * Float64(C * F))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(C * A)))); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -9e+39)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
elseif (B <= 1.7e-37)
tmp = -sqrt((2.0 * ((-8.0 * (A * A)) * (C * F)))) / ((B * B) - (4.0 * (C * A)));
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -9e+39], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B, 1.7e-37], N[((-N[Sqrt[N[(2.0 * N[(N[(-8.0 * N[(A * A), $MachinePrecision]), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -9 \cdot 10^{+39}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{elif}\;B \leq 1.7 \cdot 10^{-37}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(-8 \cdot \left(A \cdot A\right)\right) \cdot \left(C \cdot F\right)\right)}}{B \cdot B - 4 \cdot \left(C \cdot A\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -8.99999999999999991e39Initial program 18.5%
Simplified18.5%
Taylor expanded in A around -inf 1.1%
*-commutative1.1%
Simplified1.1%
Taylor expanded in B around -inf 5.4%
*-commutative5.4%
Simplified5.4%
if -8.99999999999999991e39 < B < 1.70000000000000009e-37Initial program 23.7%
Simplified23.7%
Taylor expanded in A around -inf 22.5%
*-commutative22.5%
Simplified22.5%
Taylor expanded in B around 0 13.4%
associate-*r*13.4%
unpow213.4%
*-commutative13.4%
Simplified13.4%
if 1.70000000000000009e-37 < B Initial program 13.0%
Simplified13.0%
Taylor expanded in A around -inf 2.6%
*-commutative2.6%
Simplified2.6%
Taylor expanded in B around inf 6.1%
associate-*r/6.1%
*-rgt-identity6.1%
*-commutative6.1%
Simplified6.1%
pow1/26.2%
*-commutative6.2%
Applied egg-rr6.2%
Final simplification10.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 (* -4.0 (* C A))))
(if (<= B -7.5e+39)
(* 2.0 (* (sqrt (* A F)) (/ 1.0 B)))
(/ (- (sqrt (* 2.0 (* (* F (* A 2.0)) t_0)))) (+ (* B B) t_0)))))assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = -4.0 * (C * A);
double tmp;
if (B <= -7.5e+39) {
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
} else {
tmp = -sqrt((2.0 * ((F * (A * 2.0)) * t_0))) / ((B * B) + t_0);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (-4.0d0) * (c * a)
if (b <= (-7.5d+39)) then
tmp = 2.0d0 * (sqrt((a * f)) * (1.0d0 / b))
else
tmp = -sqrt((2.0d0 * ((f * (a * 2.0d0)) * t_0))) / ((b * b) + t_0)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = -4.0 * (C * A);
double tmp;
if (B <= -7.5e+39) {
tmp = 2.0 * (Math.sqrt((A * F)) * (1.0 / B));
} else {
tmp = -Math.sqrt((2.0 * ((F * (A * 2.0)) * t_0))) / ((B * B) + t_0);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = -4.0 * (C * A) tmp = 0 if B <= -7.5e+39: tmp = 2.0 * (math.sqrt((A * F)) * (1.0 / B)) else: tmp = -math.sqrt((2.0 * ((F * (A * 2.0)) * t_0))) / ((B * B) + t_0) return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(-4.0 * Float64(C * A)) tmp = 0.0 if (B <= -7.5e+39) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) * Float64(1.0 / B))); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(A * 2.0)) * t_0)))) / Float64(Float64(B * B) + t_0)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = -4.0 * (C * A);
tmp = 0.0;
if (B <= -7.5e+39)
tmp = 2.0 * (sqrt((A * F)) * (1.0 / B));
else
tmp = -sqrt((2.0 * ((F * (A * 2.0)) * t_0))) / ((B * B) + t_0);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, -7.5e+39], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(1.0 / B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(N[(F * N[(A * 2.0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] + t$95$0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := -4 \cdot \left(C \cdot A\right)\\
\mathbf{if}\;B \leq -7.5 \cdot 10^{+39}:\\
\;\;\;\;2 \cdot \left(\sqrt{A \cdot F} \cdot \frac{1}{B}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(A \cdot 2\right)\right) \cdot t_0\right)}}{B \cdot B + t_0}\\
\end{array}
\end{array}
if B < -7.5000000000000005e39Initial program 18.2%
Simplified18.2%
Taylor expanded in A around -inf 1.3%
*-commutative1.3%
Simplified1.3%
Taylor expanded in B around -inf 5.4%
*-commutative5.4%
Simplified5.4%
if -7.5000000000000005e39 < B Initial program 20.8%
Simplified20.8%
Taylor expanded in A around -inf 16.9%
*-commutative16.9%
Simplified16.9%
distribute-frac-neg16.9%
associate-*l*16.2%
cancel-sign-sub-inv16.2%
metadata-eval16.2%
*-commutative16.2%
cancel-sign-sub-inv16.2%
metadata-eval16.2%
Applied egg-rr16.2%
Taylor expanded in B around 0 15.4%
*-commutative15.4%
Simplified15.4%
Final simplification13.1%
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B -6.8e-94)
(* 2.0 (/ (sqrt (* A F)) B))
(/
(- (sqrt (* 2.0 (* (* F (- (* B B) (* 4.0 (* C A)))) (* A 2.0)))))
(* -4.0 (* C A)))))assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -6.8e-94) {
tmp = 2.0 * (sqrt((A * F)) / B);
} else {
tmp = -sqrt((2.0 * ((F * ((B * B) - (4.0 * (C * A)))) * (A * 2.0)))) / (-4.0 * (C * A));
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-6.8d-94)) then
tmp = 2.0d0 * (sqrt((a * f)) / b)
else
tmp = -sqrt((2.0d0 * ((f * ((b * b) - (4.0d0 * (c * a)))) * (a * 2.0d0)))) / ((-4.0d0) * (c * a))
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.8e-94) {
tmp = 2.0 * (Math.sqrt((A * F)) / B);
} else {
tmp = -Math.sqrt((2.0 * ((F * ((B * B) - (4.0 * (C * A)))) * (A * 2.0)))) / (-4.0 * (C * A));
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -6.8e-94: tmp = 2.0 * (math.sqrt((A * F)) / B) else: tmp = -math.sqrt((2.0 * ((F * ((B * B) - (4.0 * (C * A)))) * (A * 2.0)))) / (-4.0 * (C * A)) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -6.8e-94) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) / B)); else tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(Float64(B * B) - Float64(4.0 * Float64(C * A)))) * Float64(A * 2.0))))) / Float64(-4.0 * Float64(C * A))); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -6.8e-94)
tmp = 2.0 * (sqrt((A * F)) / B);
else
tmp = -sqrt((2.0 * ((F * ((B * B) - (4.0 * (C * A)))) * (A * 2.0)))) / (-4.0 * (C * A));
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -6.8e-94], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[((-N[Sqrt[N[(2.0 * N[(N[(F * N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(A * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(-4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -6.8 \cdot 10^{-94}:\\
\;\;\;\;2 \cdot \frac{\sqrt{A \cdot F}}{B}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(F \cdot \left(B \cdot B - 4 \cdot \left(C \cdot A\right)\right)\right) \cdot \left(A \cdot 2\right)\right)}}{-4 \cdot \left(C \cdot A\right)}\\
\end{array}
\end{array}
if B < -6.7999999999999996e-94Initial program 22.4%
Simplified22.4%
Taylor expanded in A around -inf 2.6%
*-commutative2.6%
Simplified2.6%
Taylor expanded in B around -inf 5.8%
associate-*r/5.8%
*-rgt-identity5.8%
*-commutative5.8%
Simplified5.8%
if -6.7999999999999996e-94 < B Initial program 19.3%
Simplified19.3%
Taylor expanded in A around -inf 17.8%
*-commutative17.8%
Simplified17.8%
Taylor expanded in B around 0 16.8%
*-commutative16.8%
Simplified16.8%
Final simplification13.6%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (if (<= B -3.9e-268) (* 2.0 (/ (sqrt (* A F)) B)) (* -2.0 (/ (pow (* A F) 0.5) B))))
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= -3.9e-268) {
tmp = 2.0 * (sqrt((A * F)) / B);
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= (-3.9d-268)) then
tmp = 2.0d0 * (sqrt((a * f)) / b)
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= -3.9e-268) {
tmp = 2.0 * (Math.sqrt((A * F)) / B);
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= -3.9e-268: tmp = 2.0 * (math.sqrt((A * F)) / B) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= -3.9e-268) tmp = Float64(2.0 * Float64(sqrt(Float64(A * F)) / B)); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= -3.9e-268)
tmp = 2.0 * (sqrt((A * F)) / B);
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, -3.9e-268], N[(2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq -3.9 \cdot 10^{-268}:\\
\;\;\;\;2 \cdot \frac{\sqrt{A \cdot F}}{B}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < -3.8999999999999998e-268Initial program 20.4%
Simplified20.4%
Taylor expanded in A around -inf 9.5%
*-commutative9.5%
Simplified9.5%
Taylor expanded in B around -inf 4.8%
associate-*r/4.8%
*-rgt-identity4.8%
*-commutative4.8%
Simplified4.8%
if -3.8999999999999998e-268 < B Initial program 20.0%
Simplified20.0%
Taylor expanded in A around -inf 16.4%
*-commutative16.4%
Simplified16.4%
Taylor expanded in B around inf 3.5%
associate-*r/3.5%
*-rgt-identity3.5%
*-commutative3.5%
Simplified3.5%
pow1/23.6%
*-commutative3.6%
Applied egg-rr3.6%
Final simplification4.1%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (let* ((t_0 (/ (sqrt (* A F)) B))) (if (<= B -1.85e-304) (* 2.0 t_0) (* t_0 -2.0))))
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = sqrt((A * F)) / B;
double tmp;
if (B <= -1.85e-304) {
tmp = 2.0 * t_0;
} else {
tmp = t_0 * -2.0;
}
return tmp;
}
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = sqrt((a * f)) / b
if (b <= (-1.85d-304)) then
tmp = 2.0d0 * t_0
else
tmp = t_0 * (-2.0d0)
end if
code = tmp
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = Math.sqrt((A * F)) / B;
double tmp;
if (B <= -1.85e-304) {
tmp = 2.0 * t_0;
} else {
tmp = t_0 * -2.0;
}
return tmp;
}
[A, C] = sort([A, C]) def code(A, B, C, F): t_0 = math.sqrt((A * F)) / B tmp = 0 if B <= -1.85e-304: tmp = 2.0 * t_0 else: tmp = t_0 * -2.0 return tmp
A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(sqrt(Float64(A * F)) / B) tmp = 0.0 if (B <= -1.85e-304) tmp = Float64(2.0 * t_0); else tmp = Float64(t_0 * -2.0); end return tmp end
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = sqrt((A * F)) / B;
tmp = 0.0;
if (B <= -1.85e-304)
tmp = 2.0 * t_0;
else
tmp = t_0 * -2.0;
end
tmp_2 = tmp;
end
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]}, If[LessEqual[B, -1.85e-304], N[(2.0 * t$95$0), $MachinePrecision], N[(t$95$0 * -2.0), $MachinePrecision]]]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{A \cdot F}}{B}\\
\mathbf{if}\;B \leq -1.85 \cdot 10^{-304}:\\
\;\;\;\;2 \cdot t_0\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot -2\\
\end{array}
\end{array}
if B < -1.8500000000000001e-304Initial program 20.1%
Simplified20.1%
Taylor expanded in A around -inf 11.4%
*-commutative11.4%
Simplified11.4%
Taylor expanded in B around -inf 4.5%
associate-*r/4.5%
*-rgt-identity4.5%
*-commutative4.5%
Simplified4.5%
if -1.8500000000000001e-304 < B Initial program 20.3%
Simplified20.3%
Taylor expanded in A around -inf 15.1%
*-commutative15.1%
Simplified15.1%
Taylor expanded in B around inf 3.7%
associate-*r/3.7%
*-rgt-identity3.7%
*-commutative3.7%
Simplified3.7%
Final simplification4.0%
NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* (/ (sqrt (* A F)) B) -2.0))
assert(A < C);
double code(double A, double B, double C, double F) {
return (sqrt((A * F)) / B) * -2.0;
}
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((a * f)) / b) * (-2.0d0)
end function
assert A < C;
public static double code(double A, double B, double C, double F) {
return (Math.sqrt((A * F)) / B) * -2.0;
}
[A, C] = sort([A, C]) def code(A, B, C, F): return (math.sqrt((A * F)) / B) * -2.0
A, C = sort([A, C]) function code(A, B, C, F) return Float64(Float64(sqrt(Float64(A * F)) / B) * -2.0) end
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = (sqrt((A * F)) / B) * -2.0;
end
NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision] * -2.0), $MachinePrecision]
\begin{array}{l}
[A, C] = \mathsf{sort}([A, C])\\
\\
\frac{\sqrt{A \cdot F}}{B} \cdot -2
\end{array}
Initial program 20.2%
Simplified20.2%
Taylor expanded in A around -inf 13.4%
*-commutative13.4%
Simplified13.4%
Taylor expanded in B around inf 2.6%
associate-*r/2.6%
*-rgt-identity2.6%
*-commutative2.6%
Simplified2.6%
Final simplification2.6%
herbie shell --seed 2023189
(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))))