
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(- (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) - sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) - math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) - sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) - sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] - N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) - \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
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 205000000000.0)
(/ (sqrt (* (* t_0 F) (/ (- (* 4.0 (* A C)) (pow B_m 2.0)) C))) (- t_0))
(if (<= B_m 4.5e+175)
(/ (sqrt (* (* F 2.0) (- A (hypot B_m A)))) (- B_m))
(*
(pow
(exp (* 0.16666666666666666 (- (log (- F)) (log (/ 1.0 B_m)))))
3.0)
(/ (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 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 205000000000.0) {
tmp = sqrt(((t_0 * F) * (((4.0 * (A * C)) - pow(B_m, 2.0)) / C))) / -t_0;
} else if (B_m <= 4.5e+175) {
tmp = sqrt(((F * 2.0) * (A - hypot(B_m, A)))) / -B_m;
} else {
tmp = pow(exp((0.16666666666666666 * (log(-F) - log((1.0 / B_m))))), 3.0) * (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 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 205000000000.0) tmp = Float64(sqrt(Float64(Float64(t_0 * F) * Float64(Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0)) / C))) / Float64(-t_0)); elseif (B_m <= 4.5e+175) tmp = Float64(sqrt(Float64(Float64(F * 2.0) * Float64(A - hypot(B_m, A)))) / Float64(-B_m)); else tmp = Float64((exp(Float64(0.16666666666666666 * Float64(log(Float64(-F)) - log(Float64(1.0 / B_m))))) ^ 3.0) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 205000000000.0], N[(N[Sqrt[N[(N[(t$95$0 * F), $MachinePrecision] * N[(N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 4.5e+175], N[(N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Power[N[Exp[N[(0.16666666666666666 * N[(N[Log[(-F)], $MachinePrecision] - N[Log[N[(1.0 / B$95$m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $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 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 205000000000:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot F\right) \cdot \frac{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}{C}}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 4.5 \cdot 10^{+175}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{0.16666666666666666 \cdot \left(\log \left(-F\right) - \log \left(\frac{1}{B\_m}\right)\right)}\right)}^{3} \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.05e11Initial program 18.0%
Simplified24.3%
Taylor expanded in C around inf 20.6%
mul-1-neg20.6%
Simplified20.6%
Taylor expanded in C around 0 20.6%
+-commutative20.6%
mul-1-neg20.6%
sub-neg20.6%
Simplified20.6%
if 2.05e11 < B < 4.49999999999999989e175Initial program 37.1%
Taylor expanded in C around 0 52.8%
mul-1-neg52.8%
+-commutative52.8%
unpow252.8%
unpow252.8%
hypot-define70.9%
Simplified70.9%
neg-sub070.9%
associate-*l/70.9%
pow1/270.9%
pow1/270.9%
pow-prod-down71.1%
Applied egg-rr71.1%
neg-sub071.1%
distribute-neg-frac271.1%
unpow1/271.1%
associate-*r*71.1%
Simplified71.1%
if 4.49999999999999989e175 < B Initial program 0.0%
Taylor expanded in C around 0 2.3%
mul-1-neg2.3%
+-commutative2.3%
unpow22.3%
unpow22.3%
hypot-define53.4%
Simplified53.4%
add-cube-cbrt52.6%
pow352.7%
Applied egg-rr52.7%
Taylor expanded in B around inf 68.5%
Final simplification33.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 (<= (pow B_m 2.0) 5e+17)
(/
(sqrt
(*
(* (fma B_m B_m (* A (* C -4.0))) F)
(* 2.0 (+ A (+ A (* -0.5 (/ (pow B_m 2.0) C)))))))
(* C (- (/ (* B_m (- B_m)) C) (* A -4.0))))
(/ (sqrt (* (* F 2.0) (- 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) <= 5e+17) {
tmp = sqrt(((fma(B_m, B_m, (A * (C * -4.0))) * F) * (2.0 * (A + (A + (-0.5 * (pow(B_m, 2.0) / C))))))) / (C * (((B_m * -B_m) / C) - (A * -4.0)));
} else {
tmp = sqrt(((F * 2.0) * (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) <= 5e+17) tmp = Float64(sqrt(Float64(Float64(fma(B_m, B_m, Float64(A * Float64(C * -4.0))) * F) * Float64(2.0 * Float64(A + Float64(A + Float64(-0.5 * Float64((B_m ^ 2.0) / C))))))) / Float64(C * Float64(Float64(Float64(B_m * Float64(-B_m)) / C) - Float64(A * -4.0)))); else tmp = Float64(sqrt(Float64(Float64(F * 2.0) * 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], 5e+17], N[(N[Sqrt[N[(N[(N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * F), $MachinePrecision] * N[(2.0 * N[(A + N[(A + N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(C * N[(N[(N[(B$95$m * (-B$95$m)), $MachinePrecision] / C), $MachinePrecision] - N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $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 5 \cdot 10^{+17}:\\
\;\;\;\;\frac{\sqrt{\left(\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right) \cdot F\right) \cdot \left(2 \cdot \left(A + \left(A + -0.5 \cdot \frac{{B\_m}^{2}}{C}\right)\right)\right)}}{C \cdot \left(\frac{B\_m \cdot \left(-B\_m\right)}{C} - A \cdot -4\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 5e17Initial program 17.9%
Simplified27.0%
Taylor expanded in C around inf 29.8%
mul-1-neg29.8%
Simplified29.8%
Taylor expanded in C around -inf 29.7%
associate-*r*29.7%
mul-1-neg29.7%
cancel-sign-sub-inv29.7%
metadata-eval29.7%
Simplified29.7%
unpow229.7%
Applied egg-rr29.7%
if 5e17 < (pow.f64 B #s(literal 2 binary64)) Initial program 19.6%
Taylor expanded in C around 0 16.8%
mul-1-neg16.8%
+-commutative16.8%
unpow216.8%
unpow216.8%
hypot-define34.2%
Simplified34.2%
neg-sub034.2%
associate-*l/34.2%
pow1/234.2%
pow1/234.3%
pow-prod-down34.4%
Applied egg-rr34.4%
neg-sub034.4%
distribute-neg-frac234.4%
unpow1/234.3%
associate-*r*34.3%
Simplified34.3%
Final simplification32.1%
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 710000000.0)
(/ (sqrt (* (* t_0 F) (/ (- (* 4.0 (* A C)) (pow B_m 2.0)) C))) (- t_0))
(/ (sqrt (* (* F 2.0) (- 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 <= 710000000.0) {
tmp = sqrt(((t_0 * F) * (((4.0 * (A * C)) - pow(B_m, 2.0)) / C))) / -t_0;
} else {
tmp = sqrt(((F * 2.0) * (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 <= 710000000.0) tmp = Float64(sqrt(Float64(Float64(t_0 * F) * Float64(Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0)) / C))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(Float64(F * 2.0) * 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, 710000000.0], N[(N[Sqrt[N[(N[(t$95$0 * F), $MachinePrecision] * N[(N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $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 710000000:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot F\right) \cdot \frac{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}{C}}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 7.1e8Initial program 18.0%
Simplified24.3%
Taylor expanded in C around inf 20.6%
mul-1-neg20.6%
Simplified20.6%
Taylor expanded in C around 0 20.6%
+-commutative20.6%
mul-1-neg20.6%
sub-neg20.6%
Simplified20.6%
if 7.1e8 < B Initial program 21.0%
Taylor expanded in C around 0 30.8%
mul-1-neg30.8%
+-commutative30.8%
unpow230.8%
unpow230.8%
hypot-define63.3%
Simplified63.3%
neg-sub063.3%
associate-*l/63.3%
pow1/263.3%
pow1/263.3%
pow-prod-down63.5%
Applied egg-rr63.5%
neg-sub063.5%
distribute-neg-frac263.5%
unpow1/263.5%
associate-*r*63.5%
Simplified63.5%
Final simplification32.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e+17)
(/ (sqrt (* (* t_0 F) (* A 4.0))) (- t_0))
(/ (sqrt (* (* F 2.0) (- 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 (pow(B_m, 2.0) <= 5e+17) {
tmp = sqrt(((t_0 * F) * (A * 4.0))) / -t_0;
} else {
tmp = sqrt(((F * 2.0) * (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.0) <= 5e+17) tmp = Float64(sqrt(Float64(Float64(t_0 * F) * Float64(A * 4.0))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(Float64(F * 2.0) * 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[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+17], N[(N[Sqrt[N[(N[(t$95$0 * F), $MachinePrecision] * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $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}^{2} \leq 5 \cdot 10^{+17}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot F\right) \cdot \left(A \cdot 4\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 5e17Initial program 17.9%
Simplified27.0%
Taylor expanded in A around -inf 29.6%
if 5e17 < (pow.f64 B #s(literal 2 binary64)) Initial program 19.6%
Taylor expanded in C around 0 16.8%
mul-1-neg16.8%
+-commutative16.8%
unpow216.8%
unpow216.8%
hypot-define34.2%
Simplified34.2%
neg-sub034.2%
associate-*l/34.2%
pow1/234.2%
pow1/234.3%
pow-prod-down34.4%
Applied egg-rr34.4%
neg-sub034.4%
distribute-neg-frac234.4%
unpow1/234.3%
associate-*r*34.3%
Simplified34.3%
Final simplification32.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 1e-34)
(/
(sqrt (* (* A -8.0) (* C (* F (+ A A)))))
(- (fma B_m B_m (* A (* C -4.0)))))
(/ (sqrt (* (* F 2.0) (- 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) <= 1e-34) {
tmp = sqrt(((A * -8.0) * (C * (F * (A + A))))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = sqrt(((F * 2.0) * (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) <= 1e-34) tmp = Float64(sqrt(Float64(Float64(A * -8.0) * Float64(C * Float64(F * Float64(A + A))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(Float64(Float64(F * 2.0) * 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], 1e-34], N[(N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(C * N[(F * N[(A + A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $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 10^{-34}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(C \cdot \left(F \cdot \left(A + A\right)\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999928e-35Initial program 17.9%
Simplified27.3%
add-cbrt-cube16.2%
pow316.2%
*-commutative16.2%
Applied egg-rr16.2%
Taylor expanded in C around inf 28.5%
associate-*r*28.5%
sub-neg28.5%
neg-mul-128.5%
remove-double-neg28.5%
Simplified28.5%
if 9.99999999999999928e-35 < (pow.f64 B #s(literal 2 binary64)) Initial program 19.6%
Taylor expanded in C around 0 16.2%
mul-1-neg16.2%
+-commutative16.2%
unpow216.2%
unpow216.2%
hypot-define32.9%
Simplified32.9%
neg-sub032.9%
associate-*l/32.9%
pow1/232.9%
pow1/232.9%
pow-prod-down33.0%
Applied egg-rr33.0%
neg-sub033.0%
distribute-neg-frac233.0%
unpow1/233.0%
associate-*r*33.0%
Simplified33.0%
Final simplification30.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 (<= A -2e+172) (* (/ (sqrt 2.0) B_m) (- (sqrt (* 2.0 (* A F))))) (/ (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 <= -2e+172) {
tmp = (sqrt(2.0) / B_m) * -sqrt((2.0 * (A * F)));
} 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 <= (-2d+172)) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((2.0d0 * (a * f)))
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 <= -2e+172) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((2.0 * (A * F)));
} 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 <= -2e+172: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((2.0 * (A * F))) 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 <= -2e+172) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(2.0 * Float64(A * F))))); 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 <= -2e+172)
tmp = (sqrt(2.0) / B_m) * -sqrt((2.0 * (A * F)));
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, -2e+172], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(2.0 * N[(A * F), $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 -2 \cdot 10^{+172}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{2 \cdot \left(A \cdot F\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -2.0000000000000002e172Initial program 2.2%
Taylor expanded in C around 0 1.4%
mul-1-neg1.4%
+-commutative1.4%
unpow21.4%
unpow21.4%
hypot-define22.2%
Simplified22.2%
Taylor expanded in A around -inf 19.5%
if -2.0000000000000002e172 < A Initial program 21.2%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-define20.3%
Simplified20.3%
neg-sub020.3%
associate-*l/20.3%
pow1/220.3%
pow1/220.3%
pow-prod-down20.4%
Applied egg-rr20.4%
neg-sub020.4%
distribute-neg-frac220.4%
unpow1/220.4%
associate-*r*20.4%
Simplified20.4%
Taylor expanded in A around 0 18.6%
Final simplification18.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 (/ (sqrt (* (* F 2.0) (- 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(((F * 2.0) * (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(((F * 2.0) * (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(((F * 2.0) * (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(Float64(F * 2.0) * 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(((F * 2.0) * (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[(N[(F * 2.0), $MachinePrecision] * N[(A - N[Sqrt[B$95$m ^ 2 + A ^ 2], $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{\left(F \cdot 2\right) \cdot \left(A - \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}
\end{array}
Initial program 18.8%
Taylor expanded in C around 0 11.4%
mul-1-neg11.4%
+-commutative11.4%
unpow211.4%
unpow211.4%
hypot-define20.6%
Simplified20.6%
neg-sub020.6%
associate-*l/20.6%
pow1/220.6%
pow1/220.7%
pow-prod-down20.7%
Applied egg-rr20.7%
neg-sub020.7%
distribute-neg-frac220.7%
unpow1/220.6%
associate-*r*20.6%
Simplified20.6%
Final simplification20.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 -2.15e+172) (* (sqrt (* A F)) (/ -2.0 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.15e+172) {
tmp = sqrt((A * F)) * (-2.0 / 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.15d+172)) then
tmp = sqrt((a * f)) * ((-2.0d0) / 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.15e+172) {
tmp = Math.sqrt((A * F)) * (-2.0 / 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.15e+172: tmp = math.sqrt((A * F)) * (-2.0 / 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.15e+172) tmp = Float64(sqrt(Float64(A * F)) * Float64(-2.0 / 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.15e+172)
tmp = sqrt((A * F)) * (-2.0 / 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.15e+172], N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] * N[(-2.0 / 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.15 \cdot 10^{+172}:\\
\;\;\;\;\sqrt{A \cdot F} \cdot \frac{-2}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -2.1500000000000001e172Initial program 2.2%
Taylor expanded in C around 0 1.4%
mul-1-neg1.4%
+-commutative1.4%
unpow21.4%
unpow21.4%
hypot-define22.2%
Simplified22.2%
add-cube-cbrt21.8%
pow321.8%
Applied egg-rr21.8%
Taylor expanded in A around -inf 0.0%
*-commutative0.0%
unpow20.0%
unpow20.0%
rem-square-sqrt19.3%
rem-square-sqrt19.5%
metadata-eval19.5%
Simplified19.5%
if -2.1500000000000001e172 < A Initial program 21.2%
Taylor expanded in C around 0 12.9%
mul-1-neg12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-define20.3%
Simplified20.3%
neg-sub020.3%
associate-*l/20.3%
pow1/220.3%
pow1/220.3%
pow-prod-down20.4%
Applied egg-rr20.4%
neg-sub020.4%
distribute-neg-frac220.4%
unpow1/220.4%
associate-*r*20.4%
Simplified20.4%
Taylor expanded in A around 0 18.6%
Final simplification18.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 (* (sqrt (* A 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) {
return sqrt((A * F)) * (-2.0 / 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((a * f)) * ((-2.0d0) / 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((A * F)) * (-2.0 / 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((A * F)) * (-2.0 / 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(A * F)) * Float64(-2.0 / 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((A * F)) * (-2.0 / 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[(A * 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])\\
\\
\sqrt{A \cdot F} \cdot \frac{-2}{B\_m}
\end{array}
Initial program 18.8%
Taylor expanded in C around 0 11.4%
mul-1-neg11.4%
+-commutative11.4%
unpow211.4%
unpow211.4%
hypot-define20.6%
Simplified20.6%
add-cube-cbrt20.3%
pow320.3%
Applied egg-rr20.3%
Taylor expanded in A around -inf 0.0%
*-commutative0.0%
unpow20.0%
unpow20.0%
rem-square-sqrt4.8%
rem-square-sqrt4.9%
metadata-eval4.9%
Simplified4.9%
Final simplification4.9%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (sqrt (* 2.0 (/ (- F) B_m))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt((2.0 * (-F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = sqrt((2.0d0 * (-f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((2.0 * (-F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return math.sqrt((2.0 * (-F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return sqrt(Float64(2.0 * Float64(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 18.8%
Taylor expanded in B around -inf 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt2.1%
Simplified2.1%
Taylor expanded in F around 0 2.1%
pow12.1%
*-commutative2.1%
sqrt-unprod2.1%
Applied egg-rr2.1%
unpow12.1%
Simplified2.1%
frac-2neg2.1%
div-inv2.1%
add-sqr-sqrt1.2%
sqrt-unprod2.7%
sqr-neg2.7%
sqrt-prod1.4%
add-sqr-sqrt2.2%
Applied egg-rr2.2%
distribute-lft-neg-out2.2%
associate-*r/2.2%
*-rgt-identity2.2%
distribute-neg-frac22.2%
Simplified2.2%
Final simplification2.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 (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 18.8%
Taylor expanded in B around -inf 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt2.1%
Simplified2.1%
Taylor expanded in F around 0 2.1%
pow12.1%
*-commutative2.1%
sqrt-unprod2.1%
Applied egg-rr2.1%
unpow12.1%
Simplified2.1%
herbie shell --seed 2024121
(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))))