
(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 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 3.5e-256)
(/
(exp (* (+ (log (* -16.0 (* F C))) (* -2.0 (log (/ -1.0 A)))) 0.5))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(if (<= B_m 1.4e-6)
(/ (sqrt (* (* F t_0) (* A 4.0))) (- t_0))
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 3.5e-256) {
tmp = exp(((log((-16.0 * (F * C))) + (-2.0 * log((-1.0 / A)))) * 0.5)) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else if (B_m <= 1.4e-6) {
tmp = sqrt(((F * t_0) * (A * 4.0))) / -t_0;
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 3.5e-256) tmp = Float64(exp(Float64(Float64(log(Float64(-16.0 * Float64(F * C))) + Float64(-2.0 * log(Float64(-1.0 / A)))) * 0.5)) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); elseif (B_m <= 1.4e-6) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(A * 4.0))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.5e-256], N[(N[Exp[N[(N[(N[Log[N[(-16.0 * N[(F * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(-2.0 * N[Log[N[(-1.0 / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 1.4e-6], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 3.5 \cdot 10^{-256}:\\
\;\;\;\;\frac{e^{\left(\log \left(-16 \cdot \left(F \cdot C\right)\right) + -2 \cdot \log \left(\frac{-1}{A}\right)\right) \cdot 0.5}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{elif}\;B\_m \leq 1.4 \cdot 10^{-6}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(A \cdot 4\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 3.50000000000000014e-256Initial program 17.9%
Simplified20.2%
Taylor expanded in A around -inf 9.3%
pow1/29.4%
pow-to-exp8.8%
associate-*r*8.9%
*-commutative8.9%
Applied egg-rr8.9%
Taylor expanded in A around -inf 12.1%
*-commutative12.1%
Simplified12.1%
if 3.50000000000000014e-256 < B < 1.39999999999999994e-6Initial program 22.9%
Simplified28.6%
Taylor expanded in A around -inf 32.9%
if 1.39999999999999994e-6 < B Initial program 9.1%
Taylor expanded in C around 0 21.6%
mul-1-neg21.6%
+-commutative21.6%
unpow221.6%
unpow221.6%
hypot-define46.1%
Simplified46.1%
neg-sub046.1%
associate-*l/45.9%
pow1/245.9%
pow1/245.9%
pow-prod-down46.2%
Applied egg-rr46.2%
neg-sub046.2%
distribute-neg-frac246.2%
unpow1/246.2%
Simplified46.2%
Final simplification24.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 (<= (pow B_m 2.0) 2e-159)
(/
(sqrt (* -8.0 (* A (* C (* F (+ A A))))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 (pow(B_m, 2.0) <= 2e-159) {
tmp = sqrt((-8.0 * (A * (C * (F * (A + A)))))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 ((B_m ^ 2.0) <= 2e-159) tmp = Float64(sqrt(Float64(-8.0 * Float64(A * Float64(C * Float64(F * Float64(A + A)))))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-159], N[(N[Sqrt[N[(-8.0 * N[(A * N[(C * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}\;{B\_m}^{2} \leq 2 \cdot 10^{-159}:\\
\;\;\;\;\frac{\sqrt{-8 \cdot \left(A \cdot \left(C \cdot \left(F \cdot \left(A + A\right)\right)\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999998e-159Initial program 18.4%
Simplified23.4%
Taylor expanded in C around inf 25.4%
if 1.99999999999999998e-159 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.6%
Taylor expanded in C around 0 10.9%
mul-1-neg10.9%
+-commutative10.9%
unpow210.9%
unpow210.9%
hypot-define21.2%
Simplified21.2%
neg-sub021.2%
associate-*l/21.2%
pow1/221.2%
pow1/221.2%
pow-prod-down21.3%
Applied egg-rr21.3%
neg-sub021.3%
distribute-neg-frac221.3%
unpow1/221.3%
Simplified21.3%
Final simplification22.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
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 2.5e-5)
(/ (sqrt (* (* F t_0) (* A 4.0))) (- t_0))
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.5e-5) {
tmp = sqrt(((F * t_0) * (A * 4.0))) / -t_0;
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.5e-5) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(A * 4.0))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.5e-5], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 2.5 \cdot 10^{-5}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(A \cdot 4\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.50000000000000012e-5Initial program 19.2%
Simplified26.0%
Taylor expanded in A around -inf 18.8%
if 2.50000000000000012e-5 < B Initial program 9.1%
Taylor expanded in C around 0 21.6%
mul-1-neg21.6%
+-commutative21.6%
unpow221.6%
unpow221.6%
hypot-define46.1%
Simplified46.1%
neg-sub046.1%
associate-*l/45.9%
pow1/245.9%
pow1/245.9%
pow-prod-down46.2%
Applied egg-rr46.2%
neg-sub046.2%
distribute-neg-frac246.2%
unpow1/246.2%
Simplified46.2%
Final simplification25.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 (<= B_m 9e-80)
(/
(sqrt (* (* A -8.0) (* (* F C) (+ A A))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 (B_m <= 9e-80) {
tmp = sqrt(((A * -8.0) * ((F * C) * (A + A)))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 (B_m <= 9e-80) tmp = Float64(sqrt(Float64(Float64(A * -8.0) * Float64(Float64(F * C) * Float64(A + A)))) / Float64(-fma(C, Float64(A * -4.0), (B_m ^ 2.0)))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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_] := If[LessEqual[B$95$m, 9e-80], N[(N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(N[(F * C), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(C * N[(A * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}\;B\_m \leq 9 \cdot 10^{-80}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(F \cdot C\right) \cdot \left(A + A\right)\right)}}{-\mathsf{fma}\left(C, A \cdot -4, {B\_m}^{2}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 9.0000000000000006e-80Initial program 18.7%
Simplified22.2%
Taylor expanded in C around inf 16.9%
associate-*r*16.9%
associate-*r*15.0%
mul-1-neg15.0%
Simplified15.0%
if 9.0000000000000006e-80 < B Initial program 11.9%
Taylor expanded in C around 0 21.1%
mul-1-neg21.1%
+-commutative21.1%
unpow221.1%
unpow221.1%
hypot-define41.3%
Simplified41.3%
neg-sub041.3%
associate-*l/41.2%
pow1/241.2%
pow1/241.2%
pow-prod-down41.4%
Applied egg-rr41.4%
neg-sub041.4%
distribute-neg-frac241.4%
unpow1/241.4%
Simplified41.4%
Final simplification22.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
(if (<= B_m 5.5e-103)
(/
(sqrt (* -16.0 (* (* F C) (pow A 2.0))))
(- (* 4.0 (* C A)) (pow B_m 2.0)))
(/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 (B_m <= 5.5e-103) {
tmp = sqrt((-16.0 * ((F * C) * pow(A, 2.0)))) / ((4.0 * (C * A)) - pow(B_m, 2.0));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 (B_m <= 5.5e-103) {
tmp = Math.sqrt((-16.0 * ((F * C) * Math.pow(A, 2.0)))) / ((4.0 * (C * A)) - Math.pow(B_m, 2.0));
} else {
tmp = Math.sqrt((2.0 * (F * (A - Math.hypot(B_m, A))))) / -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 B_m <= 5.5e-103: tmp = math.sqrt((-16.0 * ((F * C) * math.pow(A, 2.0)))) / ((4.0 * (C * A)) - math.pow(B_m, 2.0)) else: tmp = math.sqrt((2.0 * (F * (A - math.hypot(B_m, A))))) / -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 (B_m <= 5.5e-103) tmp = Float64(sqrt(Float64(-16.0 * Float64(Float64(F * C) * (A ^ 2.0)))) / Float64(Float64(4.0 * Float64(C * A)) - (B_m ^ 2.0))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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)
tmp = 0.0;
if (B_m <= 5.5e-103)
tmp = sqrt((-16.0 * ((F * C) * (A ^ 2.0)))) / ((4.0 * (C * A)) - (B_m ^ 2.0));
else
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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[B$95$m, 5.5e-103], N[(N[Sqrt[N[(-16.0 * N[(N[(F * C), $MachinePrecision] * N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}\;B\_m \leq 5.5 \cdot 10^{-103}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(\left(F \cdot C\right) \cdot {A}^{2}\right)}}{4 \cdot \left(C \cdot A\right) - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 5.50000000000000032e-103Initial program 19.1%
Simplified22.7%
Taylor expanded in A around -inf 12.4%
Taylor expanded in C around 0 12.4%
if 5.50000000000000032e-103 < B Initial program 11.5%
Taylor expanded in C around 0 20.1%
mul-1-neg20.1%
+-commutative20.1%
unpow220.1%
unpow220.1%
hypot-define39.3%
Simplified39.3%
neg-sub039.3%
associate-*l/39.2%
pow1/239.2%
pow1/239.2%
pow-prod-down39.4%
Applied egg-rr39.4%
neg-sub039.4%
distribute-neg-frac239.4%
unpow1/239.4%
Simplified39.4%
Final simplification20.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 (if (<= B_m 2.6e-104) (/ (sqrt (* -16.0 (* (* F C) (pow A 2.0)))) (* 4.0 (* C A))) (/ (sqrt (* 2.0 (* F (- A (hypot B_m A))))) (- 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 (B_m <= 2.6e-104) {
tmp = sqrt((-16.0 * ((F * C) * pow(A, 2.0)))) / (4.0 * (C * A));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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 (B_m <= 2.6e-104) {
tmp = Math.sqrt((-16.0 * ((F * C) * Math.pow(A, 2.0)))) / (4.0 * (C * A));
} else {
tmp = Math.sqrt((2.0 * (F * (A - Math.hypot(B_m, A))))) / -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 B_m <= 2.6e-104: tmp = math.sqrt((-16.0 * ((F * C) * math.pow(A, 2.0)))) / (4.0 * (C * A)) else: tmp = math.sqrt((2.0 * (F * (A - math.hypot(B_m, A))))) / -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 (B_m <= 2.6e-104) tmp = Float64(sqrt(Float64(-16.0 * Float64(Float64(F * C) * (A ^ 2.0)))) / Float64(4.0 * Float64(C * A))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(B_m, A))))) / 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)
tmp = 0.0;
if (B_m <= 2.6e-104)
tmp = sqrt((-16.0 * ((F * C) * (A ^ 2.0)))) / (4.0 * (C * A));
else
tmp = sqrt((2.0 * (F * (A - hypot(B_m, A))))) / -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[B$95$m, 2.6e-104], N[(N[Sqrt[N[(-16.0 * N[(N[(F * C), $MachinePrecision] * N[Power[A, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(C * A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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}\;B\_m \leq 2.6 \cdot 10^{-104}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(\left(F \cdot C\right) \cdot {A}^{2}\right)}}{4 \cdot \left(C \cdot A\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.60000000000000003e-104Initial program 19.1%
Simplified22.7%
Taylor expanded in A around -inf 12.4%
Taylor expanded in C around inf 12.5%
if 2.60000000000000003e-104 < B Initial program 11.5%
Taylor expanded in C around 0 20.1%
mul-1-neg20.1%
+-commutative20.1%
unpow220.1%
unpow220.1%
hypot-define39.3%
Simplified39.3%
neg-sub039.3%
associate-*l/39.2%
pow1/239.2%
pow1/239.2%
pow-prod-down39.4%
Applied egg-rr39.4%
neg-sub039.4%
distribute-neg-frac239.4%
unpow1/239.4%
Simplified39.4%
Final simplification20.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 (<= A -3.8e+134) (* (sqrt (fabs (* F A))) (/ -2.0 B_m)) (/ (sqrt (+ (* -2.0 (* B_m F)) (* 2.0 (* F A)))) (- 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 (A <= -3.8e+134) {
tmp = sqrt(fabs((F * A))) * (-2.0 / B_m);
} else {
tmp = sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 (a <= (-3.8d+134)) then
tmp = sqrt(abs((f * a))) * ((-2.0d0) / b_m)
else
tmp = sqrt((((-2.0d0) * (b_m * f)) + (2.0d0 * (f * a)))) / -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 (A <= -3.8e+134) {
tmp = Math.sqrt(Math.abs((F * A))) * (-2.0 / B_m);
} else {
tmp = Math.sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 A <= -3.8e+134: tmp = math.sqrt(math.fabs((F * A))) * (-2.0 / B_m) else: tmp = math.sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 (A <= -3.8e+134) tmp = Float64(sqrt(abs(Float64(F * A))) * Float64(-2.0 / B_m)); else tmp = Float64(sqrt(Float64(Float64(-2.0 * Float64(B_m * F)) + Float64(2.0 * Float64(F * A)))) / 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)
tmp = 0.0;
if (A <= -3.8e+134)
tmp = sqrt(abs((F * A))) * (-2.0 / B_m);
else
tmp = sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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[A, -3.8e+134], N[(N[Sqrt[N[Abs[N[(F * A), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(F * A), $MachinePrecision]), $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}\;A \leq -3.8 \cdot 10^{+134}:\\
\;\;\;\;\sqrt{\left|F \cdot A\right|} \cdot \frac{-2}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right) + 2 \cdot \left(F \cdot A\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -3.79999999999999998e134Initial program 9.3%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define11.5%
Simplified11.5%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt8.5%
unpow28.5%
rem-square-sqrt8.5%
metadata-eval8.5%
Simplified8.5%
add-sqr-sqrt8.5%
pow1/28.5%
pow1/28.8%
pow-prod-down6.0%
pow26.0%
*-commutative6.0%
Applied egg-rr6.0%
unpow1/26.0%
unpow26.0%
rem-sqrt-square9.5%
Simplified9.5%
if -3.79999999999999998e134 < A Initial program 17.6%
Taylor expanded in C around 0 8.0%
mul-1-neg8.0%
+-commutative8.0%
unpow28.0%
unpow28.0%
hypot-define14.9%
Simplified14.9%
neg-sub014.9%
associate-*l/14.9%
pow1/214.9%
pow1/214.9%
pow-prod-down14.9%
Applied egg-rr14.9%
neg-sub014.9%
distribute-neg-frac214.9%
unpow1/214.9%
Simplified14.9%
Taylor expanded in A around 0 12.0%
Final simplification11.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 (* F (- A (hypot B_m A))))) (- 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 * (A - hypot(B_m, A))))) / -B_m;
}
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 * (A - Math.hypot(B_m, A))))) / -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 * (A - math.hypot(B_m, A))))) / -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 * Float64(A - hypot(B_m, A))))) / Float64(-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 * (A - hypot(B_m, A))))) / -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[N[(2.0 * N[(F * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $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])\\
\\
\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)\right)}}{-B\_m}
\end{array}
Initial program 16.7%
Taylor expanded in C around 0 7.6%
mul-1-neg7.6%
+-commutative7.6%
unpow27.6%
unpow27.6%
hypot-define14.6%
Simplified14.6%
neg-sub014.6%
associate-*l/14.5%
pow1/214.5%
pow1/214.5%
pow-prod-down14.6%
Applied egg-rr14.6%
neg-sub014.6%
distribute-neg-frac214.6%
unpow1/214.6%
Simplified14.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 (<= A -8e+133) (* -2.0 (/ 1.0 (/ B_m (sqrt (* F A))))) (/ (sqrt (+ (* -2.0 (* B_m F)) (* 2.0 (* F A)))) (- 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 (A <= -8e+133) {
tmp = -2.0 * (1.0 / (B_m / sqrt((F * A))));
} else {
tmp = sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 (a <= (-8d+133)) then
tmp = (-2.0d0) * (1.0d0 / (b_m / sqrt((f * a))))
else
tmp = sqrt((((-2.0d0) * (b_m * f)) + (2.0d0 * (f * a)))) / -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 (A <= -8e+133) {
tmp = -2.0 * (1.0 / (B_m / Math.sqrt((F * A))));
} else {
tmp = Math.sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 A <= -8e+133: tmp = -2.0 * (1.0 / (B_m / math.sqrt((F * A)))) else: tmp = math.sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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 (A <= -8e+133) tmp = Float64(-2.0 * Float64(1.0 / Float64(B_m / sqrt(Float64(F * A))))); else tmp = Float64(sqrt(Float64(Float64(-2.0 * Float64(B_m * F)) + Float64(2.0 * Float64(F * A)))) / 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)
tmp = 0.0;
if (A <= -8e+133)
tmp = -2.0 * (1.0 / (B_m / sqrt((F * A))));
else
tmp = sqrt(((-2.0 * (B_m * F)) + (2.0 * (F * A)))) / -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[A, -8e+133], N[(-2.0 * N[(1.0 / N[(B$95$m / N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(-2.0 * N[(B$95$m * F), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(F * A), $MachinePrecision]), $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}\;A \leq -8 \cdot 10^{+133}:\\
\;\;\;\;-2 \cdot \frac{1}{\frac{B\_m}{\sqrt{F \cdot A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right) + 2 \cdot \left(F \cdot A\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -8.0000000000000002e133Initial program 9.3%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define11.5%
Simplified11.5%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt8.5%
unpow28.5%
rem-square-sqrt8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in A around 0 8.5%
associate-*r/8.5%
*-commutative8.5%
*-commutative8.5%
*-lft-identity8.5%
Simplified8.5%
clear-num8.5%
inv-pow8.5%
Applied egg-rr8.5%
unpow-18.5%
Simplified8.5%
if -8.0000000000000002e133 < A Initial program 17.6%
Taylor expanded in C around 0 8.0%
mul-1-neg8.0%
+-commutative8.0%
unpow28.0%
unpow28.0%
hypot-define14.9%
Simplified14.9%
neg-sub014.9%
associate-*l/14.9%
pow1/214.9%
pow1/214.9%
pow-prod-down14.9%
Applied egg-rr14.9%
neg-sub014.9%
distribute-neg-frac214.9%
unpow1/214.9%
Simplified14.9%
Taylor expanded in A around 0 12.0%
Final simplification11.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 (if (<= A -6.2e+133) (* -2.0 (/ 1.0 (/ B_m (sqrt (* F A))))) (/ (sqrt (* -2.0 (* B_m 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 (A <= -6.2e+133) {
tmp = -2.0 * (1.0 / (B_m / sqrt((F * A))));
} else {
tmp = sqrt((-2.0 * (B_m * 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 (a <= (-6.2d+133)) then
tmp = (-2.0d0) * (1.0d0 / (b_m / sqrt((f * a))))
else
tmp = sqrt(((-2.0d0) * (b_m * 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 (A <= -6.2e+133) {
tmp = -2.0 * (1.0 / (B_m / Math.sqrt((F * A))));
} else {
tmp = Math.sqrt((-2.0 * (B_m * 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 A <= -6.2e+133: tmp = -2.0 * (1.0 / (B_m / math.sqrt((F * A)))) else: tmp = math.sqrt((-2.0 * (B_m * 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 (A <= -6.2e+133) tmp = Float64(-2.0 * Float64(1.0 / Float64(B_m / sqrt(Float64(F * A))))); else tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / 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)
tmp = 0.0;
if (A <= -6.2e+133)
tmp = -2.0 * (1.0 / (B_m / sqrt((F * A))));
else
tmp = sqrt((-2.0 * (B_m * 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[A, -6.2e+133], N[(-2.0 * N[(1.0 / N[(B$95$m / N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * 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}\;A \leq -6.2 \cdot 10^{+133}:\\
\;\;\;\;-2 \cdot \frac{1}{\frac{B\_m}{\sqrt{F \cdot A}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -6.2e133Initial program 9.3%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define11.5%
Simplified11.5%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt8.5%
unpow28.5%
rem-square-sqrt8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in A around 0 8.5%
associate-*r/8.5%
*-commutative8.5%
*-commutative8.5%
*-lft-identity8.5%
Simplified8.5%
clear-num8.5%
inv-pow8.5%
Applied egg-rr8.5%
unpow-18.5%
Simplified8.5%
if -6.2e133 < A Initial program 17.6%
Taylor expanded in C around 0 8.0%
mul-1-neg8.0%
+-commutative8.0%
unpow28.0%
unpow28.0%
hypot-define14.9%
Simplified14.9%
neg-sub014.9%
associate-*l/14.9%
pow1/214.9%
pow1/214.9%
pow-prod-down14.9%
Applied egg-rr14.9%
neg-sub014.9%
distribute-neg-frac214.9%
unpow1/214.9%
Simplified14.9%
Taylor expanded in A around 0 12.8%
*-commutative12.8%
Simplified12.8%
Final simplification12.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 (<= A -2.9e+135) (* -2.0 (/ (sqrt (* F A)) B_m)) (/ (sqrt (* -2.0 (* B_m 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 (A <= -2.9e+135) {
tmp = -2.0 * (sqrt((F * A)) / B_m);
} else {
tmp = sqrt((-2.0 * (B_m * 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 (a <= (-2.9d+135)) then
tmp = (-2.0d0) * (sqrt((f * a)) / b_m)
else
tmp = sqrt(((-2.0d0) * (b_m * 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 (A <= -2.9e+135) {
tmp = -2.0 * (Math.sqrt((F * A)) / B_m);
} else {
tmp = Math.sqrt((-2.0 * (B_m * 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 A <= -2.9e+135: tmp = -2.0 * (math.sqrt((F * A)) / B_m) else: tmp = math.sqrt((-2.0 * (B_m * 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 (A <= -2.9e+135) tmp = Float64(-2.0 * Float64(sqrt(Float64(F * A)) / B_m)); else tmp = Float64(sqrt(Float64(-2.0 * Float64(B_m * F))) / 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)
tmp = 0.0;
if (A <= -2.9e+135)
tmp = -2.0 * (sqrt((F * A)) / B_m);
else
tmp = sqrt((-2.0 * (B_m * 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[A, -2.9e+135], N[(-2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(-2.0 * N[(B$95$m * 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}\;A \leq -2.9 \cdot 10^{+135}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{F \cdot A}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -2.8999999999999999e135Initial program 9.3%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define11.5%
Simplified11.5%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt8.5%
unpow28.5%
rem-square-sqrt8.5%
metadata-eval8.5%
Simplified8.5%
Taylor expanded in A around 0 8.5%
associate-*r/8.5%
*-commutative8.5%
*-commutative8.5%
*-lft-identity8.5%
Simplified8.5%
if -2.8999999999999999e135 < A Initial program 17.6%
Taylor expanded in C around 0 8.0%
mul-1-neg8.0%
+-commutative8.0%
unpow28.0%
unpow28.0%
hypot-define14.9%
Simplified14.9%
neg-sub014.9%
associate-*l/14.9%
pow1/214.9%
pow1/214.9%
pow-prod-down14.9%
Applied egg-rr14.9%
neg-sub014.9%
distribute-neg-frac214.9%
unpow1/214.9%
Simplified14.9%
Taylor expanded in A around 0 12.8%
*-commutative12.8%
Simplified12.8%
Final simplification12.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 (* -2.0 (/ (sqrt (* F A)) 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 -2.0 * (sqrt((F * A)) / 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 = (-2.0d0) * (sqrt((f * a)) / 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 -2.0 * (Math.sqrt((F * A)) / 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 -2.0 * (math.sqrt((F * A)) / 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(-2.0 * Float64(sqrt(Float64(F * A)) / 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 = -2.0 * (sqrt((F * A)) / 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[(-2.0 * N[(N[Sqrt[N[(F * A), $MachinePrecision]], $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])\\
\\
-2 \cdot \frac{\sqrt{F \cdot A}}{B\_m}
\end{array}
Initial program 16.7%
Taylor expanded in C around 0 7.6%
mul-1-neg7.6%
+-commutative7.6%
unpow27.6%
unpow27.6%
hypot-define14.6%
Simplified14.6%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt3.5%
unpow23.5%
rem-square-sqrt3.5%
metadata-eval3.5%
Simplified3.5%
Taylor expanded in A around 0 3.5%
associate-*r/3.5%
*-commutative3.5%
*-commutative3.5%
*-lft-identity3.5%
Simplified3.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(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 16.7%
Taylor expanded in B around -inf 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt2.1%
Simplified2.1%
expm1-log1p-u2.1%
expm1-undefine2.3%
distribute-rgt-neg-in2.3%
mul-1-neg2.3%
Applied egg-rr2.3%
expm1-define2.1%
remove-double-neg2.1%
Simplified2.1%
expm1-log1p-u2.1%
sqrt-unprod2.1%
pow1/22.3%
Applied egg-rr2.3%
Final simplification2.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 16.7%
Taylor expanded in B around -inf 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt2.1%
Simplified2.1%
expm1-log1p-u2.1%
expm1-undefine2.3%
distribute-rgt-neg-in2.3%
mul-1-neg2.3%
Applied egg-rr2.3%
expm1-define2.1%
remove-double-neg2.1%
Simplified2.1%
expm1-log1p-u2.1%
sqrt-unprod2.1%
Applied egg-rr2.1%
Final simplification2.1%
herbie shell --seed 2024137
(FPCore (A B C F)
:name "ABCF->ab-angle b"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))