
(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 16 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(t_1
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_0) F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_0 (pow B_m 2.0))))
(t_2 (fma B_m B_m (* A (* C -4.0)))))
(if (<= t_1 -1e-210)
(*
(sqrt 2.0)
(-
(sqrt
(*
F
(/
(+ (+ A C) (hypot B_m (- A C)))
(fma -4.0 (* A C) (pow B_m 2.0)))))))
(if (<= t_1 0.0)
(/ (sqrt (* (* F t_2) (- (* 4.0 C) (/ (pow B_m 2.0) A)))) (- t_2))
(if (<= t_1 INFINITY)
(sqrt (- (/ F A)))
(*
(* (sqrt (+ C (hypot C B_m))) (sqrt F))
(/ -1.0 (/ B_m (sqrt 2.0)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_0) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_0 - pow(B_m, 2.0));
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (t_1 <= -1e-210) {
tmp = sqrt(2.0) * -sqrt((F * (((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0)))));
} else if (t_1 <= 0.0) {
tmp = sqrt(((F * t_2) * ((4.0 * C) - (pow(B_m, 2.0) / A)))) / -t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = sqrt(-(F / A));
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_0 - (B_m ^ 2.0))) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (t_1 <= -1e-210) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))))); elseif (t_1 <= 0.0) tmp = Float64(sqrt(Float64(Float64(F * t_2) * Float64(Float64(4.0 * C) - Float64((B_m ^ 2.0) / A)))) / Float64(-t_2)); elseif (t_1 <= Inf) tmp = sqrt(Float64(-Float64(F / A))); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); 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[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-210], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[Sqrt[N[(N[(F * t$95$2), $MachinePrecision] * N[(N[(4.0 * C), $MachinePrecision] - N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$2)), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_0 - {B\_m}^{2}}\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-210}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}}\right)\\
\mathbf{elif}\;t\_1 \leq 0:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_2\right) \cdot \left(4 \cdot C - \frac{{B\_m}^{2}}{A}\right)}}{-t\_2}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -1e-210Initial program 39.5%
Taylor expanded in F around 0 53.1%
Simplified74.3%
if -1e-210 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < -0.0Initial program 3.5%
Simplified5.3%
Taylor expanded in A around -inf 41.3%
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 52.1%
Simplified65.2%
add-sqr-sqrt64.9%
sqrt-unprod65.2%
frac-times40.4%
Applied egg-rr40.6%
Taylor expanded in A around -inf 56.8%
mul-1-neg56.8%
Simplified56.8%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) Initial program 0.0%
Taylor expanded in A around 0 2.0%
mul-1-neg2.0%
*-commutative2.0%
*-commutative2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-define18.8%
Simplified18.8%
sqrt-prod27.8%
Applied egg-rr27.8%
clear-num27.8%
inv-pow27.8%
Applied egg-rr27.8%
unpow-127.8%
Simplified27.8%
Final simplification48.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
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1e+79)
(/ (sqrt (* (* F t_0) (- (* 4.0 C) (/ (pow B_m 2.0) A)))) (- t_0))
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) (/ -1.0 (/ B_m (sqrt 2.0)))))))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) <= 1e+79) {
tmp = sqrt(((F * t_0) * ((4.0 * C) - (pow(B_m, 2.0) / A)))) / -t_0;
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
}
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) <= 1e+79) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(Float64(4.0 * C) - Float64((B_m ^ 2.0) / A)))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); 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], 1e+79], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(N[(4.0 * C), $MachinePrecision] - N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{+79}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C - \frac{{B\_m}^{2}}{A}\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999967e78Initial program 25.2%
Simplified30.0%
Taylor expanded in A around -inf 25.1%
if 9.99999999999999967e78 < (pow.f64 B #s(literal 2 binary64)) Initial program 10.4%
Taylor expanded in A around 0 9.4%
mul-1-neg9.4%
*-commutative9.4%
*-commutative9.4%
+-commutative9.4%
unpow29.4%
unpow29.4%
hypot-define24.6%
Simplified24.6%
sqrt-prod36.3%
Applied egg-rr36.3%
clear-num36.4%
inv-pow36.4%
Applied egg-rr36.4%
unpow-136.4%
Simplified36.4%
Final simplification30.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) 500.0)
(-
(/
(sqrt (* (* (* A -4.0) (* C F)) (* 2.0 (* 2.0 C))))
(fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e+133)
(/ (sqrt (* F (+ C (hypot C B_m)))) (/ (- B_m) (sqrt 2.0)))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))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) <= 500.0) {
tmp = -(sqrt((((A * -4.0) * (C * F)) * (2.0 * (2.0 * C)))) / fma(B_m, B_m, (A * (C * -4.0))));
} else if (pow(B_m, 2.0) <= 5e+133) {
tmp = sqrt((F * (C + hypot(C, B_m)))) / (-B_m / sqrt(2.0));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
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) <= 500.0) tmp = Float64(-Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(C * F)) * Float64(2.0 * Float64(2.0 * C)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif ((B_m ^ 2.0) <= 5e+133) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(C, B_m)))) / Float64(Float64(-B_m) / sqrt(2.0))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); 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], 500.0], (-N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+133], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[((-B$95$m) / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 500:\\
\;\;\;\;-\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(C \cdot F\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+133}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}}{\frac{-B\_m}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 500Initial program 24.9%
Simplified29.6%
Taylor expanded in B around 0 19.5%
associate-*r*19.5%
Simplified19.5%
Taylor expanded in C around inf 15.3%
Taylor expanded in A around 0 20.7%
if 500 < (pow.f64 B #s(literal 2 binary64)) < 4.99999999999999961e133Initial program 27.6%
Taylor expanded in A around 0 6.8%
mul-1-neg6.8%
*-commutative6.8%
*-commutative6.8%
+-commutative6.8%
unpow26.8%
unpow26.8%
hypot-define7.1%
Simplified7.1%
sqrt-prod7.0%
Applied egg-rr7.0%
clear-num7.0%
inv-pow7.0%
Applied egg-rr7.0%
unpow-17.0%
Simplified7.0%
un-div-inv7.0%
sqrt-unprod7.0%
Applied egg-rr7.0%
if 4.99999999999999961e133 < (pow.f64 B #s(literal 2 binary64)) Initial program 8.4%
Taylor expanded in A around 0 10.0%
mul-1-neg10.0%
*-commutative10.0%
*-commutative10.0%
+-commutative10.0%
unpow210.0%
unpow210.0%
hypot-define26.7%
Simplified26.7%
sqrt-prod39.6%
Applied egg-rr39.6%
Taylor expanded in C around 0 35.8%
Final simplification25.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
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 500.0)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(* (* (sqrt (+ C (hypot C B_m))) (sqrt F)) (/ -1.0 (/ B_m (sqrt 2.0)))))))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) <= 500.0) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else {
tmp = (sqrt((C + hypot(C, B_m))) * sqrt(F)) * (-1.0 / (B_m / sqrt(2.0)));
}
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) <= 500.0) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); 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], 500.0], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 500:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right) \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 500Initial program 24.9%
Simplified29.6%
Taylor expanded in A around -inf 23.6%
*-commutative23.6%
Simplified23.6%
if 500 < (pow.f64 B #s(literal 2 binary64)) Initial program 12.8%
Taylor expanded in A around 0 9.3%
mul-1-neg9.3%
*-commutative9.3%
*-commutative9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-define22.3%
Simplified22.3%
sqrt-prod32.3%
Applied egg-rr32.3%
clear-num32.3%
inv-pow32.3%
Applied egg-rr32.3%
unpow-132.3%
Simplified32.3%
Final simplification28.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 500.0)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(* (/ (sqrt 2.0) B_m) (- (* (sqrt (+ C (hypot C B_m))) (sqrt F)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 500.0) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else {
tmp = (sqrt(2.0) / B_m) * -(sqrt((C + hypot(C, B_m))) * sqrt(F));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 500.0) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-Float64(sqrt(Float64(C + hypot(C, B_m))) * sqrt(F)))); 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], 500.0], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[(N[Sqrt[N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 500:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(C, B\_m\right)} \cdot \sqrt{F}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 500Initial program 24.9%
Simplified29.6%
Taylor expanded in A around -inf 23.6%
*-commutative23.6%
Simplified23.6%
if 500 < (pow.f64 B #s(literal 2 binary64)) Initial program 12.8%
Taylor expanded in A around 0 9.3%
mul-1-neg9.3%
*-commutative9.3%
*-commutative9.3%
+-commutative9.3%
unpow29.3%
unpow29.3%
hypot-define22.3%
Simplified22.3%
sqrt-prod32.3%
Applied egg-rr32.3%
Final simplification28.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 1e+98)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))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) <= 1e+98) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
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) <= 1e+98) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); 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], 1e+98], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{+98}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.99999999999999998e97Initial program 25.1%
Simplified30.5%
Taylor expanded in A around -inf 21.9%
*-commutative21.9%
Simplified21.9%
if 9.99999999999999998e97 < (pow.f64 B #s(literal 2 binary64)) Initial program 9.8%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
*-commutative9.7%
*-commutative9.7%
+-commutative9.7%
unpow29.7%
unpow29.7%
hypot-define25.5%
Simplified25.5%
sqrt-prod37.8%
Applied egg-rr37.8%
Taylor expanded in C around 0 34.0%
Final simplification27.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 (/ (sqrt 2.0) B_m)))
(if (<= B_m 44.0)
(-
(/
(sqrt (* (* (* A -4.0) (* C F)) (* 2.0 (* 2.0 C))))
(fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 7e+66)
(* t_0 (- (sqrt (* F (+ C (hypot C B_m))))))
(* t_0 (* (sqrt F) (- (sqrt (+ B_m C)))))))))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 = sqrt(2.0) / B_m;
double tmp;
if (B_m <= 44.0) {
tmp = -(sqrt((((A * -4.0) * (C * F)) * (2.0 * (2.0 * C)))) / fma(B_m, B_m, (A * (C * -4.0))));
} else if (B_m <= 7e+66) {
tmp = t_0 * -sqrt((F * (C + hypot(C, B_m))));
} else {
tmp = t_0 * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (B_m <= 44.0) tmp = Float64(-Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(C * F)) * Float64(2.0 * Float64(2.0 * C)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 7e+66) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B_m)))))); else tmp = Float64(t_0 * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); 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[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 44.0], (-N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[B$95$m, 7e+66], N[(t$95$0 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B\_m}\\
\mathbf{if}\;B\_m \leq 44:\\
\;\;\;\;-\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(C \cdot F\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 7 \cdot 10^{+66}:\\
\;\;\;\;t\_0 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 44Initial program 20.6%
Simplified24.7%
Taylor expanded in B around 0 13.9%
associate-*r*13.9%
Simplified13.9%
Taylor expanded in C around inf 11.2%
Taylor expanded in A around 0 14.8%
if 44 < B < 6.9999999999999994e66Initial program 11.7%
Taylor expanded in A around 0 14.9%
mul-1-neg14.9%
*-commutative14.9%
*-commutative14.9%
+-commutative14.9%
unpow214.9%
unpow214.9%
hypot-define14.9%
Simplified14.9%
if 6.9999999999999994e66 < B Initial program 11.9%
Taylor expanded in A around 0 18.5%
mul-1-neg18.5%
*-commutative18.5%
*-commutative18.5%
+-commutative18.5%
unpow218.5%
unpow218.5%
hypot-define49.9%
Simplified49.9%
sqrt-prod74.7%
Applied egg-rr74.7%
Taylor expanded in C around 0 69.2%
Final simplification26.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 (<= B_m 31.0)
(-
(/
(sqrt (* (* (* A -4.0) (* C F)) (* 2.0 (* 2.0 C))))
(fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 2.7e+118)
(/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 31.0) {
tmp = -(sqrt((((A * -4.0) * (C * F)) * (2.0 * (2.0 * C)))) / fma(B_m, B_m, (A * (C * -4.0))));
} else if (B_m <= 2.7e+118) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = 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 <= 31.0) tmp = Float64(-Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(C * F)) * Float64(2.0 * Float64(2.0 * C)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 2.7e+118) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = 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, 31.0], (-N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), If[LessEqual[B$95$m, 2.7e+118], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 31:\\
\;\;\;\;-\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(C \cdot F\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 2.7 \cdot 10^{+118}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 31Initial program 20.6%
Simplified24.7%
Taylor expanded in B around 0 13.9%
associate-*r*13.9%
Simplified13.9%
Taylor expanded in C around inf 11.2%
Taylor expanded in A around 0 14.8%
if 31 < B < 2.7e118Initial program 26.2%
Taylor expanded in A around 0 27.6%
mul-1-neg27.6%
*-commutative27.6%
*-commutative27.6%
+-commutative27.6%
unpow227.6%
unpow227.6%
hypot-define27.6%
Simplified27.6%
neg-sub027.6%
associate-*r/27.6%
pow1/227.6%
pow1/227.6%
pow-prod-down27.6%
Applied egg-rr27.6%
neg-sub027.6%
distribute-neg-frac227.6%
unpow1/227.6%
Simplified27.6%
if 2.7e118 < B Initial program 3.1%
Taylor expanded in B around inf 60.3%
mul-1-neg60.3%
*-commutative60.3%
Simplified60.3%
sqrt-div73.7%
Applied egg-rr73.7%
Final simplification25.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 (<= B_m 7.5e+48)
(-
(/
(sqrt (* (* (* A -4.0) (* C F)) (* 2.0 (* 2.0 C))))
(fma B_m B_m (* A (* C -4.0)))))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C)))))))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 <= 7.5e+48) {
tmp = -(sqrt((((A * -4.0) * (C * F)) * (2.0 * (2.0 * C)))) / fma(B_m, B_m, (A * (C * -4.0))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
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 <= 7.5e+48) tmp = Float64(-Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(C * F)) * Float64(2.0 * Float64(2.0 * C)))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); 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, 7.5e+48], (-N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 7.5 \cdot 10^{+48}:\\
\;\;\;\;-\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(C \cdot F\right)\right) \cdot \left(2 \cdot \left(2 \cdot C\right)\right)}}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 7.5000000000000006e48Initial program 20.4%
Simplified24.3%
Taylor expanded in B around 0 13.5%
associate-*r*13.5%
Simplified13.5%
Taylor expanded in C around inf 11.3%
Taylor expanded in A around 0 14.8%
if 7.5000000000000006e48 < B Initial program 11.4%
Taylor expanded in A around 0 17.9%
mul-1-neg17.9%
*-commutative17.9%
*-commutative17.9%
+-commutative17.9%
unpow217.9%
unpow217.9%
hypot-define47.7%
Simplified47.7%
sqrt-prod71.2%
Applied egg-rr71.2%
Taylor expanded in C around 0 66.0%
Final simplification26.4%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-311)
(sqrt (- (/ F A)))
(if (<= F 6.2e+59)
(/ (sqrt (* 2.0 (* F (+ C (hypot C B_m))))) (- B_m))
(- (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) {
double tmp;
if (F <= -5e-311) {
tmp = sqrt(-(F / A));
} else if (F <= 6.2e+59) {
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -5e-311) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 6.2e+59) {
tmp = Math.sqrt((2.0 * (F * (C + Math.hypot(C, B_m))))) / -B_m;
} else {
tmp = -Math.sqrt((2.0 * (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 F <= -5e-311: tmp = math.sqrt(-(F / A)) elif F <= 6.2e+59: tmp = math.sqrt((2.0 * (F * (C + math.hypot(C, B_m))))) / -B_m else: tmp = -math.sqrt((2.0 * (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 (F <= -5e-311) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 6.2e+59) tmp = Float64(sqrt(Float64(2.0 * Float64(F * Float64(C + hypot(C, B_m))))) / Float64(-B_m)); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -5e-311)
tmp = sqrt(-(F / A));
elseif (F <= 6.2e+59)
tmp = sqrt((2.0 * (F * (C + hypot(C, B_m))))) / -B_m;
else
tmp = -sqrt((2.0 * (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[F, -5e-311], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 6.2e+59], N[(N[Sqrt[N[(2.0 * N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], (-N[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])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 6.2 \cdot 10^{+59}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -5.00000000000023e-311Initial program 33.2%
Simplified43.6%
add-sqr-sqrt43.4%
sqrt-unprod43.6%
frac-times27.2%
Applied egg-rr27.4%
Taylor expanded in A around -inf 55.5%
mul-1-neg55.5%
Simplified55.5%
if -5.00000000000023e-311 < F < 6.20000000000000029e59Initial program 24.3%
Taylor expanded in A around 0 10.6%
mul-1-neg10.6%
*-commutative10.6%
*-commutative10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-define23.8%
Simplified23.8%
neg-sub023.8%
associate-*r/23.8%
pow1/223.8%
pow1/223.8%
pow-prod-down24.0%
Applied egg-rr24.0%
neg-sub024.0%
distribute-neg-frac224.0%
unpow1/224.0%
Simplified24.0%
if 6.20000000000000029e59 < F Initial program 8.1%
Taylor expanded in B around inf 18.0%
mul-1-neg18.0%
*-commutative18.0%
Simplified18.0%
*-commutative18.0%
pow1/218.4%
pow1/218.4%
pow-prod-down18.5%
Applied egg-rr18.5%
unpow1/218.1%
Simplified18.1%
Final simplification23.9%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-311)
(sqrt (- (/ F A)))
(if (<= F 7.2e+57)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ B_m C)))))
(- (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) {
double tmp;
if (F <= -5e-311) {
tmp = sqrt(-(F / A));
} else if (F <= 7.2e+57) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
} else {
tmp = -sqrt((2.0 * (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 (f <= (-5d-311)) then
tmp = sqrt(-(f / a))
else if (f <= 7.2d+57) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((f * (b_m + c)))
else
tmp = -sqrt((2.0d0 * (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 (F <= -5e-311) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 7.2e+57) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (B_m + C)));
} else {
tmp = -Math.sqrt((2.0 * (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 F <= -5e-311: tmp = math.sqrt(-(F / A)) elif F <= 7.2e+57: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (B_m + C))) else: tmp = -math.sqrt((2.0 * (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 (F <= -5e-311) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 7.2e+57) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(B_m + C))))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -5e-311)
tmp = sqrt(-(F / A));
elseif (F <= 7.2e+57)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (B_m + C)));
else
tmp = -sqrt((2.0 * (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[F, -5e-311], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 7.2e+57], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(B$95$m + C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-N[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])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 7.2 \cdot 10^{+57}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(B\_m + C\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -5.00000000000023e-311Initial program 33.2%
Simplified43.6%
add-sqr-sqrt43.4%
sqrt-unprod43.6%
frac-times27.2%
Applied egg-rr27.4%
Taylor expanded in A around -inf 55.5%
mul-1-neg55.5%
Simplified55.5%
if -5.00000000000023e-311 < F < 7.2000000000000005e57Initial program 24.3%
Taylor expanded in A around 0 10.6%
mul-1-neg10.6%
*-commutative10.6%
*-commutative10.6%
+-commutative10.6%
unpow210.6%
unpow210.6%
hypot-define23.8%
Simplified23.8%
Taylor expanded in C around 0 20.1%
if 7.2000000000000005e57 < F Initial program 8.1%
Taylor expanded in B around inf 18.0%
mul-1-neg18.0%
*-commutative18.0%
Simplified18.0%
*-commutative18.0%
pow1/218.4%
pow1/218.4%
pow-prod-down18.5%
Applied egg-rr18.5%
unpow1/218.1%
Simplified18.1%
Final simplification21.9%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-311)
(sqrt (- (/ F A)))
(if (<= F 2.3e-77)
(* (sqrt (* B_m F)) (/ -1.0 (/ B_m (sqrt 2.0))))
(- (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) {
double tmp;
if (F <= -5e-311) {
tmp = sqrt(-(F / A));
} else if (F <= 2.3e-77) {
tmp = sqrt((B_m * F)) * (-1.0 / (B_m / sqrt(2.0)));
} else {
tmp = -sqrt((2.0 * (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 (f <= (-5d-311)) then
tmp = sqrt(-(f / a))
else if (f <= 2.3d-77) then
tmp = sqrt((b_m * f)) * ((-1.0d0) / (b_m / sqrt(2.0d0)))
else
tmp = -sqrt((2.0d0 * (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 (F <= -5e-311) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 2.3e-77) {
tmp = Math.sqrt((B_m * F)) * (-1.0 / (B_m / Math.sqrt(2.0)));
} else {
tmp = -Math.sqrt((2.0 * (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 F <= -5e-311: tmp = math.sqrt(-(F / A)) elif F <= 2.3e-77: tmp = math.sqrt((B_m * F)) * (-1.0 / (B_m / math.sqrt(2.0))) else: tmp = -math.sqrt((2.0 * (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 (F <= -5e-311) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 2.3e-77) tmp = Float64(sqrt(Float64(B_m * F)) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -5e-311)
tmp = sqrt(-(F / A));
elseif (F <= 2.3e-77)
tmp = sqrt((B_m * F)) * (-1.0 / (B_m / sqrt(2.0)));
else
tmp = -sqrt((2.0 * (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[F, -5e-311], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 2.3e-77], N[(N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], (-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])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 2.3 \cdot 10^{-77}:\\
\;\;\;\;\sqrt{B\_m \cdot F} \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -5.00000000000023e-311Initial program 33.2%
Simplified43.6%
add-sqr-sqrt43.4%
sqrt-unprod43.6%
frac-times27.2%
Applied egg-rr27.4%
Taylor expanded in A around -inf 55.5%
mul-1-neg55.5%
Simplified55.5%
if -5.00000000000023e-311 < F < 2.29999999999999999e-77Initial program 24.1%
Taylor expanded in A around 0 12.9%
mul-1-neg12.9%
*-commutative12.9%
*-commutative12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-define27.8%
Simplified27.8%
sqrt-prod29.0%
Applied egg-rr29.0%
clear-num29.0%
inv-pow29.0%
Applied egg-rr29.0%
unpow-129.0%
Simplified29.0%
Taylor expanded in C around 0 24.6%
*-commutative24.6%
Simplified24.6%
if 2.29999999999999999e-77 < F Initial program 13.5%
Taylor expanded in B around inf 16.7%
mul-1-neg16.7%
*-commutative16.7%
Simplified16.7%
*-commutative16.7%
pow1/217.0%
pow1/217.0%
pow-prod-down17.1%
Applied egg-rr17.1%
unpow1/216.8%
Simplified16.8%
Final simplification22.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F -5e-311)
(sqrt (- (/ F A)))
(if (<= F 2.2e-77)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
(- (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) {
double tmp;
if (F <= -5e-311) {
tmp = sqrt(-(F / A));
} else if (F <= 2.2e-77) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else {
tmp = -sqrt((2.0 * (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 (f <= (-5d-311)) then
tmp = sqrt(-(f / a))
else if (f <= 2.2d-77) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else
tmp = -sqrt((2.0d0 * (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 (F <= -5e-311) {
tmp = Math.sqrt(-(F / A));
} else if (F <= 2.2e-77) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else {
tmp = -Math.sqrt((2.0 * (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 F <= -5e-311: tmp = math.sqrt(-(F / A)) elif F <= 2.2e-77: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) else: tmp = -math.sqrt((2.0 * (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 (F <= -5e-311) tmp = sqrt(Float64(-Float64(F / A))); elseif (F <= 2.2e-77) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= -5e-311)
tmp = sqrt(-(F / A));
elseif (F <= 2.2e-77)
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
else
tmp = -sqrt((2.0 * (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[F, -5e-311], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[F, 2.2e-77], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], (-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])\\
\\
\begin{array}{l}
\mathbf{if}\;F \leq -5 \cdot 10^{-311}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{-77}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot F}\right)\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if F < -5.00000000000023e-311Initial program 33.2%
Simplified43.6%
add-sqr-sqrt43.4%
sqrt-unprod43.6%
frac-times27.2%
Applied egg-rr27.4%
Taylor expanded in A around -inf 55.5%
mul-1-neg55.5%
Simplified55.5%
if -5.00000000000023e-311 < F < 2.20000000000000007e-77Initial program 24.1%
Taylor expanded in A around 0 12.9%
mul-1-neg12.9%
*-commutative12.9%
*-commutative12.9%
+-commutative12.9%
unpow212.9%
unpow212.9%
hypot-define27.8%
Simplified27.8%
Taylor expanded in C around 0 24.5%
if 2.20000000000000007e-77 < F Initial program 13.5%
Taylor expanded in B around inf 16.7%
mul-1-neg16.7%
*-commutative16.7%
Simplified16.7%
*-commutative16.7%
pow1/217.0%
pow1/217.0%
pow-prod-down17.1%
Applied egg-rr17.1%
unpow1/216.8%
Simplified16.8%
Final simplification22.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 (<= B_m 2.85e-164)
(/
(sqrt (* (* (* A -4.0) (* C F)) (* 2.0 (* C (+ 2.0 (- (/ A C) (/ A C)))))))
(* 4.0 (* A C)))
(if (<= B_m 22.5) (sqrt (- (/ F A))) (- (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) {
double tmp;
if (B_m <= 2.85e-164) {
tmp = sqrt((((A * -4.0) * (C * F)) * (2.0 * (C * (2.0 + ((A / C) - (A / C))))))) / (4.0 * (A * C));
} else if (B_m <= 22.5) {
tmp = sqrt(-(F / A));
} else {
tmp = -sqrt((2.0 * (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 (b_m <= 2.85d-164) then
tmp = sqrt((((a * (-4.0d0)) * (c * f)) * (2.0d0 * (c * (2.0d0 + ((a / c) - (a / c))))))) / (4.0d0 * (a * c))
else if (b_m <= 22.5d0) then
tmp = sqrt(-(f / a))
else
tmp = -sqrt((2.0d0 * (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 (B_m <= 2.85e-164) {
tmp = Math.sqrt((((A * -4.0) * (C * F)) * (2.0 * (C * (2.0 + ((A / C) - (A / C))))))) / (4.0 * (A * C));
} else if (B_m <= 22.5) {
tmp = Math.sqrt(-(F / A));
} else {
tmp = -Math.sqrt((2.0 * (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 B_m <= 2.85e-164: tmp = math.sqrt((((A * -4.0) * (C * F)) * (2.0 * (C * (2.0 + ((A / C) - (A / C))))))) / (4.0 * (A * C)) elif B_m <= 22.5: tmp = math.sqrt(-(F / A)) else: tmp = -math.sqrt((2.0 * (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 (B_m <= 2.85e-164) tmp = Float64(sqrt(Float64(Float64(Float64(A * -4.0) * Float64(C * F)) * Float64(2.0 * Float64(C * Float64(2.0 + Float64(Float64(A / C) - Float64(A / C))))))) / Float64(4.0 * Float64(A * C))); elseif (B_m <= 22.5) tmp = sqrt(Float64(-Float64(F / A))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 2.85e-164)
tmp = sqrt((((A * -4.0) * (C * F)) * (2.0 * (C * (2.0 + ((A / C) - (A / C))))))) / (4.0 * (A * C));
elseif (B_m <= 22.5)
tmp = sqrt(-(F / A));
else
tmp = -sqrt((2.0 * (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[B$95$m, 2.85e-164], N[(N[Sqrt[N[(N[(N[(A * -4.0), $MachinePrecision] * N[(C * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * N[(C * N[(2.0 + N[(N[(A / C), $MachinePrecision] - N[(A / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 22.5], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], (-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])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.85 \cdot 10^{-164}:\\
\;\;\;\;\frac{\sqrt{\left(\left(A \cdot -4\right) \cdot \left(C \cdot F\right)\right) \cdot \left(2 \cdot \left(C \cdot \left(2 + \left(\frac{A}{C} - \frac{A}{C}\right)\right)\right)\right)}}{4 \cdot \left(A \cdot C\right)}\\
\mathbf{elif}\;B\_m \leq 22.5:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 2.85000000000000011e-164Initial program 18.9%
Simplified22.7%
Taylor expanded in B around 0 12.7%
associate-*r*12.7%
Simplified12.7%
Taylor expanded in C around inf 11.6%
Taylor expanded in B around 0 12.0%
if 2.85000000000000011e-164 < B < 22.5Initial program 30.5%
Simplified36.3%
add-sqr-sqrt8.9%
sqrt-unprod10.0%
frac-times9.8%
Applied egg-rr9.8%
Taylor expanded in A around -inf 15.8%
mul-1-neg15.8%
Simplified15.8%
if 22.5 < B Initial program 11.9%
Taylor expanded in B around inf 50.8%
mul-1-neg50.8%
*-commutative50.8%
Simplified50.8%
*-commutative50.8%
pow1/250.8%
pow1/250.8%
pow-prod-down51.1%
Applied egg-rr51.1%
unpow1/251.1%
Simplified51.1%
Final simplification22.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 (<= B_m 225.0) (sqrt (- (/ F A))) (- (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) {
double tmp;
if (B_m <= 225.0) {
tmp = sqrt(-(F / A));
} else {
tmp = -sqrt((2.0 * (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 (b_m <= 225.0d0) then
tmp = sqrt(-(f / a))
else
tmp = -sqrt((2.0d0 * (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 (B_m <= 225.0) {
tmp = Math.sqrt(-(F / A));
} else {
tmp = -Math.sqrt((2.0 * (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 B_m <= 225.0: tmp = math.sqrt(-(F / A)) else: tmp = -math.sqrt((2.0 * (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 (B_m <= 225.0) tmp = sqrt(Float64(-Float64(F / A))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 225.0)
tmp = sqrt(-(F / A));
else
tmp = -sqrt((2.0 * (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[B$95$m, 225.0], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], (-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])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 225:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 225Initial program 20.6%
Simplified24.7%
add-sqr-sqrt6.5%
sqrt-unprod6.9%
frac-times4.6%
Applied egg-rr4.6%
Taylor expanded in A around -inf 12.2%
mul-1-neg12.2%
Simplified12.2%
if 225 < B Initial program 11.9%
Taylor expanded in B around inf 50.8%
mul-1-neg50.8%
*-commutative50.8%
Simplified50.8%
*-commutative50.8%
pow1/250.8%
pow1/250.8%
pow-prod-down51.1%
Applied egg-rr51.1%
unpow1/251.1%
Simplified51.1%
Final simplification22.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 (- (/ F A))))
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 / A));
}
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(-(f / a))
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(-(F / A));
}
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 / A))
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(F / A))) 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 / A));
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[(F / A), $MachinePrecision])], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{-\frac{F}{A}}
\end{array}
Initial program 18.4%
Simplified22.1%
add-sqr-sqrt4.9%
sqrt-unprod5.3%
frac-times3.6%
Applied egg-rr3.6%
Taylor expanded in A around -inf 9.5%
mul-1-neg9.5%
Simplified9.5%
herbie shell --seed 2024185
(FPCore (A B C F)
:name "ABCF->ab-angle a"
:precision binary64
(/ (- (sqrt (* (* 2.0 (* (- (pow B 2.0) (* (* 4.0 A) C)) F)) (+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0))))))) (- (pow B 2.0) (* (* 4.0 A) C))))