
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t_0}
\end{array}
\end{array}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= (pow B 2.0) 1e-15)
(- (/ (sqrt (* 2.0 (* (* t_0 F) (+ A A)))) t_0))
(/ (- (sqrt (* (- A (hypot A B)) (* 2.0 F)))) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (pow(B, 2.0) <= 1e-15) {
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = -sqrt(((A - hypot(A, B)) * (2.0 * F))) / B;
}
return tmp;
}
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (Math.pow(B, 2.0) <= 1e-15) {
tmp = -(Math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = -Math.sqrt(((A - Math.hypot(A, B)) * (2.0 * F))) / B;
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if math.pow(B, 2.0) <= 1e-15: tmp = -(math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0) else: tmp = -math.sqrt(((A - math.hypot(A, B)) * (2.0 * F))) / B return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if ((B ^ 2.0) <= 1e-15) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(A + A)))) / t_0)); else tmp = Float64(Float64(-sqrt(Float64(Float64(A - hypot(A, B)) * Float64(2.0 * F)))) / B); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if ((B ^ 2.0) <= 1e-15)
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
else
tmp = -sqrt(((A - hypot(A, B)) * (2.0 * F))) / B;
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B, 2.0], $MachinePrecision], 1e-15], (-N[(N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[((-N[Sqrt[N[(N[(A - N[Sqrt[A ^ 2 + B ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / B), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;{B}^{2} \leq 10^{-15}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{\left(A - \mathsf{hypot}\left(A, B\right)\right) \cdot \left(2 \cdot F\right)}}{B}\\
\end{array}
\end{array}
if (pow.f64 B 2) < 1.0000000000000001e-15Initial program 17.3%
Simplified17.3%
Taylor expanded in C around inf 18.4%
cancel-sign-sub-inv18.4%
metadata-eval18.4%
*-lft-identity18.4%
Simplified18.4%
if 1.0000000000000001e-15 < (pow.f64 B 2) Initial program 17.2%
Simplified17.2%
Taylor expanded in C around 0 11.8%
mul-1-neg11.8%
+-commutative11.8%
unpow211.8%
unpow211.8%
Simplified11.8%
associate-*l/11.8%
+-commutative11.8%
hypot-udef24.9%
Applied egg-rr24.9%
pow124.9%
sqrt-unprod25.0%
Applied egg-rr25.0%
unpow125.0%
associate-*r*25.0%
*-commutative25.0%
*-commutative25.0%
Simplified25.0%
Final simplification21.7%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.2e+43)
(- (/ (sqrt (* 2.0 (* (* t_0 F) (+ A A)))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* F (- A B))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.2e+43) {
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - B)));
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= 1.2d+43) then
tmp = -(sqrt((2.0d0 * ((t_0 * f) * (a + a)))) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -sqrt((f * (a - b)))
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.2e+43) {
tmp = -(Math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((F * (A - B)));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 1.2e+43: tmp = -(math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((F * (A - B))) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.2e+43) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(A + A)))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(F * Float64(A - B))))); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= 1.2e+43)
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((F * (A - B)));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.2e+43], (-N[(N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(F * N[(A - B), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.2 \cdot 10^{+43}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{F \cdot \left(A - B\right)}\right)\\
\end{array}
\end{array}
if B < 1.20000000000000012e43Initial program 17.2%
Simplified17.2%
Taylor expanded in C around inf 13.0%
cancel-sign-sub-inv13.0%
metadata-eval13.0%
*-lft-identity13.0%
Simplified13.0%
if 1.20000000000000012e43 < B Initial program 17.6%
Simplified17.6%
Taylor expanded in C around 0 21.3%
mul-1-neg21.3%
*-commutative21.3%
distribute-rgt-neg-in21.3%
unpow221.3%
unpow221.3%
hypot-def52.0%
Simplified52.0%
Taylor expanded in A around 0 48.7%
mul-1-neg48.7%
unsub-neg48.7%
Simplified48.7%
Final simplification20.3%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 1.5e+43)
(- (/ (sqrt (* 2.0 (* (* t_0 F) (+ A A)))) t_0))
(* (/ (sqrt 2.0) B) (- (sqrt (* B (- F))))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.5e+43) {
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = (sqrt(2.0) / B) * -sqrt((B * -F));
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= 1.5d+43) then
tmp = -(sqrt((2.0d0 * ((t_0 * f) * (a + a)))) / t_0)
else
tmp = (sqrt(2.0d0) / b) * -sqrt((b * -f))
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 1.5e+43) {
tmp = -(Math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = (Math.sqrt(2.0) / B) * -Math.sqrt((B * -F));
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 1.5e+43: tmp = -(math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0) else: tmp = (math.sqrt(2.0) / B) * -math.sqrt((B * -F)) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 1.5e+43) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(A + A)))) / t_0)); else tmp = Float64(Float64(sqrt(2.0) / B) * Float64(-sqrt(Float64(B * Float64(-F))))); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= 1.5e+43)
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
else
tmp = (sqrt(2.0) / B) * -sqrt((B * -F));
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 1.5e+43], (-N[(N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B), $MachinePrecision] * (-N[Sqrt[N[(B * (-F)), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 1.5 \cdot 10^{+43}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B} \cdot \left(-\sqrt{B \cdot \left(-F\right)}\right)\\
\end{array}
\end{array}
if B < 1.50000000000000008e43Initial program 17.2%
Simplified17.2%
Taylor expanded in C around inf 13.0%
cancel-sign-sub-inv13.0%
metadata-eval13.0%
*-lft-identity13.0%
Simplified13.0%
if 1.50000000000000008e43 < B Initial program 17.6%
Simplified17.6%
Taylor expanded in C around 0 21.3%
mul-1-neg21.3%
*-commutative21.3%
distribute-rgt-neg-in21.3%
unpow221.3%
unpow221.3%
hypot-def52.0%
Simplified52.0%
Taylor expanded in A around 0 47.8%
mul-1-neg47.8%
Simplified47.8%
Final simplification20.1%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))) (t_1 (* t_0 F)))
(if (<= B 6.2e+43)
(- (/ (sqrt (* 2.0 (* t_1 (+ A A)))) t_0))
(if (<= B 8.2e+144)
(/ (- (sqrt (* 2.0 (* t_1 (- (+ A C) B))))) t_0)
(* -2.0 (/ (pow (* A F) 0.5) B))))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = t_0 * F;
double tmp;
if (B <= 6.2e+43) {
tmp = -(sqrt((2.0 * (t_1 * (A + A)))) / t_0);
} else if (B <= 8.2e+144) {
tmp = -sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
t_1 = t_0 * f
if (b <= 6.2d+43) then
tmp = -(sqrt((2.0d0 * (t_1 * (a + a)))) / t_0)
else if (b <= 8.2d+144) then
tmp = -sqrt((2.0d0 * (t_1 * ((a + c) - b)))) / t_0
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double t_1 = t_0 * F;
double tmp;
if (B <= 6.2e+43) {
tmp = -(Math.sqrt((2.0 * (t_1 * (A + A)))) / t_0);
} else if (B <= 8.2e+144) {
tmp = -Math.sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) t_1 = t_0 * F tmp = 0 if B <= 6.2e+43: tmp = -(math.sqrt((2.0 * (t_1 * (A + A)))) / t_0) elif B <= 8.2e+144: tmp = -math.sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0 else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) t_1 = Float64(t_0 * F) tmp = 0.0 if (B <= 6.2e+43) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(t_1 * Float64(A + A)))) / t_0)); elseif (B <= 8.2e+144) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_1 * Float64(Float64(A + C) - B))))) / t_0); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
t_1 = t_0 * F;
tmp = 0.0;
if (B <= 6.2e+43)
tmp = -(sqrt((2.0 * (t_1 * (A + A)))) / t_0);
elseif (B <= 8.2e+144)
tmp = -sqrt((2.0 * (t_1 * ((A + C) - B)))) / t_0;
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * F), $MachinePrecision]}, If[LessEqual[B, 6.2e+43], (-N[(N[Sqrt[N[(2.0 * N[(t$95$1 * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), If[LessEqual[B, 8.2e+144], N[((-N[Sqrt[N[(2.0 * N[(t$95$1 * N[(N[(A + C), $MachinePrecision] - B), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
t_1 := t_0 \cdot F\\
\mathbf{if}\;B \leq 6.2 \cdot 10^{+43}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(t_1 \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{elif}\;B \leq 8.2 \cdot 10^{+144}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_1 \cdot \left(\left(A + C\right) - B\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 6.2000000000000003e43Initial program 17.2%
Simplified17.2%
Taylor expanded in C around inf 13.0%
cancel-sign-sub-inv13.0%
metadata-eval13.0%
*-lft-identity13.0%
Simplified13.0%
if 6.2000000000000003e43 < B < 8.20000000000000002e144Initial program 48.2%
Simplified48.2%
Taylor expanded in B around inf 40.7%
if 8.20000000000000002e144 < B Initial program 0.0%
Simplified0.0%
Taylor expanded in C around inf 0.0%
cancel-sign-sub-inv0.0%
metadata-eval0.0%
*-lft-identity0.0%
Simplified0.0%
Taylor expanded in B around inf 2.8%
associate-*r/2.8%
*-rgt-identity2.8%
*-commutative2.8%
Simplified2.8%
pow1/22.9%
Applied egg-rr2.9%
Final simplification13.8%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (+ (* B B) (* (* A C) -4.0))))
(if (<= B 7.6e+134)
(/ (- (sqrt (* 2.0 (* t_0 (* F (+ A A)))))) t_0)
(* -2.0 (/ (pow (* A F) 0.5) B)))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double tmp;
if (B <= 7.6e+134) {
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) + ((a * c) * (-4.0d0))
if (b <= 7.6d+134) then
tmp = -sqrt((2.0d0 * (t_0 * (f * (a + a))))) / t_0
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) + ((A * C) * -4.0);
double tmp;
if (B <= 7.6e+134) {
tmp = -Math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) + ((A * C) * -4.0) tmp = 0 if B <= 7.6e+134: tmp = -math.sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0 else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) + Float64(Float64(A * C) * -4.0)) tmp = 0.0 if (B <= 7.6e+134) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(t_0 * Float64(F * Float64(A + A)))))) / t_0); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) + ((A * C) * -4.0);
tmp = 0.0;
if (B <= 7.6e+134)
tmp = -sqrt((2.0 * (t_0 * (F * (A + A))))) / t_0;
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 7.6e+134], N[((-N[Sqrt[N[(2.0 * N[(t$95$0 * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B + \left(A \cdot C\right) \cdot -4\\
\mathbf{if}\;B \leq 7.6 \cdot 10^{+134}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(t_0 \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 7.59999999999999997e134Initial program 19.5%
Simplified19.5%
Taylor expanded in C around inf 13.2%
cancel-sign-sub-inv13.2%
metadata-eval13.2%
*-lft-identity13.2%
Simplified13.2%
distribute-frac-neg13.2%
associate-*l*13.3%
cancel-sign-sub-inv13.3%
metadata-eval13.3%
cancel-sign-sub-inv13.3%
metadata-eval13.3%
Applied egg-rr13.3%
if 7.59999999999999997e134 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around inf 0.1%
cancel-sign-sub-inv0.1%
metadata-eval0.1%
*-lft-identity0.1%
Simplified0.1%
Taylor expanded in B around inf 2.8%
associate-*r/2.8%
*-rgt-identity2.8%
*-commutative2.8%
Simplified2.8%
pow1/22.9%
Applied egg-rr2.9%
Final simplification11.9%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (* B B) (* 4.0 (* A C)))))
(if (<= B 7.6e+134)
(- (/ (sqrt (* 2.0 (* (* t_0 F) (+ A A)))) t_0))
(* -2.0 (/ (pow (* A F) 0.5) B)))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 7.6e+134) {
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
real(8) :: tmp
t_0 = (b * b) - (4.0d0 * (a * c))
if (b <= 7.6d+134) then
tmp = -(sqrt((2.0d0 * ((t_0 * f) * (a + a)))) / t_0)
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double t_0 = (B * B) - (4.0 * (A * C));
double tmp;
if (B <= 7.6e+134) {
tmp = -(Math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): t_0 = (B * B) - (4.0 * (A * C)) tmp = 0 if B <= 7.6e+134: tmp = -(math.sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) t_0 = Float64(Float64(B * B) - Float64(4.0 * Float64(A * C))) tmp = 0.0 if (B <= 7.6e+134) tmp = Float64(-Float64(sqrt(Float64(2.0 * Float64(Float64(t_0 * F) * Float64(A + A)))) / t_0)); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
t_0 = (B * B) - (4.0 * (A * C));
tmp = 0.0;
if (B <= 7.6e+134)
tmp = -(sqrt((2.0 * ((t_0 * F) * (A + A)))) / t_0);
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B, 7.6e+134], (-N[(N[Sqrt[N[(2.0 * N[(N[(t$95$0 * F), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$0), $MachinePrecision]), N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
t_0 := B \cdot B - 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B \leq 7.6 \cdot 10^{+134}:\\
\;\;\;\;-\frac{\sqrt{2 \cdot \left(\left(t_0 \cdot F\right) \cdot \left(A + A\right)\right)}}{t_0}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 7.59999999999999997e134Initial program 19.5%
Simplified19.5%
Taylor expanded in C around inf 13.2%
cancel-sign-sub-inv13.2%
metadata-eval13.2%
*-lft-identity13.2%
Simplified13.2%
if 7.59999999999999997e134 < B Initial program 2.9%
Simplified2.9%
Taylor expanded in C around inf 0.1%
cancel-sign-sub-inv0.1%
metadata-eval0.1%
*-lft-identity0.1%
Simplified0.1%
Taylor expanded in B around inf 2.8%
associate-*r/2.8%
*-rgt-identity2.8%
*-commutative2.8%
Simplified2.8%
pow1/22.9%
Applied egg-rr2.9%
Final simplification11.8%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 3.7e-10)
(/
(- (sqrt (* 2.0 (* (+ A A) (* -4.0 (* A (* C F)))))))
(- (* B B) (* 4.0 (* A C))))
(* -2.0 (/ (pow (* A F) 0.5) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.7e-10) {
tmp = -sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= 3.7d-10) then
tmp = -sqrt((2.0d0 * ((a + a) * ((-4.0d0) * (a * (c * f)))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 3.7e-10) {
tmp = -Math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 3.7e-10: tmp = -math.sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 3.7e-10) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(-4.0 * Float64(A * Float64(C * F))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 3.7e-10)
tmp = -sqrt((2.0 * ((A + A) * (-4.0 * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 3.7e-10], N[((-N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 3.7 \cdot 10^{-10}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 3.70000000000000015e-10Initial program 16.5%
Simplified16.5%
Taylor expanded in C around inf 12.6%
cancel-sign-sub-inv12.6%
metadata-eval12.6%
*-lft-identity12.6%
Simplified12.6%
Taylor expanded in B around 0 11.3%
*-commutative11.3%
Simplified11.3%
if 3.70000000000000015e-10 < B Initial program 19.7%
Simplified19.7%
Taylor expanded in C around inf 7.7%
cancel-sign-sub-inv7.7%
metadata-eval7.7%
*-lft-identity7.7%
Simplified7.7%
Taylor expanded in B around inf 6.1%
associate-*r/6.1%
*-rgt-identity6.1%
*-commutative6.1%
Simplified6.1%
pow1/26.2%
Applied egg-rr6.2%
Final simplification10.0%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 4.5e+42)
(/
(- (sqrt (* 2.0 (* (+ A A) (* -4.0 (* (* A C) F))))))
(- (* B B) (* 4.0 (* A C))))
(* -2.0 (/ (pow (* A F) 0.5) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 4.5e+42) {
tmp = -sqrt((2.0 * ((A + A) * (-4.0 * ((A * C) * F))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= 4.5d+42) then
tmp = -sqrt((2.0d0 * ((a + a) * ((-4.0d0) * ((a * c) * f))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 4.5e+42) {
tmp = -Math.sqrt((2.0 * ((A + A) * (-4.0 * ((A * C) * F))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 4.5e+42: tmp = -math.sqrt((2.0 * ((A + A) * (-4.0 * ((A * C) * F))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 4.5e+42) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(Float64(A + A) * Float64(-4.0 * Float64(Float64(A * C) * F)))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 4.5e+42)
tmp = -sqrt((2.0 * ((A + A) * (-4.0 * ((A * C) * F))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 4.5e+42], N[((-N[Sqrt[N[(2.0 * N[(N[(A + A), $MachinePrecision] * N[(-4.0 * N[(N[(A * C), $MachinePrecision] * F), $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[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 4.5 \cdot 10^{+42}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(\left(A + A\right) \cdot \left(-4 \cdot \left(\left(A \cdot C\right) \cdot F\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 4.50000000000000012e42Initial program 16.7%
Simplified16.7%
Taylor expanded in C around inf 13.1%
cancel-sign-sub-inv13.1%
metadata-eval13.1%
*-lft-identity13.1%
Simplified13.1%
Taylor expanded in B around 0 10.9%
associate-*r*13.1%
Simplified13.1%
if 4.50000000000000012e42 < B Initial program 19.2%
Simplified19.2%
Taylor expanded in C around inf 4.9%
cancel-sign-sub-inv4.9%
metadata-eval4.9%
*-lft-identity4.9%
Simplified4.9%
Taylor expanded in B around inf 6.7%
associate-*r/6.7%
*-rgt-identity6.7%
*-commutative6.7%
Simplified6.7%
pow1/26.7%
Applied egg-rr6.7%
Final simplification11.8%
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
(FPCore (A B C F)
:precision binary64
(if (<= B 8.2e-10)
(/
(- (sqrt (* 2.0 (* -8.0 (* A (* A (* C F)))))))
(- (* B B) (* 4.0 (* A C))))
(* -2.0 (/ (pow (* A F) 0.5) B))))B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
double tmp;
if (B <= 8.2e-10) {
tmp = -sqrt((2.0 * (-8.0 * (A * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (pow((A * F), 0.5) / B);
}
return tmp;
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b <= 8.2d-10) then
tmp = -sqrt((2.0d0 * ((-8.0d0) * (a * (a * (c * f)))))) / ((b * b) - (4.0d0 * (a * c)))
else
tmp = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end if
code = tmp
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
double tmp;
if (B <= 8.2e-10) {
tmp = -Math.sqrt((2.0 * (-8.0 * (A * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
} else {
tmp = -2.0 * (Math.pow((A * F), 0.5) / B);
}
return tmp;
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): tmp = 0 if B <= 8.2e-10: tmp = -math.sqrt((2.0 * (-8.0 * (A * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C))) else: tmp = -2.0 * (math.pow((A * F), 0.5) / B) return tmp
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) tmp = 0.0 if (B <= 8.2e-10) tmp = Float64(Float64(-sqrt(Float64(2.0 * Float64(-8.0 * Float64(A * Float64(A * Float64(C * F))))))) / Float64(Float64(B * B) - Float64(4.0 * Float64(A * C)))); else tmp = Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)); end return tmp end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp_2 = code(A, B, C, F)
tmp = 0.0;
if (B <= 8.2e-10)
tmp = -sqrt((2.0 * (-8.0 * (A * (A * (C * F)))))) / ((B * B) - (4.0 * (A * C)));
else
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
tmp_2 = tmp;
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := If[LessEqual[B, 8.2e-10], N[((-N[Sqrt[N[(2.0 * N[(-8.0 * N[(A * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / N[(N[(B * B), $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
\begin{array}{l}
\mathbf{if}\;B \leq 8.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{-\sqrt{2 \cdot \left(-8 \cdot \left(A \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)\right)}}{B \cdot B - 4 \cdot \left(A \cdot C\right)}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}\\
\end{array}
\end{array}
if B < 8.1999999999999996e-10Initial program 16.5%
Simplified16.5%
Taylor expanded in C around inf 12.6%
cancel-sign-sub-inv12.6%
metadata-eval12.6%
*-lft-identity12.6%
Simplified12.6%
add-cbrt-cube5.0%
associate-*l*5.0%
cancel-sign-sub-inv5.0%
metadata-eval5.0%
associate-*l*5.0%
cancel-sign-sub-inv5.0%
metadata-eval5.0%
associate-*l*5.0%
Applied egg-rr5.0%
Taylor expanded in B around 0 7.8%
*-commutative7.8%
unpow27.8%
associate-*r*11.3%
*-commutative11.3%
Simplified11.3%
if 8.1999999999999996e-10 < B Initial program 19.7%
Simplified19.7%
Taylor expanded in C around inf 7.7%
cancel-sign-sub-inv7.7%
metadata-eval7.7%
*-lft-identity7.7%
Simplified7.7%
Taylor expanded in B around inf 6.1%
associate-*r/6.1%
*-rgt-identity6.1%
*-commutative6.1%
Simplified6.1%
pow1/26.2%
Applied egg-rr6.2%
Final simplification10.0%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (pow (* A F) 0.5) B)))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (pow((A * F), 0.5) / B);
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (((a * f) ** 0.5d0) / b)
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.pow((A * F), 0.5) / B);
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.pow((A * F), 0.5) / B)
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64((Float64(A * F) ^ 0.5) / B)) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (((A * F) ^ 0.5) / B);
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Power[N[(A * F), $MachinePrecision], 0.5], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{{\left(A \cdot F\right)}^{0.5}}{B}
\end{array}
Initial program 17.2%
Simplified17.2%
Taylor expanded in C around inf 11.4%
cancel-sign-sub-inv11.4%
metadata-eval11.4%
*-lft-identity11.4%
Simplified11.4%
Taylor expanded in B around inf 2.5%
associate-*r/2.5%
*-rgt-identity2.5%
*-commutative2.5%
Simplified2.5%
pow1/22.6%
Applied egg-rr2.6%
Final simplification2.6%
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. (FPCore (A B C F) :precision binary64 (* -2.0 (/ (sqrt (* A F)) B)))
B = abs(B);
assert(A < C);
double code(double A, double B, double C, double F) {
return -2.0 * (sqrt((A * F)) / B);
}
NOTE: B should be positive before calling this function
NOTE: A and C should be sorted in increasing order before calling this function.
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
code = (-2.0d0) * (sqrt((a * f)) / b)
end function
B = Math.abs(B);
assert A < C;
public static double code(double A, double B, double C, double F) {
return -2.0 * (Math.sqrt((A * F)) / B);
}
B = abs(B) [A, C] = sort([A, C]) def code(A, B, C, F): return -2.0 * (math.sqrt((A * F)) / B)
B = abs(B) A, C = sort([A, C]) function code(A, B, C, F) return Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B)) end
B = abs(B)
A, C = num2cell(sort([A, C])){:}
function tmp = code(A, B, C, F)
tmp = -2.0 * (sqrt((A * F)) / B);
end
NOTE: B should be positive before calling this function NOTE: A and C should be sorted in increasing order before calling this function. code[A_, B_, C_, F_] := N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
B = |B|\\
[A, C] = \mathsf{sort}([A, C])\\
\\
-2 \cdot \frac{\sqrt{A \cdot F}}{B}
\end{array}
Initial program 17.2%
Simplified17.2%
Taylor expanded in C around inf 11.4%
cancel-sign-sub-inv11.4%
metadata-eval11.4%
*-lft-identity11.4%
Simplified11.4%
Taylor expanded in B around inf 2.5%
associate-*r/2.5%
*-rgt-identity2.5%
*-commutative2.5%
Simplified2.5%
Final simplification2.5%
herbie shell --seed 2023285
(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))))