
(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 12 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 (<= (pow B_m 2.0) 2e-151)
(/ (sqrt (* (* t_0 F) (* A 4.0))) (- t_0))
(if (<= (pow B_m 2.0) 5e+157)
(-
(sqrt
(*
2.0
(*
F
(/
(+ A (- C (hypot B_m (- A C))))
(fma -4.0 (* A C) (pow B_m 2.0)))))))
(/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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) <= 2e-151) {
tmp = sqrt(((t_0 * F) * (A * 4.0))) / -t_0;
} else if (pow(B_m, 2.0) <= 5e+157) {
tmp = -sqrt((2.0 * (F * ((A + (C - hypot(B_m, (A - C)))) / fma(-4.0, (A * C), pow(B_m, 2.0))))));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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) <= 2e-151) tmp = Float64(sqrt(Float64(Float64(t_0 * F) * Float64(A * 4.0))) / Float64(-t_0)); elseif ((B_m ^ 2.0) <= 5e+157) tmp = Float64(-sqrt(Float64(2.0 * Float64(F * Float64(Float64(A + Float64(C - hypot(B_m, Float64(A - C)))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(A, B_m))))) / 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], 2e-151], N[(N[Sqrt[N[(N[(t$95$0 * F), $MachinePrecision] * N[(A * 4.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+157], (-N[Sqrt[N[(2.0 * N[(F * N[(N[(A + N[(C - N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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}^{2} \leq 2 \cdot 10^{-151}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot F\right) \cdot \left(A \cdot 4\right)}}{-t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+157}:\\
\;\;\;\;-\sqrt{2 \cdot \left(F \cdot \frac{A + \left(C - \mathsf{hypot}\left(B\_m, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-151Initial program 18.6%
Simplified28.0%
Taylor expanded in A around -inf 23.3%
if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999976e157Initial program 37.9%
Taylor expanded in F around 0 48.4%
pow148.4%
Applied egg-rr55.8%
unpow155.8%
associate-/l*57.4%
fma-undefine57.4%
unpow257.4%
+-commutative57.4%
fma-define57.4%
Simplified57.4%
if 4.99999999999999976e157 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.9%
Taylor expanded in C around 0 5.2%
mul-1-neg5.2%
+-commutative5.2%
unpow25.2%
unpow25.2%
hypot-define23.8%
Simplified23.8%
neg-sub023.8%
associate-*l/23.8%
pow1/223.8%
pow1/223.8%
hypot-undefine5.3%
unpow25.3%
unpow25.3%
pow-prod-down5.3%
unpow25.3%
unpow25.3%
hypot-undefine23.9%
Applied egg-rr23.9%
neg-sub023.9%
distribute-neg-frac223.9%
unpow1/223.9%
hypot-undefine5.3%
unpow25.3%
unpow25.3%
+-commutative5.3%
unpow25.3%
unpow25.3%
hypot-undefine23.9%
Simplified23.9%
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
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 2e-151)
(/ (sqrt (* (* t_0 F) (* A 4.0))) (- t_0))
(/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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) <= 2e-151) {
tmp = sqrt(((t_0 * F) * (A * 4.0))) / -t_0;
} else {
tmp = sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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) <= 2e-151) tmp = Float64(sqrt(Float64(Float64(t_0 * F) * Float64(A * 4.0))) / Float64(-t_0)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(A, B_m))))) / 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], 2e-151], 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[(2.0 * N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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}^{2} \leq 2 \cdot 10^{-151}:\\
\;\;\;\;\frac{\sqrt{\left(t\_0 \cdot F\right) \cdot \left(A \cdot 4\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-151Initial program 18.6%
Simplified28.0%
Taylor expanded in A around -inf 23.3%
if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64)) Initial program 19.8%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
+-commutative10.8%
unpow210.8%
unpow210.8%
hypot-define23.1%
Simplified23.1%
neg-sub023.1%
associate-*l/23.1%
pow1/223.1%
pow1/223.1%
hypot-undefine10.9%
unpow210.9%
unpow210.9%
pow-prod-down10.9%
unpow210.9%
unpow210.9%
hypot-undefine23.2%
Applied egg-rr23.2%
neg-sub023.2%
distribute-neg-frac223.2%
unpow1/223.2%
hypot-undefine10.9%
unpow210.9%
unpow210.9%
+-commutative10.9%
unpow210.9%
unpow210.9%
hypot-undefine23.2%
Simplified23.2%
Final simplification23.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 (<= (pow B_m 2.0) 2e-151)
(/
(sqrt (* -8.0 (* A (* C (* F (+ A A))))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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-151) {
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(A, B_m))))) / -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-151) 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(A, B_m))))) / 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-151], 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[A ^ 2 + B$95$m ^ 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^{-151}:\\
\;\;\;\;\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(A, B\_m\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-151Initial program 18.6%
Simplified24.1%
Taylor expanded in C around inf 22.2%
if 1.9999999999999999e-151 < (pow.f64 B #s(literal 2 binary64)) Initial program 19.8%
Taylor expanded in C around 0 10.8%
mul-1-neg10.8%
+-commutative10.8%
unpow210.8%
unpow210.8%
hypot-define23.1%
Simplified23.1%
neg-sub023.1%
associate-*l/23.1%
pow1/223.1%
pow1/223.1%
hypot-undefine10.9%
unpow210.9%
unpow210.9%
pow-prod-down10.9%
unpow210.9%
unpow210.9%
hypot-undefine23.2%
Applied egg-rr23.2%
neg-sub023.2%
distribute-neg-frac223.2%
unpow1/223.2%
hypot-undefine10.9%
unpow210.9%
unpow210.9%
+-commutative10.9%
unpow210.9%
unpow210.9%
hypot-undefine23.2%
Simplified23.2%
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
(if (<= B_m 9.2e-76)
(/
(sqrt (* (* A -8.0) (* (* C F) (+ A A))))
(- (fma C (* A -4.0) (pow B_m 2.0))))
(/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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 <= 9.2e-76) {
tmp = sqrt(((A * -8.0) * ((C * F) * (A + A)))) / -fma(C, (A * -4.0), pow(B_m, 2.0));
} else {
tmp = sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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 <= 9.2e-76) tmp = Float64(sqrt(Float64(Float64(A * -8.0) * Float64(Float64(C * 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(A, B_m))))) / 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, 9.2e-76], N[(N[Sqrt[N[(N[(A * -8.0), $MachinePrecision] * N[(N[(C * F), $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[A ^ 2 + B$95$m ^ 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.2 \cdot 10^{-76}:\\
\;\;\;\;\frac{\sqrt{\left(A \cdot -8\right) \cdot \left(\left(C \cdot F\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(A, B\_m\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 9.20000000000000025e-76Initial program 19.7%
Simplified22.2%
Taylor expanded in C around inf 14.1%
associate-*r*14.1%
associate-*r*11.3%
mul-1-neg11.3%
Simplified11.3%
if 9.20000000000000025e-76 < B Initial program 18.9%
Taylor expanded in C around 0 19.2%
mul-1-neg19.2%
+-commutative19.2%
unpow219.2%
unpow219.2%
hypot-define41.4%
Simplified41.4%
neg-sub041.4%
associate-*l/41.3%
pow1/241.3%
pow1/241.3%
hypot-undefine19.2%
unpow219.2%
unpow219.2%
pow-prod-down19.3%
unpow219.3%
unpow219.3%
hypot-undefine41.5%
Applied egg-rr41.5%
neg-sub041.5%
distribute-neg-frac241.5%
unpow1/241.5%
hypot-undefine19.3%
unpow219.3%
unpow219.3%
+-commutative19.3%
unpow219.3%
unpow219.3%
hypot-undefine41.5%
Simplified41.5%
Final simplification21.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 (<= B_m 2.1e-171)
(*
(sqrt (/ (* F (* 2.0 A)) (- (pow B_m 2.0) (* 4.0 (* A C)))))
(- (sqrt 2.0)))
(/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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.1e-171) {
tmp = sqrt(((F * (2.0 * A)) / (pow(B_m, 2.0) - (4.0 * (A * C))))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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.1e-171) {
tmp = Math.sqrt(((F * (2.0 * A)) / (Math.pow(B_m, 2.0) - (4.0 * (A * C))))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt((2.0 * (F * (A - Math.hypot(A, B_m))))) / -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.1e-171: tmp = math.sqrt(((F * (2.0 * A)) / (math.pow(B_m, 2.0) - (4.0 * (A * C))))) * -math.sqrt(2.0) else: tmp = math.sqrt((2.0 * (F * (A - math.hypot(A, B_m))))) / -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.1e-171) tmp = Float64(sqrt(Float64(Float64(F * Float64(2.0 * A)) / Float64((B_m ^ 2.0) - Float64(4.0 * Float64(A * C))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - hypot(A, B_m))))) / 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.1e-171)
tmp = sqrt(((F * (2.0 * A)) / ((B_m ^ 2.0) - (4.0 * (A * C))))) * -sqrt(2.0);
else
tmp = sqrt((2.0 * (F * (A - hypot(A, B_m))))) / -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.1e-171], N[(N[Sqrt[N[(N[(F * N[(2.0 * A), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - N[Sqrt[A ^ 2 + B$95$m ^ 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.1 \cdot 10^{-171}:\\
\;\;\;\;\sqrt{\frac{F \cdot \left(2 \cdot A\right)}{{B\_m}^{2} - 4 \cdot \left(A \cdot C\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - \mathsf{hypot}\left(A, B\_m\right)\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if B < 2.1e-171Initial program 18.1%
Taylor expanded in F around 0 17.2%
Taylor expanded in A around -inf 6.8%
if 2.1e-171 < B Initial program 21.1%
Taylor expanded in C around 0 18.7%
mul-1-neg18.7%
+-commutative18.7%
unpow218.7%
unpow218.7%
hypot-define36.9%
Simplified36.9%
neg-sub036.9%
associate-*l/36.8%
pow1/236.8%
pow1/236.8%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
pow-prod-down18.8%
unpow218.8%
unpow218.8%
hypot-undefine37.0%
Applied egg-rr37.0%
neg-sub037.0%
distribute-neg-frac237.0%
unpow1/237.0%
hypot-undefine18.7%
unpow218.7%
unpow218.7%
+-commutative18.7%
unpow218.7%
unpow218.7%
hypot-undefine37.0%
Simplified37.0%
Final simplification19.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 -1e+114) (* (sqrt (fabs (* A F))) (/ -2.0 B_m)) (/ (sqrt (* 2.0 (* F (- (* A (+ (* -0.5 (/ A B_m)) 1.0)) B_m)))) (- 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 <= -1e+114) {
tmp = sqrt(fabs((A * F))) * (-2.0 / B_m);
} else {
tmp = sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= (-1d+114)) then
tmp = sqrt(abs((a * f))) * ((-2.0d0) / b_m)
else
tmp = sqrt((2.0d0 * (f * ((a * (((-0.5d0) * (a / b_m)) + 1.0d0)) - b_m)))) / -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 <= -1e+114) {
tmp = Math.sqrt(Math.abs((A * F))) * (-2.0 / B_m);
} else {
tmp = Math.sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= -1e+114: tmp = math.sqrt(math.fabs((A * F))) * (-2.0 / B_m) else: tmp = math.sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= -1e+114) tmp = Float64(sqrt(abs(Float64(A * F))) * Float64(-2.0 / B_m)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(A * Float64(Float64(-0.5 * Float64(A / B_m)) + 1.0)) - B_m)))) / 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 <= -1e+114)
tmp = sqrt(abs((A * F))) * (-2.0 / B_m);
else
tmp = sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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, -1e+114], N[(N[Sqrt[N[Abs[N[(A * F), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(-2.0 / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(A * N[(N[(-0.5 * N[(A / B$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - B$95$m), $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 -1 \cdot 10^{+114}:\\
\;\;\;\;\sqrt{\left|A \cdot F\right|} \cdot \frac{-2}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A \cdot \left(-0.5 \cdot \frac{A}{B\_m} + 1\right) - B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -1e114Initial program 4.0%
Taylor expanded in C around 0 4.0%
mul-1-neg4.0%
+-commutative4.0%
unpow24.0%
unpow24.0%
hypot-define21.7%
Simplified21.7%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt19.5%
unpow219.5%
rem-square-sqrt19.7%
metadata-eval19.7%
Simplified19.7%
add-sqr-sqrt19.7%
pow1/219.7%
pow1/220.0%
pow-prod-down12.7%
pow212.7%
*-commutative12.7%
Applied egg-rr12.7%
unpow1/212.7%
unpow212.7%
rem-sqrt-square20.9%
Simplified20.9%
if -1e114 < A Initial program 22.1%
Taylor expanded in C around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define16.8%
Simplified16.8%
neg-sub016.8%
associate-*l/16.8%
pow1/216.8%
pow1/216.8%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
pow-prod-down9.9%
unpow29.9%
unpow29.9%
hypot-undefine16.9%
Applied egg-rr16.9%
neg-sub016.9%
distribute-neg-frac216.9%
unpow1/216.9%
hypot-undefine9.9%
unpow29.9%
unpow29.9%
+-commutative9.9%
unpow29.9%
unpow29.9%
hypot-undefine16.9%
Simplified16.9%
Taylor expanded in A around 0 14.7%
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 (/ (sqrt (* 2.0 (* F (- A (hypot A B_m))))) (- 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(A, B_m))))) / -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(A, B_m))))) / -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(A, B_m))))) / -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(A, B_m))))) / 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(A, B_m))))) / -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[A ^ 2 + B$95$m ^ 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(A, B\_m\right)\right)\right)}}{-B\_m}
\end{array}
Initial program 19.4%
Taylor expanded in C around 0 9.0%
mul-1-neg9.0%
+-commutative9.0%
unpow29.0%
unpow29.0%
hypot-define17.6%
Simplified17.6%
neg-sub017.6%
associate-*l/17.6%
pow1/217.6%
pow1/217.6%
hypot-undefine9.0%
unpow29.0%
unpow29.0%
pow-prod-down9.1%
unpow29.1%
unpow29.1%
hypot-undefine17.7%
Applied egg-rr17.7%
neg-sub017.7%
distribute-neg-frac217.7%
unpow1/217.6%
hypot-undefine9.0%
unpow29.0%
unpow29.0%
+-commutative9.0%
unpow29.0%
unpow29.0%
hypot-undefine17.6%
Simplified17.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 -7.8e+118) (* -2.0 (/ (sqrt (* A F)) B_m)) (/ (sqrt (* 2.0 (* F (- (* A (+ (* -0.5 (/ A B_m)) 1.0)) B_m)))) (- 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 <= -7.8e+118) {
tmp = -2.0 * (sqrt((A * F)) / B_m);
} else {
tmp = sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= (-7.8d+118)) then
tmp = (-2.0d0) * (sqrt((a * f)) / b_m)
else
tmp = sqrt((2.0d0 * (f * ((a * (((-0.5d0) * (a / b_m)) + 1.0d0)) - b_m)))) / -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 <= -7.8e+118) {
tmp = -2.0 * (Math.sqrt((A * F)) / B_m);
} else {
tmp = Math.sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= -7.8e+118: tmp = -2.0 * (math.sqrt((A * F)) / B_m) else: tmp = math.sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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 <= -7.8e+118) tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B_m)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(Float64(A * Float64(Float64(-0.5 * Float64(A / B_m)) + 1.0)) - B_m)))) / 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 <= -7.8e+118)
tmp = -2.0 * (sqrt((A * F)) / B_m);
else
tmp = sqrt((2.0 * (F * ((A * ((-0.5 * (A / B_m)) + 1.0)) - B_m)))) / -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, -7.8e+118], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(N[(A * N[(N[(-0.5 * N[(A / B$95$m), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] - B$95$m), $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 -7.8 \cdot 10^{+118}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A \cdot \left(-0.5 \cdot \frac{A}{B\_m} + 1\right) - B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -7.8e118Initial program 4.1%
Taylor expanded in C around 0 4.1%
mul-1-neg4.1%
+-commutative4.1%
unpow24.1%
unpow24.1%
hypot-define22.3%
Simplified22.3%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt20.0%
unpow220.0%
rem-square-sqrt20.3%
metadata-eval20.3%
Simplified20.3%
Taylor expanded in A around 0 20.3%
associate-*r/20.3%
*-rgt-identity20.3%
*-commutative20.3%
Simplified20.3%
if -7.8e118 < A Initial program 22.0%
Taylor expanded in C around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define16.8%
Simplified16.8%
neg-sub016.8%
associate-*l/16.7%
pow1/216.7%
pow1/216.7%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
pow-prod-down9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.8%
Applied egg-rr16.8%
neg-sub016.8%
distribute-neg-frac216.8%
unpow1/216.8%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.8%
Simplified16.8%
Taylor expanded in A around 0 14.6%
Final simplification15.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 (if (<= A -8.2e+129) (* -2.0 (/ (sqrt (* A F)) B_m)) (/ (sqrt (* 2.0 (* F (- A B_m)))) (- 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 <= -8.2e+129) {
tmp = -2.0 * (sqrt((A * F)) / B_m);
} else {
tmp = sqrt((2.0 * (F * (A - B_m)))) / -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 <= (-8.2d+129)) then
tmp = (-2.0d0) * (sqrt((a * f)) / b_m)
else
tmp = sqrt((2.0d0 * (f * (a - b_m)))) / -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 <= -8.2e+129) {
tmp = -2.0 * (Math.sqrt((A * F)) / B_m);
} else {
tmp = Math.sqrt((2.0 * (F * (A - B_m)))) / -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 <= -8.2e+129: tmp = -2.0 * (math.sqrt((A * F)) / B_m) else: tmp = math.sqrt((2.0 * (F * (A - B_m)))) / -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 <= -8.2e+129) tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / B_m)); else tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(A - B_m)))) / 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 <= -8.2e+129)
tmp = -2.0 * (sqrt((A * F)) / B_m);
else
tmp = sqrt((2.0 * (F * (A - B_m)))) / -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, -8.2e+129], N[(-2.0 * N[(N[Sqrt[N[(A * F), $MachinePrecision]], $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 * N[(F * N[(A - B$95$m), $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.2 \cdot 10^{+129}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(A - B\_m\right)\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -8.2000000000000005e129Initial program 4.2%
Taylor expanded in C around 0 4.2%
mul-1-neg4.2%
+-commutative4.2%
unpow24.2%
unpow24.2%
hypot-define23.3%
Simplified23.3%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt20.9%
unpow220.9%
rem-square-sqrt21.2%
metadata-eval21.2%
Simplified21.2%
Taylor expanded in A around 0 21.2%
associate-*r/21.3%
*-rgt-identity21.3%
*-commutative21.3%
Simplified21.3%
if -8.2000000000000005e129 < A Initial program 21.9%
Taylor expanded in C around 0 9.7%
mul-1-neg9.7%
+-commutative9.7%
unpow29.7%
unpow29.7%
hypot-define16.6%
Simplified16.6%
neg-sub016.6%
associate-*l/16.6%
pow1/216.6%
pow1/216.6%
hypot-undefine9.7%
unpow29.7%
unpow29.7%
pow-prod-down9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.7%
Applied egg-rr16.7%
neg-sub016.7%
distribute-neg-frac216.7%
unpow1/216.7%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.7%
Simplified16.7%
Taylor expanded in A around 0 14.1%
Final simplification15.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 (if (<= A -3.5e+127) (* -2.0 (/ (sqrt (* A F)) 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 <= -3.5e+127) {
tmp = -2.0 * (sqrt((A * F)) / 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 <= (-3.5d+127)) then
tmp = (-2.0d0) * (sqrt((a * f)) / 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 <= -3.5e+127) {
tmp = -2.0 * (Math.sqrt((A * F)) / 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 <= -3.5e+127: tmp = -2.0 * (math.sqrt((A * F)) / 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 <= -3.5e+127) tmp = Float64(-2.0 * Float64(sqrt(Float64(A * F)) / 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 <= -3.5e+127)
tmp = -2.0 * (sqrt((A * F)) / 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, -3.5e+127], N[(-2.0 * N[(N[Sqrt[N[(A * F), $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 -3.5 \cdot 10^{+127}:\\
\;\;\;\;-2 \cdot \frac{\sqrt{A \cdot F}}{B\_m}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{-2 \cdot \left(B\_m \cdot F\right)}}{-B\_m}\\
\end{array}
\end{array}
if A < -3.49999999999999978e127Initial program 4.1%
Taylor expanded in C around 0 4.1%
mul-1-neg4.1%
+-commutative4.1%
unpow24.1%
unpow24.1%
hypot-define22.8%
Simplified22.8%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt20.4%
unpow220.4%
rem-square-sqrt20.7%
metadata-eval20.7%
Simplified20.7%
Taylor expanded in A around 0 20.7%
associate-*r/20.8%
*-rgt-identity20.8%
*-commutative20.8%
Simplified20.8%
if -3.49999999999999978e127 < A Initial program 22.0%
Taylor expanded in C around 0 9.8%
mul-1-neg9.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-define16.7%
Simplified16.7%
neg-sub016.7%
associate-*l/16.7%
pow1/216.7%
pow1/216.7%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
pow-prod-down9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.7%
Applied egg-rr16.7%
neg-sub016.7%
distribute-neg-frac216.7%
unpow1/216.7%
hypot-undefine9.8%
unpow29.8%
unpow29.8%
+-commutative9.8%
unpow29.8%
unpow29.8%
hypot-undefine16.7%
Simplified16.7%
Taylor expanded in A around 0 14.9%
*-commutative14.9%
Simplified14.9%
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 (* -2.0 (/ (sqrt (* A 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 -2.0 * (sqrt((A * 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 = (-2.0d0) * (sqrt((a * 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 -2.0 * (Math.sqrt((A * 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 -2.0 * (math.sqrt((A * 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(-2.0 * Float64(sqrt(Float64(A * 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 = -2.0 * (sqrt((A * 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[(-2.0 * N[(N[Sqrt[N[(A * F), $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{A \cdot F}}{B\_m}
\end{array}
Initial program 19.4%
Taylor expanded in C around 0 9.0%
mul-1-neg9.0%
+-commutative9.0%
unpow29.0%
unpow29.0%
hypot-define17.6%
Simplified17.6%
Taylor expanded in A around -inf 0.0%
unpow20.0%
rem-square-sqrt4.9%
unpow24.9%
rem-square-sqrt4.9%
metadata-eval4.9%
Simplified4.9%
Taylor expanded in A around 0 4.9%
associate-*r/4.9%
*-rgt-identity4.9%
*-commutative4.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(Float64(2.0 * F) / B_m)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt(((2.0 * F) / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{2 \cdot F}{B\_m}}
\end{array}
Initial program 19.4%
Taylor expanded in B around -inf 0.0%
mul-1-neg0.0%
unpow20.0%
rem-square-sqrt2.0%
Simplified2.0%
add-cbrt-cube2.0%
pow1/32.0%
pow32.0%
distribute-rgt-neg-in2.0%
mul-1-neg2.0%
Applied egg-rr2.0%
*-un-lft-identity2.0%
pow-pow2.0%
metadata-eval2.0%
pow12.0%
remove-double-neg2.0%
*-commutative2.0%
pow1/22.0%
pow1/22.2%
pow-prod-down2.2%
Applied egg-rr2.2%
*-lft-identity2.2%
unpow1/22.0%
associate-*r/2.0%
Simplified2.0%
herbie shell --seed 2024123
(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))))