
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
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) 4e+15)
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (* -0.5 (/ (pow B_m 2.0) A)) (* 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 (pow(B_m, 2.0) <= 4e+15) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (pow(B_m, 2.0) / A)) + (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 (Math.pow(B_m, 2.0) <= 4e+15) {
tmp = Math.sqrt(((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (Math.pow(B_m, 2.0) / A)) + (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 math.pow(B_m, 2.0) <= 4e+15: tmp = math.sqrt(((2.0 * ((math.pow(B_m, 2.0) - t_0) * F)) * ((-0.5 * (math.pow(B_m, 2.0) / A)) + (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(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+15) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + 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 ^ 2.0) <= 4e+15)
tmp = sqrt(((2.0 * (((B_m ^ 2.0) - t_0) * F)) * ((-0.5 * ((B_m ^ 2.0) / A)) + (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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+15], 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[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 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 (pow.f64 B #s(literal 2 binary64)) < 4e15Initial program 18.7%
Taylor expanded in A around -inf 21.8%
if 4e15 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.2%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
*-commutative9.7%
distribute-rgt-neg-in9.7%
unpow29.7%
unpow29.7%
hypot-define18.0%
Simplified18.0%
pow1/218.0%
*-commutative18.0%
metadata-eval18.0%
unpow-prod-down30.2%
metadata-eval30.2%
pow1/230.2%
hypot-undefine12.9%
unpow212.9%
unpow212.9%
unpow212.9%
unpow212.9%
unpow212.9%
+-commutative12.9%
unpow212.9%
hypot-define30.2%
metadata-eval30.2%
pow1/230.2%
Applied egg-rr30.2%
Final simplification25.7%
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) 4e+15)
(/
(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+299)
(/ (* (sqrt 2.0) (sqrt (* F (+ C (hypot C B_m))))) (- B_m))
(* (/ (sqrt 2.0) B_m) (* (sqrt (+ A (hypot B_m A))) (- (sqrt F))))))))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) <= 4e+15) {
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+299) {
tmp = (sqrt(2.0) * sqrt((F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
}
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) <= 4e+15) {
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+299) {
tmp = (Math.sqrt(2.0) * Math.sqrt((F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt((A + Math.hypot(B_m, A))) * -Math.sqrt(F));
}
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) <= 4e+15: 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+299: tmp = (math.sqrt(2.0) * math.sqrt((F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt((A + math.hypot(B_m, A))) * -math.sqrt(F)) 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(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+15) 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+299) tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(Float64(A + hypot(B_m, A))) * Float64(-sqrt(F)))); 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) <= 4e+15)
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+299)
tmp = (sqrt(2.0) * sqrt((F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = (sqrt(2.0) / B_m) * (sqrt((A + hypot(B_m, A))) * -sqrt(F));
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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+15], 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+299], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[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[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+15}:\\
\;\;\;\;\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^{+299}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 4e15Initial program 18.7%
Taylor expanded in A around -inf 20.8%
if 4e15 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e299Initial program 27.7%
Taylor expanded in A around 0 16.3%
mul-1-neg16.3%
*-commutative16.3%
distribute-rgt-neg-in16.3%
unpow216.3%
unpow216.3%
hypot-define18.1%
Simplified18.1%
add-cube-cbrt17.9%
pow318.0%
Applied egg-rr18.0%
Applied egg-rr18.2%
if 2.0000000000000001e299 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in C around 0 1.7%
mul-1-neg1.7%
*-commutative1.7%
distribute-rgt-neg-in1.7%
+-commutative1.7%
unpow21.7%
unpow21.7%
hypot-define19.3%
Simplified19.3%
pow1/219.3%
*-commutative19.3%
metadata-eval19.3%
unpow-prod-down37.8%
metadata-eval37.8%
pow1/237.8%
metadata-eval37.8%
pow1/237.8%
Applied egg-rr37.8%
Final simplification23.7%
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) 4e+15)
(/
(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+299)
(/ (* (sqrt 2.0) (sqrt (* 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) <= 4e+15) {
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+299) {
tmp = (sqrt(2.0) * sqrt((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) <= 4e+15) {
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+299) {
tmp = (Math.sqrt(2.0) * Math.sqrt((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) <= 4e+15: 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+299: tmp = (math.sqrt(2.0) * math.sqrt((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(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+15) 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+299) tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / 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)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if ((B_m ^ 2.0) <= 4e+15)
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+299)
tmp = (sqrt(2.0) * sqrt((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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+15], 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+299], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+15}:\\
\;\;\;\;\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^{+299}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\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)) < 4e15Initial program 18.7%
Taylor expanded in A around -inf 20.8%
if 4e15 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e299Initial program 27.7%
Taylor expanded in A around 0 16.3%
mul-1-neg16.3%
*-commutative16.3%
distribute-rgt-neg-in16.3%
unpow216.3%
unpow216.3%
hypot-define18.1%
Simplified18.1%
add-cube-cbrt17.9%
pow318.0%
Applied egg-rr18.0%
Applied egg-rr18.2%
if 2.0000000000000001e299 < (pow.f64 B #s(literal 2 binary64)) Initial program 0.0%
Taylor expanded in B around inf 24.8%
mul-1-neg24.8%
*-commutative24.8%
distribute-rgt-neg-in24.8%
Simplified24.8%
sqrt-div34.5%
Applied egg-rr34.5%
Final simplification23.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 (<= (pow B_m 2.0) 4e+15)
(/
(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 (pow(B_m, 2.0) <= 4e+15) {
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 (Math.pow(B_m, 2.0) <= 4e+15) {
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 math.pow(B_m, 2.0) <= 4e+15: 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(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 4e+15) 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 ^ 2.0) <= 4e+15)
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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+15], 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 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 4 \cdot 10^{+15}:\\
\;\;\;\;\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 (pow.f64 B #s(literal 2 binary64)) < 4e15Initial program 18.7%
Taylor expanded in A around -inf 20.8%
if 4e15 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.2%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
*-commutative9.7%
distribute-rgt-neg-in9.7%
unpow29.7%
unpow29.7%
hypot-define18.0%
Simplified18.0%
pow1/218.0%
*-commutative18.0%
metadata-eval18.0%
unpow-prod-down30.2%
metadata-eval30.2%
pow1/230.2%
hypot-undefine12.9%
unpow212.9%
unpow212.9%
unpow212.9%
unpow212.9%
unpow212.9%
+-commutative12.9%
unpow212.9%
hypot-define30.2%
metadata-eval30.2%
pow1/230.2%
Applied egg-rr30.2%
Final simplification25.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 (if (<= F 1.7e+33) (/ (* (sqrt 2.0) (sqrt (* 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.7e+33) {
tmp = (sqrt(2.0) * sqrt((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.7e+33) {
tmp = (Math.sqrt(2.0) * Math.sqrt((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.7e+33: tmp = (math.sqrt(2.0) * math.sqrt((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.7e+33) tmp = Float64(Float64(sqrt(2.0) * sqrt(Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / 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 <= 1.7e+33)
tmp = (sqrt(2.0) * sqrt((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.7e+33], N[(N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[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.7 \cdot 10^{+33}:\\
\;\;\;\;\frac{\sqrt{2} \cdot \sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if F < 1.7e33Initial program 20.2%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
*-commutative7.0%
distribute-rgt-neg-in7.0%
unpow27.0%
unpow27.0%
hypot-define13.6%
Simplified13.6%
add-cube-cbrt13.5%
pow313.5%
Applied egg-rr13.5%
Applied egg-rr13.6%
if 1.7e33 < F Initial program 12.2%
Taylor expanded in B around inf 20.2%
mul-1-neg20.2%
*-commutative20.2%
distribute-rgt-neg-in20.2%
Simplified20.2%
sqrt-div21.6%
Applied egg-rr21.6%
Final simplification16.8%
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.8e+30) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot B_m C)))))) (* (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 <= 5.8e+30) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
} 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 <= 5.8e+30) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C + Math.hypot(B_m, C))));
} 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 <= 5.8e+30: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C + math.hypot(B_m, C)))) 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 <= 5.8e+30) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / 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 <= 5.8e+30)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(B_m, C))));
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, 5.8e+30], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $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 5.8 \cdot 10^{+30}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if F < 5.7999999999999996e30Initial program 19.7%
Taylor expanded in A around 0 7.0%
mul-1-neg7.0%
*-commutative7.0%
distribute-rgt-neg-in7.0%
unpow27.0%
unpow27.0%
hypot-define13.6%
Simplified13.6%
if 5.7999999999999996e30 < F Initial program 13.1%
Taylor expanded in B around inf 20.0%
mul-1-neg20.0%
*-commutative20.0%
distribute-rgt-neg-in20.0%
Simplified20.0%
sqrt-div21.4%
Applied egg-rr21.4%
Final simplification16.8%
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) (/ (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) {
return sqrt(2.0) * (sqrt(F) / -sqrt(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) * (sqrt(f) / -sqrt(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) * (Math.sqrt(F) / -Math.sqrt(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) * (math.sqrt(F) / -math.sqrt(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(2.0) * Float64(sqrt(F) / Float64(-sqrt(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) * (sqrt(F) / -sqrt(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[(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])\\
\\
\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.3%
mul-1-neg13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
Simplified13.3%
sqrt-div15.8%
Applied egg-rr15.8%
Final simplification15.8%
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.6e+27) (* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ B_m C))))) (* (sqrt 2.0) (/ -1.0 (sqrt (/ B_m F))))))
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.6e+27) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
} else {
tmp = sqrt(2.0) * (-1.0 / sqrt((B_m / F)));
}
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 <= 1.6d+27) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((f * (b_m + c)))
else
tmp = sqrt(2.0d0) * ((-1.0d0) / sqrt((b_m / f)))
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 <= 1.6e+27) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (B_m + C)));
} else {
tmp = Math.sqrt(2.0) * (-1.0 / Math.sqrt((B_m / F)));
}
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.6e+27: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (B_m + C))) else: tmp = math.sqrt(2.0) * (-1.0 / math.sqrt((B_m / F))) 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.6e+27) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(B_m + C))))); else tmp = Float64(sqrt(2.0) * Float64(-1.0 / sqrt(Float64(B_m / F)))); 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.6e+27)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
else
tmp = sqrt(2.0) * (-1.0 / sqrt((B_m / F)));
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.6e+27], 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[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / N[Sqrt[N[(B$95$m / F), $MachinePrecision]], $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.6 \cdot 10^{+27}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(B\_m + C\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-1}{\sqrt{\frac{B\_m}{F}}}\\
\end{array}
\end{array}
if F < 1.60000000000000008e27Initial program 20.1%
Taylor expanded in A around 0 7.1%
mul-1-neg7.1%
*-commutative7.1%
distribute-rgt-neg-in7.1%
unpow27.1%
unpow27.1%
hypot-define13.2%
Simplified13.2%
Taylor expanded in C around 0 11.0%
+-commutative11.0%
Simplified11.0%
if 1.60000000000000008e27 < F Initial program 12.7%
Taylor expanded in B around inf 20.3%
mul-1-neg20.3%
*-commutative20.3%
distribute-rgt-neg-in20.3%
Simplified20.3%
sqrt-div21.7%
Applied egg-rr21.7%
Applied egg-rr20.5%
unpow-120.5%
Simplified20.5%
Final simplification14.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 (if (<= F 1.1e+35) (* (/ (sqrt 2.0) (- B_m)) (sqrt (* B_m F))) (* (sqrt 2.0) (/ -1.0 (sqrt (/ B_m F))))))
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.1e+35) {
tmp = (sqrt(2.0) / -B_m) * sqrt((B_m * F));
} else {
tmp = sqrt(2.0) * (-1.0 / sqrt((B_m / F)));
}
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 <= 1.1d+35) then
tmp = (sqrt(2.0d0) / -b_m) * sqrt((b_m * f))
else
tmp = sqrt(2.0d0) * ((-1.0d0) / sqrt((b_m / f)))
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 <= 1.1e+35) {
tmp = (Math.sqrt(2.0) / -B_m) * Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt(2.0) * (-1.0 / Math.sqrt((B_m / F)));
}
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.1e+35: tmp = (math.sqrt(2.0) / -B_m) * math.sqrt((B_m * F)) else: tmp = math.sqrt(2.0) * (-1.0 / math.sqrt((B_m / F))) 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.1e+35) tmp = Float64(Float64(sqrt(2.0) / Float64(-B_m)) * sqrt(Float64(B_m * F))); else tmp = Float64(sqrt(2.0) * Float64(-1.0 / sqrt(Float64(B_m / F)))); 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.1e+35)
tmp = (sqrt(2.0) / -B_m) * sqrt((B_m * F));
else
tmp = sqrt(2.0) * (-1.0 / sqrt((B_m / F)));
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.1e+35], N[(N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision] * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(-1.0 / N[Sqrt[N[(B$95$m / F), $MachinePrecision]], $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.1 \cdot 10^{+35}:\\
\;\;\;\;\frac{\sqrt{2}}{-B\_m} \cdot \sqrt{B\_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{-1}{\sqrt{\frac{B\_m}{F}}}\\
\end{array}
\end{array}
if F < 1.0999999999999999e35Initial program 20.1%
Taylor expanded in A around 0 6.9%
mul-1-neg6.9%
*-commutative6.9%
distribute-rgt-neg-in6.9%
unpow26.9%
unpow26.9%
hypot-define13.5%
Simplified13.5%
Taylor expanded in C around 0 12.4%
if 1.0999999999999999e35 < F Initial program 12.3%
Taylor expanded in B around inf 20.3%
mul-1-neg20.3%
*-commutative20.3%
distribute-rgt-neg-in20.3%
Simplified20.3%
sqrt-div21.8%
Applied egg-rr21.8%
Applied egg-rr20.5%
unpow-120.5%
Simplified20.5%
Final simplification15.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 (if (<= C 7.5e+107) (- (pow (* 2.0 (/ F B_m)) 0.5)) (* (sqrt (* C F)) (/ -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 tmp;
if (C <= 7.5e+107) {
tmp = -pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = sqrt((C * F)) * (-2.0 / 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 <= 7.5d+107) then
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
else
tmp = sqrt((c * f)) * ((-2.0d0) / 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 <= 7.5e+107) {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = Math.sqrt((C * F)) * (-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): tmp = 0 if C <= 7.5e+107: tmp = -math.pow((2.0 * (F / B_m)), 0.5) else: tmp = math.sqrt((C * F)) * (-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) tmp = 0.0 if (C <= 7.5e+107) tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); else tmp = Float64(sqrt(Float64(C * F)) * Float64(-2.0 / 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 <= 7.5e+107)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
else
tmp = sqrt((C * F)) * (-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_] := If[LessEqual[C, 7.5e+107], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), N[(N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / 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}\;C \leq 7.5 \cdot 10^{+107}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{C \cdot F} \cdot \frac{-2}{B\_m}\\
\end{array}
\end{array}
if C < 7.4999999999999996e107Initial program 17.8%
Taylor expanded in B around inf 14.7%
mul-1-neg14.7%
*-commutative14.7%
distribute-rgt-neg-in14.7%
Simplified14.7%
distribute-rgt-neg-out14.7%
pow1/214.7%
metadata-eval14.7%
pow1/214.8%
metadata-eval14.8%
pow-prod-down14.9%
metadata-eval14.9%
Applied egg-rr14.9%
if 7.4999999999999996e107 < C Initial program 12.4%
Taylor expanded in A around 0 1.3%
mul-1-neg1.3%
*-commutative1.3%
distribute-rgt-neg-in1.3%
unpow21.3%
unpow21.3%
hypot-define4.4%
Simplified4.4%
add-cube-cbrt4.3%
pow34.3%
Applied egg-rr4.3%
Taylor expanded in C around inf 4.5%
*-commutative4.5%
*-commutative4.5%
rem-cube-cbrt4.5%
unpow24.5%
rem-square-sqrt4.5%
metadata-eval4.5%
Simplified4.5%
Final simplification13.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 (- (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 17.1%
Taylor expanded in B around inf 13.3%
mul-1-neg13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
Simplified13.3%
distribute-rgt-neg-out13.3%
pow1/213.3%
metadata-eval13.3%
pow1/213.5%
metadata-eval13.5%
pow-prod-down13.5%
metadata-eval13.5%
Applied egg-rr13.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 (- (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(2.0 * Float64(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[(2.0 * N[(F / 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])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.3%
mul-1-neg13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
Simplified13.3%
pow113.3%
distribute-rgt-neg-out13.3%
pow1/213.3%
metadata-eval13.3%
pow1/213.5%
metadata-eval13.5%
pow-prod-down13.5%
metadata-eval13.5%
Applied egg-rr13.5%
unpow113.5%
unpow1/213.3%
Simplified13.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 (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 sqrt(Float64(2.0 * Float64(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[(2.0 * N[(F / 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])\\
\\
\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.3%
mul-1-neg13.3%
*-commutative13.3%
distribute-rgt-neg-in13.3%
Simplified13.3%
sqrt-div15.8%
Applied egg-rr15.8%
Applied egg-rr1.7%
unpow11.7%
*-commutative1.7%
Simplified1.7%
Final simplification1.7%
herbie shell --seed 2024086
(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))))