
(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 14 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}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))) (t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 4e-149)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(if (<= B_m 2.1e+20)
(/
(* (sqrt (* 2.0 (* F t_1))) (sqrt (+ (+ A C) (hypot B_m (- A C)))))
(- t_1))
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) (/ (sqrt 2.0) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 4e-149) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else if (B_m <= 2.1e+20) {
tmp = (sqrt((2.0 * (F * t_1))) * sqrt(((A + C) + hypot(B_m, (A - C))))) / -t_1;
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 4e-149) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); elseif (B_m <= 2.1e+20) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_1))) * sqrt(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))) / Float64(-t_1)); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 4e-149], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.1e+20], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 4 \cdot 10^{-149}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2.1 \cdot 10^{+20}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t\_1\right)} \cdot \sqrt{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}}{-t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 3.99999999999999992e-149Initial program 22.6%
Simplified23.0%
Taylor expanded in A around -inf 18.9%
*-commutative18.9%
Simplified18.9%
if 3.99999999999999992e-149 < B < 2.1e20Initial program 26.4%
Simplified38.7%
associate-*r*38.7%
hypot-undefine26.4%
unpow226.4%
unpow226.4%
sqrt-prod34.2%
*-commutative34.2%
unpow234.2%
unpow234.2%
Applied egg-rr52.6%
if 2.1e20 < B Initial program 5.8%
Simplified5.7%
Taylor expanded in A around 0 11.3%
mul-1-neg11.3%
*-commutative11.3%
distribute-rgt-neg-in11.3%
+-commutative11.3%
unpow211.3%
unpow211.3%
hypot-define34.2%
Simplified34.2%
pow1/234.3%
*-commutative34.3%
hypot-undefine11.3%
unpow211.3%
unpow211.3%
+-commutative11.3%
unpow-prod-down11.4%
pow1/211.4%
+-commutative11.4%
unpow211.4%
unpow211.4%
hypot-undefine53.7%
pow1/253.7%
Applied egg-rr53.7%
Final simplification30.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))) (t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e-299)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e+36)
(*
(sqrt (* F (* 2.0 t_1)))
(- (/ (sqrt (+ A (+ C (hypot B_m (- A C))))) t_1)))
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) (/ (sqrt 2.0) (- B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-299) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e+36) {
tmp = sqrt((F * (2.0 * t_1))) * -(sqrt((A + (C + hypot(B_m, (A - C))))) / t_1);
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(4.0 * Float64(A * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-299) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e+36) tmp = Float64(sqrt(Float64(F * Float64(2.0 * t_1))) * Float64(-Float64(sqrt(Float64(A + Float64(C + hypot(B_m, Float64(A - C))))) / t_1))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-299], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+36], N[(N[Sqrt[N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[(N[Sqrt[N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision])), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-299}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+36}:\\
\;\;\;\;\sqrt{F \cdot \left(2 \cdot t\_1\right)} \cdot \left(-\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999956e-299Initial program 25.5%
Simplified26.1%
Taylor expanded in A around -inf 34.6%
*-commutative34.6%
Simplified34.6%
if 4.99999999999999956e-299 < (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000008e36Initial program 30.3%
Simplified38.8%
associate-*r*38.8%
hypot-undefine30.6%
unpow230.6%
unpow230.6%
sqrt-prod36.8%
*-commutative36.8%
unpow236.8%
unpow236.8%
Applied egg-rr54.5%
associate-/l*54.5%
associate-*l*54.5%
associate-+l+54.8%
Applied egg-rr54.8%
if 2.00000000000000008e36 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.8%
Simplified10.8%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define17.0%
Simplified17.0%
pow1/217.0%
*-commutative17.0%
hypot-undefine5.9%
unpow25.9%
unpow25.9%
+-commutative5.9%
unpow-prod-down5.9%
pow1/25.9%
+-commutative5.9%
unpow25.9%
unpow25.9%
hypot-undefine26.0%
pow1/226.0%
Applied egg-rr26.0%
Final simplification34.6%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))))
(if (<= (pow B_m 2.0) 2e-117)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e+267)
(/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m))
(* (sqrt 2.0) (/ (- (sqrt F)) (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double tmp;
if (pow(B_m, 2.0) <= 2e-117) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e+267) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-117) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 2e+267) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = Math.sqrt(2.0) * (-Math.sqrt(F) / Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = 4.0 * (A * C) tmp = 0 if math.pow(B_m, 2.0) <= 2e-117: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 2e+267: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = math.sqrt(2.0) * (-math.sqrt(F) / math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(4.0 * Float64(A * C)) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-117) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e+267) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = 4.0 * (A * C);
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-117)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 2e+267)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-117], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+267], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-117}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+267}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2.00000000000000006e-117Initial program 24.5%
Simplified24.9%
Taylor expanded in A around -inf 33.0%
*-commutative33.0%
Simplified33.0%
if 2.00000000000000006e-117 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e267Initial program 35.7%
Simplified35.9%
Taylor expanded in A around 0 13.5%
mul-1-neg13.5%
*-commutative13.5%
distribute-rgt-neg-in13.5%
+-commutative13.5%
unpow213.5%
unpow213.5%
hypot-define15.3%
Simplified15.3%
pow115.3%
Applied egg-rr15.5%
unpow115.5%
distribute-neg-frac215.5%
unpow1/215.4%
Simplified15.4%
if 1.9999999999999999e267 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.2%
Simplified0.2%
Taylor expanded in B around inf 17.9%
mul-1-neg17.9%
distribute-rgt-neg-in17.9%
Simplified17.9%
sqrt-div23.8%
Applied egg-rr23.8%
Final simplification25.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* 4.0 (* A C))))
(if (<= B_m 7.2e-59)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_0) F)) (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) (/ (sqrt 2.0) (- B_m))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double tmp;
if (B_m <= 7.2e-59) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double t_0 = 4.0 * (A * C);
double tmp;
if (B_m <= 7.2e-59) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else {
tmp = (Math.sqrt((C + Math.hypot(C, B_m))) * Math.sqrt(F)) * (Math.sqrt(2.0) / -B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): t_0 = 4.0 * (A * C) tmp = 0 if B_m <= 7.2e-59: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) else: tmp = (math.sqrt((C + math.hypot(C, B_m))) * math.sqrt(F)) * (math.sqrt(2.0) / -B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(4.0 * Float64(A * C)) tmp = 0.0 if (B_m <= 7.2e-59) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
t_0 = 4.0 * (A * C);
tmp = 0.0;
if (B_m <= 7.2e-59)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * (2.0 * C))) / (t_0 - (B_m ^ 2.0));
else
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (sqrt(2.0) / -B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 7.2e-59], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := 4 \cdot \left(A \cdot C\right)\\
\mathbf{if}\;B\_m \leq 7.2 \cdot 10^{-59}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 7.20000000000000001e-59Initial program 23.2%
Simplified23.5%
Taylor expanded in A around -inf 20.1%
*-commutative20.1%
Simplified20.1%
if 7.20000000000000001e-59 < B Initial program 8.1%
Simplified8.0%
Taylor expanded in A around 0 14.4%
mul-1-neg14.4%
*-commutative14.4%
distribute-rgt-neg-in14.4%
+-commutative14.4%
unpow214.4%
unpow214.4%
hypot-define34.2%
Simplified34.2%
pow1/234.2%
*-commutative34.2%
hypot-undefine14.5%
unpow214.5%
unpow214.5%
+-commutative14.5%
unpow-prod-down14.5%
pow1/214.5%
+-commutative14.5%
unpow214.5%
unpow214.5%
hypot-undefine50.8%
pow1/250.8%
Applied egg-rr50.8%
Final simplification28.3%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 5.4e+18) (/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m)) (* (sqrt 2.0) (- (* (sqrt F) (pow B_m -0.5))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 5.4e+18) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = sqrt(2.0) * -(sqrt(F) * pow(B_m, -0.5));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 5.4e+18) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = Math.sqrt(2.0) * -(Math.sqrt(F) * Math.pow(B_m, -0.5));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 5.4e+18: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = math.sqrt(2.0) * -(math.sqrt(F) * math.pow(B_m, -0.5)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 5.4e+18) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(-Float64(sqrt(F) * (B_m ^ -0.5)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 5.4e+18)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = sqrt(2.0) * -(sqrt(F) * (B_m ^ -0.5));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 5.4e+18], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[(N[Sqrt[F], $MachinePrecision] * N[Power[B$95$m, -0.5], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 5.4 \cdot 10^{+18}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F} \cdot {B\_m}^{-0.5}\right)\\
\end{array}
\end{array}
if F < 5.4e18Initial program 19.3%
Simplified19.6%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define14.4%
Simplified14.4%
pow114.4%
Applied egg-rr14.6%
unpow114.6%
distribute-neg-frac214.6%
unpow1/214.5%
Simplified14.5%
if 5.4e18 < F Initial program 19.0%
Simplified19.1%
Taylor expanded in B around inf 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
Simplified16.4%
sqrt-div16.7%
Applied egg-rr16.7%
div-inv16.7%
pow1/216.7%
pow-flip16.7%
metadata-eval16.7%
Applied egg-rr16.7%
Final simplification15.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 64000000000000.0) (/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m)) (* (sqrt F) (/ (sqrt 2.0) (- (sqrt B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 64000000000000.0) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = sqrt(F) * (sqrt(2.0) / -sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 64000000000000.0) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = Math.sqrt(F) * (Math.sqrt(2.0) / -Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 64000000000000.0: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = math.sqrt(F) * (math.sqrt(2.0) / -math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 64000000000000.0) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(F) * Float64(sqrt(2.0) / Float64(-sqrt(B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 64000000000000.0)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = sqrt(F) * (sqrt(2.0) / -sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 64000000000000.0], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 64000000000000:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \frac{\sqrt{2}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if F < 6.4e13Initial program 19.5%
Simplified19.8%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
+-commutative5.9%
unpow25.9%
unpow25.9%
hypot-define14.5%
Simplified14.5%
pow114.5%
Applied egg-rr14.7%
unpow114.7%
distribute-neg-frac214.7%
unpow1/214.6%
Simplified14.6%
if 6.4e13 < F Initial program 18.8%
Simplified18.9%
Taylor expanded in B around inf 16.3%
mul-1-neg16.3%
distribute-rgt-neg-in16.3%
Simplified16.3%
sqrt-div16.5%
Applied egg-rr16.5%
associate-*l/16.5%
Applied egg-rr16.5%
associate-/l*16.5%
Simplified16.5%
Final simplification15.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 1.06e+15) (/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m)) (* (sqrt 2.0) (/ (- (sqrt F)) (sqrt B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.06e+15) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 1.06e+15) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = Math.sqrt(2.0) * (-Math.sqrt(F) / Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 1.06e+15: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = math.sqrt(2.0) * (-math.sqrt(F) / math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 1.06e+15) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(Float64(-sqrt(F)) / sqrt(B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 1.06e+15)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = sqrt(2.0) * (-sqrt(F) / sqrt(B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 1.06e+15], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[((-N[Sqrt[F], $MachinePrecision]) / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 1.06 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-\sqrt{F}}{\sqrt{B\_m}}\\
\end{array}
\end{array}
if F < 1.06e15Initial program 19.3%
Simplified19.6%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define14.4%
Simplified14.4%
pow114.4%
Applied egg-rr14.6%
unpow114.6%
distribute-neg-frac214.6%
unpow1/214.5%
Simplified14.5%
if 1.06e15 < F Initial program 19.0%
Simplified19.1%
Taylor expanded in B around inf 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
Simplified16.4%
sqrt-div16.7%
Applied egg-rr16.7%
Final simplification15.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 5.5e+17) (/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m)) (/ (- (* (sqrt F) (sqrt 2.0))) (sqrt B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 5.5e+17) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = -(sqrt(F) * sqrt(2.0)) / sqrt(B_m);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 5.5e+17) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = -(Math.sqrt(F) * Math.sqrt(2.0)) / Math.sqrt(B_m);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 5.5e+17: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = -(math.sqrt(F) * math.sqrt(2.0)) / math.sqrt(B_m) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 5.5e+17) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(Float64(-Float64(sqrt(F) * sqrt(2.0))) / sqrt(B_m)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 5.5e+17)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = -(sqrt(F) * sqrt(2.0)) / sqrt(B_m);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 5.5e+17], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[((-N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]) / N[Sqrt[B$95$m], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 5.5 \cdot 10^{+17}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{-\sqrt{F} \cdot \sqrt{2}}{\sqrt{B\_m}}\\
\end{array}
\end{array}
if F < 5.5e17Initial program 19.3%
Simplified19.6%
Taylor expanded in A around 0 5.8%
mul-1-neg5.8%
*-commutative5.8%
distribute-rgt-neg-in5.8%
+-commutative5.8%
unpow25.8%
unpow25.8%
hypot-define14.4%
Simplified14.4%
pow114.4%
Applied egg-rr14.6%
unpow114.6%
distribute-neg-frac214.6%
unpow1/214.5%
Simplified14.5%
if 5.5e17 < F Initial program 19.0%
Simplified19.1%
Taylor expanded in B around inf 16.4%
mul-1-neg16.4%
distribute-rgt-neg-in16.4%
Simplified16.4%
sqrt-div16.7%
Applied egg-rr16.7%
associate-*l/16.7%
Applied egg-rr16.7%
Final simplification15.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 2500000000000.0) (/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m)) (- (pow (* 2.0 (/ F B_m)) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2500000000000.0) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = -pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2500000000000.0) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 2500000000000.0: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = -math.pow((2.0 * (F / B_m)), 0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 2500000000000.0) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 2500000000000.0)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 2500000000000.0], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2500000000000:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\end{array}
\end{array}
if F < 2.5e12Initial program 19.5%
Simplified19.8%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
+-commutative5.9%
unpow25.9%
unpow25.9%
hypot-define14.5%
Simplified14.5%
pow114.5%
Applied egg-rr14.7%
unpow114.7%
distribute-neg-frac214.7%
unpow1/214.6%
Simplified14.6%
if 2.5e12 < F Initial program 18.8%
Simplified18.9%
Taylor expanded in B around inf 16.3%
mul-1-neg16.3%
distribute-rgt-neg-in16.3%
Simplified16.3%
distribute-rgt-neg-out16.3%
pow1/216.6%
pow1/216.6%
pow-prod-down16.6%
Applied egg-rr16.6%
Final simplification15.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 60000000000.0) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ B_m C))))) (- (pow (* 2.0 (/ F B_m)) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 60000000000.0) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
} else {
tmp = -pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 60000000000.0d0) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((f * (b_m + c)))
else
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 60000000000.0) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (B_m + C)));
} else {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 60000000000.0: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (B_m + C))) else: tmp = -math.pow((2.0 * (F / B_m)), 0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 60000000000.0) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(B_m + C))))); else tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 60000000000.0)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
else
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 60000000000.0], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B$95$m + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 60000000000:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(B\_m + C\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\end{array}
\end{array}
if F < 6e10Initial program 19.5%
Simplified19.8%
Taylor expanded in A around 0 5.9%
mul-1-neg5.9%
*-commutative5.9%
distribute-rgt-neg-in5.9%
+-commutative5.9%
unpow25.9%
unpow25.9%
hypot-define14.5%
Simplified14.5%
Taylor expanded in C around 0 11.1%
+-commutative11.1%
Simplified11.1%
if 6e10 < F Initial program 18.8%
Simplified18.9%
Taylor expanded in B around inf 16.3%
mul-1-neg16.3%
distribute-rgt-neg-in16.3%
Simplified16.3%
distribute-rgt-neg-out16.3%
pow1/216.6%
pow1/216.6%
pow-prod-down16.6%
Applied egg-rr16.6%
Final simplification13.3%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= F 2.3e-28) (- (* (/ (sqrt 2.0) B_m) (sqrt (* B_m F)))) (- (pow (* 2.0 (/ F B_m)) 0.5))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2.3e-28) {
tmp = -((sqrt(2.0) / B_m) * sqrt((B_m * F)));
} else {
tmp = -pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 2.3d-28) then
tmp = -((sqrt(2.0d0) / b_m) * sqrt((b_m * f)))
else
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2.3e-28) {
tmp = -((Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * F)));
} else {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 2.3e-28: tmp = -((math.sqrt(2.0) / B_m) * math.sqrt((B_m * F))) else: tmp = -math.pow((2.0 * (F / B_m)), 0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 2.3e-28) tmp = Float64(-Float64(Float64(sqrt(2.0) / B_m) * sqrt(Float64(B_m * F)))); else tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 2.3e-28)
tmp = -((sqrt(2.0) / B_m) * sqrt((B_m * F)));
else
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 2.3e-28], (-N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq 2.3 \cdot 10^{-28}:\\
\;\;\;\;-\frac{\sqrt{2}}{B\_m} \cdot \sqrt{B\_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\end{array}
\end{array}
if F < 2.29999999999999986e-28Initial program 19.8%
Simplified20.1%
Taylor expanded in A around 0 4.9%
mul-1-neg4.9%
*-commutative4.9%
distribute-rgt-neg-in4.9%
+-commutative4.9%
unpow24.9%
unpow24.9%
hypot-define13.2%
Simplified13.2%
Taylor expanded in C around 0 12.1%
if 2.29999999999999986e-28 < F Initial program 18.5%
Simplified18.7%
Taylor expanded in B around inf 15.9%
mul-1-neg15.9%
distribute-rgt-neg-in15.9%
Simplified15.9%
distribute-rgt-neg-out15.9%
pow1/216.2%
pow1/216.2%
pow-prod-down16.2%
Applied egg-rr16.2%
Final simplification14.0%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= C 4e+215) (- (pow (* 2.0 (/ F B_m)) 0.5)) (/ (* -2.0 (sqrt (* C F))) B_m)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 4e+215) {
tmp = -pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = (-2.0 * sqrt((C * F))) / B_m;
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 4d+215) then
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
else
tmp = ((-2.0d0) * sqrt((c * f))) / b_m
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 4e+215) {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = (-2.0 * Math.sqrt((C * F))) / B_m;
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 4e+215: tmp = -math.pow((2.0 * (F / B_m)), 0.5) else: tmp = (-2.0 * math.sqrt((C * F))) / B_m return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 4e+215) tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); else tmp = Float64(Float64(-2.0 * sqrt(Float64(C * F))) / B_m); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 4e+215)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
else
tmp = (-2.0 * sqrt((C * F))) / B_m;
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 4e+215], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), N[(N[(-2.0 * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 4 \cdot 10^{+215}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;\frac{-2 \cdot \sqrt{C \cdot F}}{B\_m}\\
\end{array}
\end{array}
if C < 3.99999999999999963e215Initial program 21.0%
Simplified21.2%
Taylor expanded in B around inf 11.6%
mul-1-neg11.6%
distribute-rgt-neg-in11.6%
Simplified11.6%
distribute-rgt-neg-out11.6%
pow1/211.7%
pow1/211.7%
pow-prod-down11.7%
Applied egg-rr11.7%
if 3.99999999999999963e215 < C Initial program 1.4%
Simplified1.4%
Taylor expanded in A around 0 0.9%
mul-1-neg0.9%
*-commutative0.9%
distribute-rgt-neg-in0.9%
+-commutative0.9%
unpow20.9%
unpow20.9%
hypot-define9.7%
Simplified9.7%
div-inv9.7%
Applied egg-rr9.7%
Taylor expanded in C around inf 9.6%
mul-1-neg9.6%
associate-*l/9.6%
*-commutative9.6%
distribute-neg-frac9.6%
*-commutative9.6%
unpow29.6%
rem-square-sqrt9.7%
distribute-lft-neg-in9.7%
metadata-eval9.7%
*-commutative9.7%
Simplified9.7%
Final simplification11.5%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (pow (* 2.0 (/ F B_m)) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -pow((2.0 * (F / B_m)), 0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -((2.0d0 * (f / b_m)) ** 0.5d0)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.pow((2.0 * (F / B_m)), 0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.pow((2.0 * (F / B_m)), 0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}
\end{array}
Initial program 19.2%
Simplified19.4%
Taylor expanded in B around inf 10.8%
mul-1-neg10.8%
distribute-rgt-neg-in10.8%
Simplified10.8%
distribute-rgt-neg-out10.8%
pow1/210.9%
pow1/210.9%
pow-prod-down10.9%
Applied egg-rr10.9%
Final simplification10.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (/ (* 2.0 F) B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt(((2.0 * F) / B_m));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt(((2.0d0 * f) / b_m))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt(((2.0 * F) / B_m));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt(((2.0 * F) / B_m))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(Float64(2.0 * F) / B_m))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt(((2.0 * F) / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{2 \cdot F}{B\_m}}
\end{array}
Initial program 19.2%
Simplified19.4%
Taylor expanded in B around inf 10.8%
mul-1-neg10.8%
distribute-rgt-neg-in10.8%
Simplified10.8%
pow110.8%
distribute-rgt-neg-out10.8%
pow1/210.9%
pow1/210.9%
pow-prod-down10.9%
Applied egg-rr10.9%
unpow110.9%
unpow1/210.8%
associate-*l/10.8%
Simplified10.8%
Final simplification10.8%
herbie shell --seed 2024085
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))