
(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)))))
(if (<= t_1 -1e-164)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(if (<= t_1 1e+161)
(/
(sqrt
(*
(* (fma A (* C -4.0) (pow B_m 2.0)) (* 2.0 F))
(+
(* 2.0 C)
(*
(pow B_m 2.0)
(+
(* -0.125 (/ (pow B_m 2.0) (pow (- C A) 3.0)))
(* 0.5 (/ -1.0 (- A C))))))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= t_1 INFINITY)
(/
(*
(pow
(*
(exp (* 0.25 (- (log (* -4.0 (* A F))) (log (/ 1.0 C)))))
(sqrt (sqrt 2.0)))
2.0)
(sqrt (+ A (+ C (hypot (- A C) B_m)))))
(- (fma B_m B_m (* A (* C -4.0)))))
(* (sqrt (/ 2.0 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 = (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 tmp;
if (t_1 <= -1e-164) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else if (t_1 <= 1e+161) {
tmp = sqrt(((fma(A, (C * -4.0), pow(B_m, 2.0)) * (2.0 * F)) * ((2.0 * C) + (pow(B_m, 2.0) * ((-0.125 * (pow(B_m, 2.0) / pow((C - A), 3.0))) + (0.5 * (-1.0 / (A - C)))))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (pow((exp((0.25 * (log((-4.0 * (A * F))) - log((1.0 / C))))) * sqrt(sqrt(2.0))), 2.0) * sqrt((A + (C + hypot((A - C), B_m))))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = sqrt((2.0 / 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 = 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))) tmp = 0.0 if (t_1 <= -1e-164) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); elseif (t_1 <= 1e+161) tmp = Float64(sqrt(Float64(Float64(fma(A, Float64(C * -4.0), (B_m ^ 2.0)) * Float64(2.0 * F)) * Float64(Float64(2.0 * C) + Float64((B_m ^ 2.0) * Float64(Float64(-0.125 * Float64((B_m ^ 2.0) / (Float64(C - A) ^ 3.0))) + Float64(0.5 * Float64(-1.0 / Float64(A - C)))))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (t_1 <= Inf) tmp = Float64(Float64((Float64(exp(Float64(0.25 * Float64(log(Float64(-4.0 * Float64(A * F))) - log(Float64(1.0 / C))))) * sqrt(sqrt(2.0))) ^ 2.0) * sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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[(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]}, If[LessEqual[t$95$1, -1e-164], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, 1e+161], N[(N[Sqrt[N[(N[(N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(N[(-0.125 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / N[Power[N[(C - A), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Power[N[(N[Exp[N[(0.25 * N[(N[Log[N[(-4.0 * N[(A * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] - N[Log[N[(1.0 / C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[Sqrt[2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] * N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-164}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_1 \leq 10^{+161}:\\
\;\;\;\;\frac{\sqrt{\left(\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C + {B\_m}^{2} \cdot \left(-0.125 \cdot \frac{{B\_m}^{2}}{{\left(C - A\right)}^{3}} + 0.5 \cdot \frac{-1}{A - C}\right)\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{{\left(e^{0.25 \cdot \left(\log \left(-4 \cdot \left(A \cdot F\right)\right) - \log \left(\frac{1}{C}\right)\right)} \cdot \sqrt{\sqrt{2}}\right)}^{2} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\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))) < -9.99999999999999962e-165Initial program 33.0%
Taylor expanded in F around 0 45.9%
mul-1-neg45.9%
Simplified80.6%
if -9.99999999999999962e-165 < (/.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))) < 1e161Initial program 26.3%
Simplified28.7%
Taylor expanded in B around 0 32.6%
if 1e161 < (/.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 4.3%
Simplified31.0%
pow1/231.0%
associate-*r*31.0%
associate-+r+31.0%
hypot-undefine4.3%
unpow24.3%
unpow24.3%
+-commutative4.3%
unpow-prod-down9.6%
*-commutative9.6%
pow1/29.6%
Applied egg-rr62.4%
unpow1/262.4%
associate-*l*62.4%
associate-*r*62.4%
Simplified62.4%
add-sqr-sqrt62.1%
pow262.1%
*-commutative62.1%
associate-*r*62.1%
Applied egg-rr62.1%
Taylor expanded in C around inf 52.5%
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 B around inf 18.7%
mul-1-neg18.7%
Simplified18.7%
pow118.7%
sqrt-unprod18.7%
Applied egg-rr18.7%
unpow118.7%
Simplified18.7%
Taylor expanded in F around 0 18.7%
associate-*r/18.7%
*-commutative18.7%
associate-/l*18.7%
Simplified18.7%
*-commutative18.7%
sqrt-prod30.2%
Applied egg-rr30.2%
Final simplification49.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (* (* 4.0 A) C))
(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)))))
(if (<= t_1 -1e-164)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(if (<= t_1 2e-72)
(/
(sqrt
(*
(* (fma A (* C -4.0) (pow B_m 2.0)) (* 2.0 F))
(+
(* 2.0 C)
(*
(pow B_m 2.0)
(+
(* -0.125 (/ (pow B_m 2.0) (pow (- C A) 3.0)))
(* 0.5 (/ -1.0 (- A C))))))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= t_1 INFINITY)
(/
(*
(sqrt (* F (* 2.0 (fma B_m B_m (* -4.0 (* A C))))))
(sqrt (* 2.0 C)))
(- (fma B_m B_m (* A (* C -4.0)))))
(* (sqrt (/ 2.0 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 = (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 tmp;
if (t_1 <= -1e-164) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else if (t_1 <= 2e-72) {
tmp = sqrt(((fma(A, (C * -4.0), pow(B_m, 2.0)) * (2.0 * F)) * ((2.0 * C) + (pow(B_m, 2.0) * ((-0.125 * (pow(B_m, 2.0) / pow((C - A), 3.0))) + (0.5 * (-1.0 / (A - C)))))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (t_1 <= ((double) INFINITY)) {
tmp = (sqrt((F * (2.0 * fma(B_m, B_m, (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = sqrt((2.0 / 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 = 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))) tmp = 0.0 if (t_1 <= -1e-164) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); elseif (t_1 <= 2e-72) tmp = Float64(sqrt(Float64(Float64(fma(A, Float64(C * -4.0), (B_m ^ 2.0)) * Float64(2.0 * F)) * Float64(Float64(2.0 * C) + Float64((B_m ^ 2.0) * Float64(Float64(-0.125 * Float64((B_m ^ 2.0) / (Float64(C - A) ^ 3.0))) + Float64(0.5 * Float64(-1.0 / Float64(A - C)))))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (t_1 <= Inf) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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[(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]}, If[LessEqual[t$95$1, -1e-164], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$1, 2e-72], N[(N[Sqrt[N[(N[(N[(A * N[(C * -4.0), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(2.0 * C), $MachinePrecision] + N[(N[Power[B$95$m, 2.0], $MachinePrecision] * N[(N[(-0.125 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / N[Power[N[(C - A), $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 * N[(-1.0 / N[(A - C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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}}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-164}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\sqrt{\left(\mathsf{fma}\left(A, C \cdot -4, {B\_m}^{2}\right) \cdot \left(2 \cdot F\right)\right) \cdot \left(2 \cdot C + {B\_m}^{2} \cdot \left(-0.125 \cdot \frac{{B\_m}^{2}}{{\left(C - A\right)}^{3}} + 0.5 \cdot \frac{-1}{A - C}\right)\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\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))) < -9.99999999999999962e-165Initial program 33.0%
Taylor expanded in F around 0 45.9%
mul-1-neg45.9%
Simplified80.6%
if -9.99999999999999962e-165 < (/.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))) < 1.9999999999999999e-72Initial program 12.2%
Simplified15.1%
Taylor expanded in B around 0 28.0%
if 1.9999999999999999e-72 < (/.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 35.8%
Simplified53.0%
pow1/253.0%
associate-*r*53.0%
associate-+r+53.0%
hypot-undefine35.8%
unpow235.8%
unpow235.8%
+-commutative35.8%
unpow-prod-down40.8%
*-commutative40.8%
pow1/240.8%
Applied egg-rr74.7%
unpow1/274.7%
associate-*l*74.7%
associate-*r*74.7%
Simplified74.7%
Taylor expanded in A around -inf 41.2%
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 B around inf 18.7%
mul-1-neg18.7%
Simplified18.7%
pow118.7%
sqrt-unprod18.7%
Applied egg-rr18.7%
unpow118.7%
Simplified18.7%
Taylor expanded in F around 0 18.7%
associate-*r/18.7%
*-commutative18.7%
associate-/l*18.7%
Simplified18.7%
*-commutative18.7%
sqrt-prod30.2%
Applied egg-rr30.2%
Final simplification47.7%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (- t_0))
(t_2 (* (* 4.0 A) C))
(t_3
(/
(sqrt
(*
(* 2.0 (* (- (pow B_m 2.0) t_2) F))
(+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
(- t_2 (pow B_m 2.0)))))
(if (<= t_3 -2e-213)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(if (<= t_3 2e-72)
(/ (sqrt (* (* F t_0) (- (* 4.0 C) (/ (pow B_m 2.0) A)))) t_1)
(if (<= t_3 INFINITY)
(/
(*
(sqrt (* F (* 2.0 (fma B_m B_m (* -4.0 (* A C))))))
(sqrt (* 2.0 C)))
t_1)
(* (sqrt (/ 2.0 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 t_1 = -t_0;
double t_2 = (4.0 * A) * C;
double t_3 = sqrt(((2.0 * ((pow(B_m, 2.0) - t_2) * F)) * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / (t_2 - pow(B_m, 2.0));
double tmp;
if (t_3 <= -2e-213) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else if (t_3 <= 2e-72) {
tmp = sqrt(((F * t_0) * ((4.0 * C) - (pow(B_m, 2.0) / A)))) / t_1;
} else if (t_3 <= ((double) INFINITY)) {
tmp = (sqrt((F * (2.0 * fma(B_m, B_m, (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / t_1;
} else {
tmp = sqrt((2.0 / 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))) t_1 = Float64(-t_0) t_2 = Float64(Float64(4.0 * A) * C) t_3 = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_2) * F)) * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / Float64(t_2 - (B_m ^ 2.0))) tmp = 0.0 if (t_3 <= -2e-213) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); elseif (t_3 <= 2e-72) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(Float64(4.0 * C) - Float64((B_m ^ 2.0) / A)))) / t_1); elseif (t_3 <= Inf) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / t_1); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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]}, Block[{t$95$1 = (-t$95$0)}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$2), $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$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -2e-213], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, 2e-72], 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$1), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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)\\
t_1 := -t\_0\\
t_2 := \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{if}\;t\_3 \leq -2 \cdot 10^{-213}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-72}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C - \frac{{B\_m}^{2}}{A}\right)}}{t\_1}\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\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))) < -1.9999999999999999e-213Initial program 33.8%
Taylor expanded in F around 0 45.4%
mul-1-neg45.4%
Simplified79.8%
if -1.9999999999999999e-213 < (/.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))) < 1.9999999999999999e-72Initial program 10.3%
Simplified13.3%
Taylor expanded in A around -inf 28.6%
if 1.9999999999999999e-72 < (/.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 35.8%
Simplified53.0%
pow1/253.0%
associate-*r*53.0%
associate-+r+53.0%
hypot-undefine35.8%
unpow235.8%
unpow235.8%
+-commutative35.8%
unpow-prod-down40.8%
*-commutative40.8%
pow1/240.8%
Applied egg-rr74.7%
unpow1/274.7%
associate-*l*74.7%
associate-*r*74.7%
Simplified74.7%
Taylor expanded in A around -inf 41.2%
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 B around inf 18.7%
mul-1-neg18.7%
Simplified18.7%
pow118.7%
sqrt-unprod18.7%
Applied egg-rr18.7%
unpow118.7%
Simplified18.7%
Taylor expanded in F around 0 18.7%
associate-*r/18.7%
*-commutative18.7%
associate-/l*18.7%
Simplified18.7%
*-commutative18.7%
sqrt-prod30.2%
Applied egg-rr30.2%
Final simplification47.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 1.3e-127)
(/
(* (sqrt (* F (* 2.0 (fma B_m B_m (* -4.0 (* A C)))))) (sqrt (* 2.0 C)))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.7e+133)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(* (sqrt (/ 2.0 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 tmp;
if (B_m <= 1.3e-127) {
tmp = (sqrt((F * (2.0 * fma(B_m, B_m, (-4.0 * (A * C)))))) * sqrt((2.0 * C))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 1.7e+133) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 / 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) tmp = 0.0 if (B_m <= 1.3e-127) tmp = Float64(Float64(sqrt(Float64(F * Float64(2.0 * fma(B_m, B_m, Float64(-4.0 * Float64(A * C)))))) * sqrt(Float64(2.0 * C))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 1.7e+133) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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_] := If[LessEqual[B$95$m, 1.3e-127], N[(N[(N[Sqrt[N[(F * N[(2.0 * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $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, 1.7e+133], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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 1.3 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 1.7 \cdot 10^{+133}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 1.29999999999999995e-127Initial program 19.9%
Simplified28.4%
pow1/228.4%
associate-*r*28.4%
associate-+r+27.1%
hypot-undefine20.0%
unpow220.0%
unpow220.0%
+-commutative20.0%
unpow-prod-down24.5%
*-commutative24.5%
pow1/224.5%
Applied egg-rr39.3%
unpow1/239.3%
associate-*l*39.3%
associate-*r*39.3%
Simplified39.3%
Taylor expanded in A around -inf 20.3%
if 1.29999999999999995e-127 < B < 1.69999999999999994e133Initial program 20.2%
Taylor expanded in F around 0 30.3%
mul-1-neg30.3%
Simplified51.5%
if 1.69999999999999994e133 < B Initial program 2.5%
Taylor expanded in B around inf 40.8%
mul-1-neg40.8%
Simplified40.8%
pow140.8%
sqrt-unprod41.0%
Applied egg-rr41.0%
unpow141.0%
Simplified41.0%
Taylor expanded in F around 0 41.0%
associate-*r/41.0%
*-commutative41.0%
associate-/l*41.0%
Simplified41.0%
*-commutative41.0%
sqrt-prod70.4%
Applied egg-rr70.4%
Final simplification34.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 5.8e-127)
(/
(* (sqrt (* F (fma B_m B_m (* -4.0 (* A C))))) (sqrt (* 4.0 C)))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 1.04e+132)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(* (sqrt (/ 2.0 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 tmp;
if (B_m <= 5.8e-127) {
tmp = (sqrt((F * fma(B_m, B_m, (-4.0 * (A * C))))) * sqrt((4.0 * C))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 1.04e+132) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 / 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) tmp = 0.0 if (B_m <= 5.8e-127) tmp = Float64(Float64(sqrt(Float64(F * fma(B_m, B_m, Float64(-4.0 * Float64(A * C))))) * sqrt(Float64(4.0 * C))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 1.04e+132) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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_] := If[LessEqual[B$95$m, 5.8e-127], N[(N[(N[Sqrt[N[(F * N[(B$95$m * B$95$m + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(4.0 * C), $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, 1.04e+132], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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 5.8 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{F \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)} \cdot \sqrt{4 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 1.04 \cdot 10^{+132}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 5.8000000000000001e-127Initial program 19.9%
Simplified28.4%
sqrt-prod39.3%
*-commutative39.3%
hypot-undefine24.8%
unpow224.8%
unpow224.8%
+-commutative24.8%
unpow224.8%
unpow224.8%
hypot-define39.3%
Applied egg-rr39.3%
associate-*r*39.3%
Simplified39.3%
Taylor expanded in A around -inf 20.3%
if 5.8000000000000001e-127 < B < 1.04e132Initial program 20.2%
Taylor expanded in F around 0 30.3%
mul-1-neg30.3%
Simplified51.5%
if 1.04e132 < B Initial program 2.5%
Taylor expanded in B around inf 40.8%
mul-1-neg40.8%
Simplified40.8%
pow140.8%
sqrt-unprod41.0%
Applied egg-rr41.0%
unpow141.0%
Simplified41.0%
Taylor expanded in F around 0 41.0%
associate-*r/41.0%
*-commutative41.0%
associate-/l*41.0%
Simplified41.0%
*-commutative41.0%
sqrt-prod70.4%
Applied egg-rr70.4%
Final simplification34.9%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 5.8e-127)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(if (<= B_m 6.5e+134)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* C (* A -4.0))))))
(- (sqrt 2.0)))
(* (sqrt (/ 2.0 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 (B_m <= 5.8e-127) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else if (B_m <= 6.5e+134) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (C * (A * -4.0)))))) * -sqrt(2.0);
} else {
tmp = sqrt((2.0 / 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 <= 5.8e-127) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); elseif (B_m <= 6.5e+134) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(C * Float64(A * -4.0)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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[B$95$m, 5.8e-127], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 6.5e+134], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(C * N[(A * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 5.8 \cdot 10^{-127}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{+134}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + C \cdot \left(A \cdot -4\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 5.8000000000000001e-127Initial program 19.9%
Simplified28.4%
Taylor expanded in A around -inf 17.3%
if 5.8000000000000001e-127 < B < 6.5e134Initial program 20.2%
Taylor expanded in F around 0 30.3%
mul-1-neg30.3%
Simplified51.5%
if 6.5e134 < B Initial program 2.5%
Taylor expanded in B around inf 40.8%
mul-1-neg40.8%
Simplified40.8%
pow140.8%
sqrt-unprod41.0%
Applied egg-rr41.0%
unpow141.0%
Simplified41.0%
Taylor expanded in F around 0 41.0%
associate-*r/41.0%
*-commutative41.0%
associate-/l*41.0%
Simplified41.0%
*-commutative41.0%
sqrt-prod70.4%
Applied egg-rr70.4%
Final simplification33.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 (<= B_m 2000000000000.0)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(if (<= B_m 6e+164)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot C B_m))))))
(* (sqrt (/ 2.0 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 (B_m <= 2000000000000.0) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else if (B_m <= 6e+164) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(C, B_m))));
} else {
tmp = sqrt((2.0 / 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 <= 2000000000000.0) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); elseif (B_m <= 6e+164) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B_m)))))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-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[B$95$m, 2000000000000.0], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 6e+164], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 2000000000000:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 6 \cdot 10^{+164}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 2e12Initial program 20.3%
Simplified29.2%
Taylor expanded in A around -inf 18.5%
if 2e12 < B < 6.00000000000000001e164Initial program 15.9%
Simplified23.5%
pow1/223.5%
associate-*r*23.5%
associate-+r+23.1%
hypot-undefine16.0%
unpow216.0%
unpow216.0%
+-commutative16.0%
unpow-prod-down20.4%
*-commutative20.4%
pow1/220.4%
Applied egg-rr37.0%
unpow1/237.0%
associate-*l*37.0%
associate-*r*37.0%
Simplified37.0%
Taylor expanded in A around 0 25.0%
associate-*r*25.0%
mul-1-neg25.0%
+-commutative25.0%
unpow225.0%
unpow225.0%
hypot-define39.0%
Simplified39.0%
if 6.00000000000000001e164 < B Initial program 0.0%
Taylor expanded in B around inf 44.1%
mul-1-neg44.1%
Simplified44.1%
pow144.1%
sqrt-unprod44.3%
Applied egg-rr44.3%
unpow144.3%
Simplified44.3%
Taylor expanded in F around 0 44.3%
associate-*r/44.3%
*-commutative44.3%
associate-/l*44.3%
Simplified44.3%
*-commutative44.3%
sqrt-prod81.1%
Applied egg-rr81.1%
Final simplification29.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 4.1e-47)
(/
(sqrt (* -16.0 (* A (* F (pow C 2.0)))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= B_m 1.55e+164)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot C B_m))))))
(* (sqrt (/ 2.0 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 tmp;
if (B_m <= 4.1e-47) {
tmp = sqrt((-16.0 * (A * (F * pow(C, 2.0))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (B_m <= 1.55e+164) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(C, B_m))));
} else {
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.1e-47) {
tmp = Math.sqrt((-16.0 * (A * (F * Math.pow(C, 2.0))))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else if (B_m <= 1.55e+164) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C + Math.hypot(C, B_m))));
} else {
tmp = Math.sqrt((2.0 / B_m)) * -Math.sqrt(F);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 4.1e-47: tmp = math.sqrt((-16.0 * (A * (F * math.pow(C, 2.0))))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) elif B_m <= 1.55e+164: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C + math.hypot(C, B_m)))) else: tmp = math.sqrt((2.0 / B_m)) * -math.sqrt(F) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 4.1e-47) tmp = Float64(sqrt(Float64(-16.0 * Float64(A * Float64(F * (C ^ 2.0))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (B_m <= 1.55e+164) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B_m)))))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-sqrt(F))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 4.1e-47)
tmp = sqrt((-16.0 * (A * (F * (C ^ 2.0))))) / ((4.0 * (A * C)) - (B_m ^ 2.0));
elseif (B_m <= 1.55e+164)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(C, B_m))));
else
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.1e-47], N[(N[Sqrt[N[(-16.0 * N[(A * N[(F * N[Power[C, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.55e+164], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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 4.1 \cdot 10^{-47}:\\
\;\;\;\;\frac{\sqrt{-16 \cdot \left(A \cdot \left(F \cdot {C}^{2}\right)\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 1.55 \cdot 10^{+164}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 4.10000000000000002e-47Initial program 19.7%
Simplified28.8%
Taylor expanded in A around -inf 11.6%
if 4.10000000000000002e-47 < B < 1.5500000000000001e164Initial program 18.6%
Simplified25.8%
pow1/225.8%
associate-*r*25.8%
associate-+r+24.9%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
+-commutative18.6%
unpow-prod-down22.4%
*-commutative22.4%
pow1/222.4%
Applied egg-rr38.8%
unpow1/238.8%
associate-*l*38.8%
associate-*r*38.8%
Simplified38.8%
Taylor expanded in A around 0 25.6%
associate-*r*25.6%
mul-1-neg25.6%
+-commutative25.6%
unpow225.6%
unpow225.6%
hypot-define37.5%
Simplified37.5%
if 1.5500000000000001e164 < B Initial program 0.0%
Taylor expanded in B around inf 44.1%
mul-1-neg44.1%
Simplified44.1%
pow144.1%
sqrt-unprod44.3%
Applied egg-rr44.3%
unpow144.3%
Simplified44.3%
Taylor expanded in F around 0 44.3%
associate-*r/44.3%
*-commutative44.3%
associate-/l*44.3%
Simplified44.3%
*-commutative44.3%
sqrt-prod81.1%
Applied egg-rr81.1%
Final simplification25.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 (<= B_m 7.6e-128)
(/
(sqrt
(*
B_m
(+ (* -8.0 (* A (* C F))) (* -8.0 (/ (* A (* C (* F (+ A C)))) B_m)))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(if (<= B_m 2.8e+163)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* F (+ C (hypot C B_m))))))
(* (sqrt (/ 2.0 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 tmp;
if (B_m <= 7.6e-128) {
tmp = sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else if (B_m <= 2.8e+163) {
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(C, B_m))));
} else {
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 7.6e-128) {
tmp = Math.sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else if (B_m <= 2.8e+163) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((F * (C + Math.hypot(C, B_m))));
} else {
tmp = Math.sqrt((2.0 / B_m)) * -Math.sqrt(F);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 7.6e-128: tmp = math.sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) elif B_m <= 2.8e+163: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((F * (C + math.hypot(C, B_m)))) else: tmp = math.sqrt((2.0 / B_m)) * -math.sqrt(F) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 7.6e-128) tmp = Float64(sqrt(Float64(B_m * Float64(Float64(-8.0 * Float64(A * Float64(C * F))) + Float64(-8.0 * Float64(Float64(A * Float64(C * Float64(F * Float64(A + C)))) / B_m))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); elseif (B_m <= 2.8e+163) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(F * Float64(C + hypot(C, B_m)))))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-sqrt(F))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 7.6e-128)
tmp = sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - (B_m ^ 2.0));
elseif (B_m <= 2.8e+163)
tmp = (sqrt(2.0) / B_m) * -sqrt((F * (C + hypot(C, B_m))));
else
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.6e-128], N[(N[Sqrt[N[(B$95$m * N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-8.0 * N[(N[(A * N[(C * N[(F * N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.8e+163], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(F * N[(C + N[Sqrt[C ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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.6 \cdot 10^{-128}:\\
\;\;\;\;\frac{\sqrt{B\_m \cdot \left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right) + -8 \cdot \frac{A \cdot \left(C \cdot \left(F \cdot \left(A + C\right)\right)\right)}{B\_m}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2.8 \cdot 10^{+163}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(C, B\_m\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if B < 7.6000000000000005e-128Initial program 19.9%
Simplified28.4%
Taylor expanded in A around inf 22.2%
associate-*r*22.2%
Simplified22.2%
Taylor expanded in B around inf 5.0%
if 7.6000000000000005e-128 < B < 2.80000000000000015e163Initial program 18.4%
Simplified27.6%
pow1/227.6%
associate-*r*27.6%
associate-+r+26.6%
hypot-undefine18.5%
unpow218.5%
unpow218.5%
+-commutative18.5%
unpow-prod-down21.4%
*-commutative21.4%
pow1/221.4%
Applied egg-rr37.5%
unpow1/237.5%
associate-*l*37.5%
associate-*r*37.5%
Simplified37.5%
Taylor expanded in A around 0 22.1%
associate-*r*22.1%
mul-1-neg22.1%
+-commutative22.1%
unpow222.1%
unpow222.1%
hypot-define31.6%
Simplified31.6%
if 2.80000000000000015e163 < B Initial program 0.0%
Taylor expanded in B around inf 44.1%
mul-1-neg44.1%
Simplified44.1%
pow144.1%
sqrt-unprod44.3%
Applied egg-rr44.3%
unpow144.3%
Simplified44.3%
Taylor expanded in F around 0 44.3%
associate-*r/44.3%
*-commutative44.3%
associate-/l*44.3%
Simplified44.3%
*-commutative44.3%
sqrt-prod81.1%
Applied egg-rr81.1%
Final simplification20.7%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= F 2.1e-303)
(/
(sqrt
(*
B_m
(+ (* -8.0 (* A (* C F))) (* -8.0 (/ (* A (* C (* F (+ A C)))) B_m)))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(* (sqrt (/ 2.0 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 tmp;
if (F <= 2.1e-303) {
tmp = sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else {
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= 2.1d-303) then
tmp = sqrt((b_m * (((-8.0d0) * (a * (c * f))) + ((-8.0d0) * ((a * (c * (f * (a + c)))) / b_m))))) / ((4.0d0 * (a * c)) - (b_m ** 2.0d0))
else
tmp = sqrt((2.0d0 / b_m)) * -sqrt(f)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= 2.1e-303) {
tmp = Math.sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else {
tmp = Math.sqrt((2.0 / B_m)) * -Math.sqrt(F);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if F <= 2.1e-303: tmp = math.sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) else: tmp = math.sqrt((2.0 / B_m)) * -math.sqrt(F) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (F <= 2.1e-303) tmp = Float64(sqrt(Float64(B_m * Float64(Float64(-8.0 * Float64(A * Float64(C * F))) + Float64(-8.0 * Float64(Float64(A * Float64(C * Float64(F * Float64(A + C)))) / B_m))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); else tmp = Float64(sqrt(Float64(2.0 / B_m)) * Float64(-sqrt(F))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (F <= 2.1e-303)
tmp = sqrt((B_m * ((-8.0 * (A * (C * F))) + (-8.0 * ((A * (C * (F * (A + C)))) / B_m))))) / ((4.0 * (A * C)) - (B_m ^ 2.0));
else
tmp = sqrt((2.0 / B_m)) * -sqrt(F);
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[F, 2.1e-303], N[(N[Sqrt[N[(B$95$m * N[(N[(-8.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-8.0 * N[(N[(A * N[(C * N[(F * N[(A + C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(N[(4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision] - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(2.0 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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 2.1 \cdot 10^{-303}:\\
\;\;\;\;\frac{\sqrt{B\_m \cdot \left(-8 \cdot \left(A \cdot \left(C \cdot F\right)\right) + -8 \cdot \frac{A \cdot \left(C \cdot \left(F \cdot \left(A + C\right)\right)\right)}{B\_m}\right)}}{4 \cdot \left(A \cdot C\right) - {B\_m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{2}{B\_m}} \cdot \left(-\sqrt{F}\right)\\
\end{array}
\end{array}
if F < 2.1e-303Initial program 27.2%
Simplified40.0%
Taylor expanded in A around inf 39.7%
associate-*r*39.7%
Simplified39.7%
Taylor expanded in B around inf 9.7%
if 2.1e-303 < F Initial program 15.0%
Taylor expanded in B around inf 16.1%
mul-1-neg16.1%
Simplified16.1%
pow116.1%
sqrt-unprod16.2%
Applied egg-rr16.2%
unpow116.2%
Simplified16.2%
Taylor expanded in F around 0 16.2%
associate-*r/16.2%
*-commutative16.2%
associate-/l*16.2%
Simplified16.2%
*-commutative16.2%
sqrt-prod21.8%
Applied egg-rr21.8%
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 (<= C 5e+159) (- (sqrt (fabs (* F (/ 2.0 B_m))))) (* -2.0 (* (/ 1.0 B_m) (sqrt (* C F))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 5e+159) {
tmp = -sqrt(fabs((F * (2.0 / B_m))));
} else {
tmp = -2.0 * ((1.0 / B_m) * sqrt((C * F)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 5d+159) then
tmp = -sqrt(abs((f * (2.0d0 / b_m))))
else
tmp = (-2.0d0) * ((1.0d0 / b_m) * sqrt((c * f)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 5e+159) {
tmp = -Math.sqrt(Math.abs((F * (2.0 / B_m))));
} else {
tmp = -2.0 * ((1.0 / B_m) * Math.sqrt((C * F)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 5e+159: tmp = -math.sqrt(math.fabs((F * (2.0 / B_m)))) else: tmp = -2.0 * ((1.0 / B_m) * math.sqrt((C * F))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 5e+159) tmp = Float64(-sqrt(abs(Float64(F * Float64(2.0 / B_m))))); else tmp = Float64(-2.0 * Float64(Float64(1.0 / B_m) * sqrt(Float64(C * F)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 5e+159)
tmp = -sqrt(abs((F * (2.0 / B_m))));
else
tmp = -2.0 * ((1.0 / B_m) * sqrt((C * F)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 5e+159], (-N[Sqrt[N[Abs[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), N[(-2.0 * N[(N[(1.0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 5 \cdot 10^{+159}:\\
\;\;\;\;-\sqrt{\left|F \cdot \frac{2}{B\_m}\right|}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\frac{1}{B\_m} \cdot \sqrt{C \cdot F}\right)\\
\end{array}
\end{array}
if C < 5.00000000000000003e159Initial program 19.5%
Taylor expanded in B around inf 15.2%
mul-1-neg15.2%
Simplified15.2%
pow115.2%
sqrt-unprod15.2%
Applied egg-rr15.2%
unpow115.2%
Simplified15.2%
add-sqr-sqrt15.2%
pow1/215.2%
pow1/215.3%
pow-prod-down15.5%
pow215.5%
*-commutative15.5%
Applied egg-rr15.5%
unpow1/215.5%
unpow215.5%
rem-sqrt-square26.5%
associate-*r/26.5%
*-commutative26.5%
associate-/l*26.5%
Simplified26.5%
if 5.00000000000000003e159 < C Initial program 1.9%
Simplified26.6%
Taylor expanded in B around 0 0.9%
Taylor expanded in A around 0 12.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 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) {
return sqrt((2.0 / B_m)) * -sqrt(F);
}
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 / b_m)) * -sqrt(f)
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 / B_m)) * -Math.sqrt(F);
}
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 / B_m)) * -math.sqrt(F)
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 / B_m)) * Float64(-sqrt(F))) 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 / B_m)) * -sqrt(F);
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 / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $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}{B\_m}} \cdot \left(-\sqrt{F}\right)
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.5%
mul-1-neg13.5%
Simplified13.5%
pow113.5%
sqrt-unprod13.5%
Applied egg-rr13.5%
unpow113.5%
Simplified13.5%
Taylor expanded in F around 0 13.5%
associate-*r/13.5%
*-commutative13.5%
associate-/l*13.5%
Simplified13.5%
*-commutative13.5%
sqrt-prod18.1%
Applied egg-rr18.1%
Final simplification18.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 (<= C 5.5e+159) (- (pow (* 2.0 (/ F B_m)) 0.5)) (* -2.0 (* (/ 1.0 B_m) (sqrt (* C F))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 5.5e+159) {
tmp = -pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = -2.0 * ((1.0 / B_m) * sqrt((C * F)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= 5.5d+159) then
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
else
tmp = (-2.0d0) * ((1.0d0 / b_m) * sqrt((c * f)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= 5.5e+159) {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = -2.0 * ((1.0 / B_m) * Math.sqrt((C * F)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= 5.5e+159: tmp = -math.pow((2.0 * (F / B_m)), 0.5) else: tmp = -2.0 * ((1.0 / B_m) * math.sqrt((C * F))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= 5.5e+159) tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); else tmp = Float64(-2.0 * Float64(Float64(1.0 / B_m) * sqrt(Float64(C * F)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= 5.5e+159)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
else
tmp = -2.0 * ((1.0 / B_m) * sqrt((C * F)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, 5.5e+159], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), N[(-2.0 * N[(N[(1.0 / B$95$m), $MachinePrecision] * N[Sqrt[N[(C * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq 5.5 \cdot 10^{+159}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(\frac{1}{B\_m} \cdot \sqrt{C \cdot F}\right)\\
\end{array}
\end{array}
if C < 5.4999999999999998e159Initial program 19.5%
Taylor expanded in B around inf 15.2%
mul-1-neg15.2%
Simplified15.2%
sqrt-unprod15.2%
pow1/215.3%
Applied egg-rr15.3%
if 5.4999999999999998e159 < C Initial program 1.9%
Simplified26.6%
Taylor expanded in B around 0 0.9%
Taylor expanded in A around 0 12.9%
Final simplification15.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 (- (pow (* 2.0 (/ F B_m)) 0.5)))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -pow((2.0 * (F / B_m)), 0.5);
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -((2.0d0 * (f / b_m)) ** 0.5d0)
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.pow((2.0 * (F / B_m)), 0.5);
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.pow((2.0 * (F / B_m)), 0.5)
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.5%
mul-1-neg13.5%
Simplified13.5%
sqrt-unprod13.5%
pow1/213.6%
Applied egg-rr13.6%
Final simplification13.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 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((2.0 * (F / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((2.0d0 * (f / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((2.0 * (F / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((2.0 * (F / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((2.0 * (F / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{2 \cdot \frac{F}{B\_m}}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.5%
mul-1-neg13.5%
Simplified13.5%
pow113.5%
sqrt-unprod13.5%
Applied egg-rr13.5%
unpow113.5%
Simplified13.5%
Final simplification13.5%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (- (sqrt (* F (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F * (2.0 / B_m)));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f * (2.0d0 / b_m)))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F * (2.0 / B_m)));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F * (2.0 / B_m)))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F * Float64(2.0 / B_m)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F * (2.0 / B_m)));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F * N[(2.0 / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{F \cdot \frac{2}{B\_m}}
\end{array}
Initial program 17.1%
Taylor expanded in B around inf 13.5%
mul-1-neg13.5%
Simplified13.5%
pow113.5%
sqrt-unprod13.5%
Applied egg-rr13.5%
unpow113.5%
Simplified13.5%
Taylor expanded in F around 0 13.5%
associate-*r/13.5%
*-commutative13.5%
associate-/l*13.5%
Simplified13.5%
herbie shell --seed 2024137
(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))))