
(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 17 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 (- t_0 (pow B_m 2.0)))
(t_2 (fma B_m B_m (* A (* C -4.0))))
(t_3 (- (pow B_m 2.0) t_0))
(t_4 (* 2.0 (* t_3 F)))
(t_5
(/
(sqrt (* (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))) t_4))
t_1)))
(if (<= t_5 -5e-201)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(* (sqrt (* 2.0 t_3)) (sqrt F)))
t_1)
(if (<= t_5 4e+56)
(/ (sqrt (* (* F t_2) (- (* 4.0 C) (/ (pow B_m 2.0) A)))) (- t_2))
(if (<= t_5 INFINITY)
(/ -1.0 (/ t_3 (* (sqrt (+ A (+ C (hypot B_m (- A C))))) (sqrt t_4))))
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double t_3 = pow(B_m, 2.0) - t_0;
double t_4 = 2.0 * (t_3 * F);
double t_5 = sqrt((((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))) * t_4)) / t_1;
double tmp;
if (t_5 <= -5e-201) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * (sqrt((2.0 * t_3)) * sqrt(F))) / t_1;
} else if (t_5 <= 4e+56) {
tmp = sqrt(((F * t_2) * ((4.0 * C) - (pow(B_m, 2.0) / A)))) / -t_2;
} else if (t_5 <= ((double) INFINITY)) {
tmp = -1.0 / (t_3 / (sqrt((A + (C + hypot(B_m, (A - C))))) * sqrt(t_4)));
} else {
tmp = sqrt(F) * -sqrt((2.0 / B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_3 = Float64((B_m ^ 2.0) - t_0) t_4 = Float64(2.0 * Float64(t_3 * F)) t_5 = Float64(sqrt(Float64(Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))) * t_4)) / t_1) tmp = 0.0 if (t_5 <= -5e-201) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * Float64(sqrt(Float64(2.0 * t_3)) * sqrt(F))) / t_1); elseif (t_5 <= 4e+56) tmp = Float64(sqrt(Float64(Float64(F * t_2) * Float64(Float64(4.0 * C) - Float64((B_m ^ 2.0) / A)))) / Float64(-t_2)); elseif (t_5 <= Inf) tmp = Float64(-1.0 / Float64(t_3 / Float64(sqrt(Float64(A + Float64(C + hypot(B_m, Float64(A - C))))) * sqrt(t_4)))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$4 = N[(2.0 * N[(t$95$3 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[Sqrt[N[(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] * t$95$4), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$5, -5e-201], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(2.0 * t$95$3), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$5, 4e+56], 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$5, Infinity], N[(-1.0 / N[(t$95$3 / N[(N[Sqrt[N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$4], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_3 := {B\_m}^{2} - t\_0\\
t_4 := 2 \cdot \left(t\_3 \cdot F\right)\\
t_5 := \frac{\sqrt{\left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right) \cdot t\_4}}{t\_1}\\
\mathbf{if}\;t\_5 \leq -5 \cdot 10^{-201}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot \left(\sqrt{2 \cdot t\_3} \cdot \sqrt{F}\right)}{t\_1}\\
\mathbf{elif}\;t\_5 \leq 4 \cdot 10^{+56}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_2\right) \cdot \left(4 \cdot C - \frac{{B\_m}^{2}}{A}\right)}}{-t\_2}\\
\mathbf{elif}\;t\_5 \leq \infty:\\
\;\;\;\;\frac{-1}{\frac{t\_3}{\sqrt{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)} \cdot \sqrt{t\_4}}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\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))) < -4.9999999999999999e-201Initial program 44.2%
pow1/244.2%
*-commutative44.2%
unpow-prod-down52.9%
pow1/252.9%
associate-+l+52.9%
unpow252.9%
unpow252.9%
hypot-define66.2%
pow1/266.2%
Applied egg-rr66.2%
pow1/266.2%
associate-*r*66.2%
*-commutative66.2%
*-commutative66.2%
unpow-prod-down76.8%
*-commutative76.8%
*-commutative76.8%
pow1/276.8%
Applied egg-rr76.8%
unpow1/276.8%
Simplified76.8%
if -4.9999999999999999e-201 < (/.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))) < 4.00000000000000037e56Initial program 15.2%
Simplified17.7%
Taylor expanded in A around -inf 42.6%
if 4.00000000000000037e56 < (/.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 38.3%
pow1/238.3%
*-commutative38.3%
unpow-prod-down45.4%
pow1/245.4%
associate-+l+45.4%
unpow245.4%
unpow245.4%
hypot-define82.1%
pow1/282.1%
Applied egg-rr82.1%
pow1/282.1%
*-commutative82.1%
*-commutative82.1%
*-commutative82.1%
unpow-prod-down81.9%
pow1/281.9%
*-commutative81.9%
*-commutative81.9%
*-commutative81.9%
pow1/281.9%
Applied egg-rr81.9%
clear-num82.1%
inv-pow82.1%
Applied egg-rr82.3%
unpow-182.3%
hypot-undefine45.5%
unpow245.5%
unpow245.5%
+-commutative45.5%
unpow245.5%
unpow245.5%
hypot-undefine82.3%
associate-+l+82.3%
Simplified82.3%
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 14.2%
mul-1-neg14.2%
Simplified14.2%
pow114.2%
sqrt-unprod14.4%
Applied egg-rr14.4%
unpow114.4%
Simplified14.4%
associate-*l/14.4%
Applied egg-rr14.4%
associate-/l*14.3%
Simplified14.3%
pow1/214.4%
*-commutative14.4%
unpow-prod-down17.8%
pow1/217.8%
pow1/217.8%
Applied egg-rr17.8%
Final simplification48.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
(let* ((t_0 (* (* 4.0 A) C))
(t_1 (- (pow B_m 2.0) t_0))
(t_2 (- t_0 (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 2e-224)
(/
(*
(sqrt (+ (* (/ (pow B_m 2.0) A) -0.5) (* 2.0 C)))
(sqrt (* 2.0 (* t_1 F))))
t_2)
(if (<= (pow B_m 2.0) 2e-67)
(* (pow (* (* 2.0 C) (* F (* 2.0 t_1))) 0.5) (/ -1.0 t_1))
(if (<= (pow B_m 2.0) 2e+71)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(sqrt (* 2.0 (* C (+ (* -4.0 (* A F)) (/ (* (pow B_m 2.0) F) C))))))
t_2)
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = pow(B_m, 2.0) - t_0;
double t_2 = t_0 - pow(B_m, 2.0);
double tmp;
if (pow(B_m, 2.0) <= 2e-224) {
tmp = (sqrt((((pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * sqrt((2.0 * (t_1 * F)))) / t_2;
} else if (pow(B_m, 2.0) <= 2e-67) {
tmp = pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else if (pow(B_m, 2.0) <= 2e+71) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * sqrt((2.0 * (C * ((-4.0 * (A * F)) + ((pow(B_m, 2.0) * F) / C)))))) / t_2;
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = (4.0 * A) * C;
double t_1 = Math.pow(B_m, 2.0) - t_0;
double t_2 = t_0 - Math.pow(B_m, 2.0);
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-224) {
tmp = (Math.sqrt((((Math.pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * Math.sqrt((2.0 * (t_1 * F)))) / t_2;
} else if (Math.pow(B_m, 2.0) <= 2e-67) {
tmp = Math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else if (Math.pow(B_m, 2.0) <= 2e+71) {
tmp = (Math.sqrt((A + (C + Math.hypot((A - C), B_m)))) * Math.sqrt((2.0 * (C * ((-4.0 * (A * F)) + ((Math.pow(B_m, 2.0) * F) / C)))))) / t_2;
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C t_1 = math.pow(B_m, 2.0) - t_0 t_2 = t_0 - math.pow(B_m, 2.0) tmp = 0 if math.pow(B_m, 2.0) <= 2e-224: tmp = (math.sqrt((((math.pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * math.sqrt((2.0 * (t_1 * F)))) / t_2 elif math.pow(B_m, 2.0) <= 2e-67: tmp = math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1) elif math.pow(B_m, 2.0) <= 2e+71: tmp = (math.sqrt((A + (C + math.hypot((A - C), B_m)))) * math.sqrt((2.0 * (C * ((-4.0 * (A * F)) + ((math.pow(B_m, 2.0) * F) / C)))))) / t_2 else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64((B_m ^ 2.0) - t_0) t_2 = Float64(t_0 - (B_m ^ 2.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-224) tmp = Float64(Float64(sqrt(Float64(Float64(Float64((B_m ^ 2.0) / A) * -0.5) + Float64(2.0 * C))) * sqrt(Float64(2.0 * Float64(t_1 * F)))) / t_2); elseif ((B_m ^ 2.0) <= 2e-67) tmp = Float64((Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_1))) ^ 0.5) * Float64(-1.0 / t_1)); elseif ((B_m ^ 2.0) <= 2e+71) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * sqrt(Float64(2.0 * Float64(C * Float64(Float64(-4.0 * Float64(A * F)) + Float64(Float64((B_m ^ 2.0) * F) / C)))))) / t_2); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
t_1 = (B_m ^ 2.0) - t_0;
t_2 = t_0 - (B_m ^ 2.0);
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-224)
tmp = (sqrt(((((B_m ^ 2.0) / A) * -0.5) + (2.0 * C))) * sqrt((2.0 * (t_1 * F)))) / t_2;
elseif ((B_m ^ 2.0) <= 2e-67)
tmp = (((2.0 * C) * (F * (2.0 * t_1))) ^ 0.5) * (-1.0 / t_1);
elseif ((B_m ^ 2.0) <= 2e+71)
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * sqrt((2.0 * (C * ((-4.0 * (A * F)) + (((B_m ^ 2.0) * F) / C)))))) / t_2;
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-224], N[(N[(N[Sqrt[N[(N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-67], N[(N[Power[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+71], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(C * N[(N[(-4.0 * N[(A * F), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] * F), $MachinePrecision] / C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := {B\_m}^{2} - t\_0\\
t_2 := t\_0 - {B\_m}^{2}\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{\frac{{B\_m}^{2}}{A} \cdot -0.5 + 2 \cdot C} \cdot \sqrt{2 \cdot \left(t\_1 \cdot F\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-67}:\\
\;\;\;\;{\left(\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_1\right)\right)\right)}^{0.5} \cdot \frac{-1}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+71}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot \sqrt{2 \cdot \left(C \cdot \left(-4 \cdot \left(A \cdot F\right) + \frac{{B\_m}^{2} \cdot F}{C}\right)\right)}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2e-224Initial program 22.1%
pow1/222.1%
*-commutative22.1%
unpow-prod-down25.9%
pow1/225.9%
associate-+l+26.0%
unpow226.0%
unpow226.0%
hypot-define39.1%
pow1/239.1%
Applied egg-rr39.1%
Taylor expanded in A around -inf 26.7%
if 2e-224 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e-67Initial program 23.2%
pow1/223.7%
*-commutative23.7%
unpow-prod-down25.0%
pow1/225.0%
associate-+l+25.7%
unpow225.7%
unpow225.7%
hypot-define36.8%
pow1/236.8%
Applied egg-rr36.8%
pow1/236.8%
*-commutative36.8%
*-commutative36.8%
*-commutative36.8%
unpow-prod-down36.7%
pow1/236.7%
*-commutative36.7%
*-commutative36.7%
*-commutative36.7%
pow1/236.7%
Applied egg-rr36.7%
Taylor expanded in A around -inf 21.4%
div-inv21.4%
sqrt-prod21.6%
*-commutative21.6%
pow1/221.6%
pow1/221.6%
pow-prod-down30.3%
associate-*l*30.3%
Applied egg-rr30.3%
if 1.99999999999999989e-67 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e71Initial program 33.7%
pow1/234.0%
*-commutative34.0%
unpow-prod-down39.6%
pow1/239.6%
associate-+l+39.6%
unpow239.6%
unpow239.6%
hypot-define48.7%
pow1/248.7%
Applied egg-rr48.7%
Taylor expanded in C around inf 42.6%
if 2.0000000000000001e71 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.4%
Taylor expanded in B around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
pow124.1%
sqrt-unprod24.4%
Applied egg-rr24.4%
unpow124.4%
Simplified24.4%
associate-*l/24.4%
Applied egg-rr24.4%
associate-/l*24.2%
Simplified24.2%
pow1/224.2%
*-commutative24.2%
unpow-prod-down31.6%
pow1/231.6%
pow1/231.6%
Applied egg-rr31.6%
Final simplification31.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 (- (pow B_m 2.0) t_0))
(t_2 (sqrt (* 2.0 (* t_1 F))))
(t_3 (- t_0 (pow B_m 2.0))))
(if (<= (pow B_m 2.0) 2e-224)
(/ (* (sqrt (+ (* (/ (pow B_m 2.0) A) -0.5) (* 2.0 C))) t_2) t_3)
(if (<= (pow B_m 2.0) 2e-67)
(* (pow (* (* 2.0 C) (* F (* 2.0 t_1))) 0.5) (/ -1.0 t_1))
(if (<= (pow B_m 2.0) 2e+71)
(/ (* (sqrt (+ A (+ C (hypot (- A C) B_m)))) t_2) t_3)
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = pow(B_m, 2.0) - t_0;
double t_2 = sqrt((2.0 * (t_1 * F)));
double t_3 = t_0 - pow(B_m, 2.0);
double tmp;
if (pow(B_m, 2.0) <= 2e-224) {
tmp = (sqrt((((pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * t_2) / t_3;
} else if (pow(B_m, 2.0) <= 2e-67) {
tmp = pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else if (pow(B_m, 2.0) <= 2e+71) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * t_2) / t_3;
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = (4.0 * A) * C;
double t_1 = Math.pow(B_m, 2.0) - t_0;
double t_2 = Math.sqrt((2.0 * (t_1 * F)));
double t_3 = t_0 - Math.pow(B_m, 2.0);
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-224) {
tmp = (Math.sqrt((((Math.pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * t_2) / t_3;
} else if (Math.pow(B_m, 2.0) <= 2e-67) {
tmp = Math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else if (Math.pow(B_m, 2.0) <= 2e+71) {
tmp = (Math.sqrt((A + (C + Math.hypot((A - C), B_m)))) * t_2) / t_3;
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C t_1 = math.pow(B_m, 2.0) - t_0 t_2 = math.sqrt((2.0 * (t_1 * F))) t_3 = t_0 - math.pow(B_m, 2.0) tmp = 0 if math.pow(B_m, 2.0) <= 2e-224: tmp = (math.sqrt((((math.pow(B_m, 2.0) / A) * -0.5) + (2.0 * C))) * t_2) / t_3 elif math.pow(B_m, 2.0) <= 2e-67: tmp = math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1) elif math.pow(B_m, 2.0) <= 2e+71: tmp = (math.sqrt((A + (C + math.hypot((A - C), B_m)))) * t_2) / t_3 else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64((B_m ^ 2.0) - t_0) t_2 = sqrt(Float64(2.0 * Float64(t_1 * F))) t_3 = Float64(t_0 - (B_m ^ 2.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-224) tmp = Float64(Float64(sqrt(Float64(Float64(Float64((B_m ^ 2.0) / A) * -0.5) + Float64(2.0 * C))) * t_2) / t_3); elseif ((B_m ^ 2.0) <= 2e-67) tmp = Float64((Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_1))) ^ 0.5) * Float64(-1.0 / t_1)); elseif ((B_m ^ 2.0) <= 2e+71) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * t_2) / t_3); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
t_1 = (B_m ^ 2.0) - t_0;
t_2 = sqrt((2.0 * (t_1 * F)));
t_3 = t_0 - (B_m ^ 2.0);
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-224)
tmp = (sqrt(((((B_m ^ 2.0) / A) * -0.5) + (2.0 * C))) * t_2) / t_3;
elseif ((B_m ^ 2.0) <= 2e-67)
tmp = (((2.0 * C) * (F * (2.0 * t_1))) ^ 0.5) * (-1.0 / t_1);
elseif ((B_m ^ 2.0) <= 2e+71)
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * t_2) / t_3;
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-224], N[(N[(N[Sqrt[N[(N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision] * -0.5), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-67], N[(N[Power[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+71], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision] / t$95$3), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := {B\_m}^{2} - t\_0\\
t_2 := \sqrt{2 \cdot \left(t\_1 \cdot F\right)}\\
t_3 := t\_0 - {B\_m}^{2}\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-224}:\\
\;\;\;\;\frac{\sqrt{\frac{{B\_m}^{2}}{A} \cdot -0.5 + 2 \cdot C} \cdot t\_2}{t\_3}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-67}:\\
\;\;\;\;{\left(\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_1\right)\right)\right)}^{0.5} \cdot \frac{-1}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+71}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot t\_2}{t\_3}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 2e-224Initial program 22.1%
pow1/222.1%
*-commutative22.1%
unpow-prod-down25.9%
pow1/225.9%
associate-+l+26.0%
unpow226.0%
unpow226.0%
hypot-define39.1%
pow1/239.1%
Applied egg-rr39.1%
Taylor expanded in A around -inf 26.7%
if 2e-224 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e-67Initial program 23.2%
pow1/223.7%
*-commutative23.7%
unpow-prod-down25.0%
pow1/225.0%
associate-+l+25.7%
unpow225.7%
unpow225.7%
hypot-define36.8%
pow1/236.8%
Applied egg-rr36.8%
pow1/236.8%
*-commutative36.8%
*-commutative36.8%
*-commutative36.8%
unpow-prod-down36.7%
pow1/236.7%
*-commutative36.7%
*-commutative36.7%
*-commutative36.7%
pow1/236.7%
Applied egg-rr36.7%
Taylor expanded in A around -inf 21.4%
div-inv21.4%
sqrt-prod21.6%
*-commutative21.6%
pow1/221.6%
pow1/221.6%
pow-prod-down30.3%
associate-*l*30.3%
Applied egg-rr30.3%
if 1.99999999999999989e-67 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e71Initial program 33.7%
pow1/234.0%
*-commutative34.0%
unpow-prod-down39.6%
pow1/239.6%
associate-+l+39.6%
unpow239.6%
unpow239.6%
hypot-define48.7%
pow1/248.7%
Applied egg-rr48.7%
if 2.0000000000000001e71 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.4%
Taylor expanded in B around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
pow124.1%
sqrt-unprod24.4%
Applied egg-rr24.4%
unpow124.4%
Simplified24.4%
associate-*l/24.4%
Applied egg-rr24.4%
associate-/l*24.2%
Simplified24.2%
pow1/224.2%
*-commutative24.2%
unpow-prod-down31.6%
pow1/231.6%
pow1/231.6%
Applied egg-rr31.6%
Final simplification31.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 (* (* 4.0 A) C))
(t_1 (- t_0 (pow B_m 2.0)))
(t_2 (- (pow B_m 2.0) t_0))
(t_3 (sqrt (* 2.0 (* t_2 F)))))
(if (<= (pow B_m 2.0) 2e-225)
(/ (* t_3 (sqrt (* 2.0 C))) t_1)
(if (<= (pow B_m 2.0) 2e-67)
(* (pow (* (* 2.0 C) (* F (* 2.0 t_2))) 0.5) (/ -1.0 t_2))
(if (<= (pow B_m 2.0) 2e+71)
(/ (* (sqrt (+ A (+ C (hypot (- A C) B_m)))) t_3) t_1)
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = t_0 - pow(B_m, 2.0);
double t_2 = pow(B_m, 2.0) - t_0;
double t_3 = sqrt((2.0 * (t_2 * F)));
double tmp;
if (pow(B_m, 2.0) <= 2e-225) {
tmp = (t_3 * sqrt((2.0 * C))) / t_1;
} else if (pow(B_m, 2.0) <= 2e-67) {
tmp = pow(((2.0 * C) * (F * (2.0 * t_2))), 0.5) * (-1.0 / t_2);
} else if (pow(B_m, 2.0) <= 2e+71) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * t_3) / t_1;
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = (4.0 * A) * C;
double t_1 = t_0 - Math.pow(B_m, 2.0);
double t_2 = Math.pow(B_m, 2.0) - t_0;
double t_3 = Math.sqrt((2.0 * (t_2 * F)));
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-225) {
tmp = (t_3 * Math.sqrt((2.0 * C))) / t_1;
} else if (Math.pow(B_m, 2.0) <= 2e-67) {
tmp = Math.pow(((2.0 * C) * (F * (2.0 * t_2))), 0.5) * (-1.0 / t_2);
} else if (Math.pow(B_m, 2.0) <= 2e+71) {
tmp = (Math.sqrt((A + (C + Math.hypot((A - C), B_m)))) * t_3) / t_1;
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C t_1 = t_0 - math.pow(B_m, 2.0) t_2 = math.pow(B_m, 2.0) - t_0 t_3 = math.sqrt((2.0 * (t_2 * F))) tmp = 0 if math.pow(B_m, 2.0) <= 2e-225: tmp = (t_3 * math.sqrt((2.0 * C))) / t_1 elif math.pow(B_m, 2.0) <= 2e-67: tmp = math.pow(((2.0 * C) * (F * (2.0 * t_2))), 0.5) * (-1.0 / t_2) elif math.pow(B_m, 2.0) <= 2e+71: tmp = (math.sqrt((A + (C + math.hypot((A - C), B_m)))) * t_3) / t_1 else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64(t_0 - (B_m ^ 2.0)) t_2 = Float64((B_m ^ 2.0) - t_0) t_3 = sqrt(Float64(2.0 * Float64(t_2 * F))) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-225) tmp = Float64(Float64(t_3 * sqrt(Float64(2.0 * C))) / t_1); elseif ((B_m ^ 2.0) <= 2e-67) tmp = Float64((Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_2))) ^ 0.5) * Float64(-1.0 / t_2)); elseif ((B_m ^ 2.0) <= 2e+71) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * t_3) / t_1); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
t_1 = t_0 - (B_m ^ 2.0);
t_2 = (B_m ^ 2.0) - t_0;
t_3 = sqrt((2.0 * (t_2 * F)));
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-225)
tmp = (t_3 * sqrt((2.0 * C))) / t_1;
elseif ((B_m ^ 2.0) <= 2e-67)
tmp = (((2.0 * C) * (F * (2.0 * t_2))) ^ 0.5) * (-1.0 / t_2);
elseif ((B_m ^ 2.0) <= 2e+71)
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * t_3) / t_1;
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[Sqrt[N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-225], N[(N[(t$95$3 * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-67], N[(N[Power[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+71], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$3), $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := {B\_m}^{2} - t\_0\\
t_3 := \sqrt{2 \cdot \left(t\_2 \cdot F\right)}\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-225}:\\
\;\;\;\;\frac{t\_3 \cdot \sqrt{2 \cdot C}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-67}:\\
\;\;\;\;{\left(\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_2\right)\right)\right)}^{0.5} \cdot \frac{-1}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+71}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot t\_3}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-225Initial program 21.2%
pow1/221.2%
*-commutative21.2%
unpow-prod-down25.0%
pow1/225.0%
associate-+l+25.2%
unpow225.2%
unpow225.2%
hypot-define38.4%
pow1/238.4%
Applied egg-rr38.4%
Taylor expanded in A around -inf 26.0%
if 1.9999999999999999e-225 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e-67Initial program 24.8%
pow1/225.3%
*-commutative25.3%
unpow-prod-down26.6%
pow1/226.6%
associate-+l+27.3%
unpow227.3%
unpow227.3%
hypot-define38.1%
pow1/238.1%
Applied egg-rr38.1%
pow1/238.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
unpow-prod-down38.0%
pow1/238.0%
*-commutative38.0%
*-commutative38.0%
*-commutative38.0%
pow1/238.0%
Applied egg-rr38.0%
Taylor expanded in A around -inf 21.0%
div-inv21.0%
sqrt-prod21.1%
*-commutative21.1%
pow1/221.1%
pow1/221.1%
pow-prod-down29.7%
associate-*l*29.7%
Applied egg-rr29.7%
if 1.99999999999999989e-67 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e71Initial program 33.7%
pow1/234.0%
*-commutative34.0%
unpow-prod-down39.6%
pow1/239.6%
associate-+l+39.6%
unpow239.6%
unpow239.6%
hypot-define48.7%
pow1/248.7%
Applied egg-rr48.7%
if 2.0000000000000001e71 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.4%
Taylor expanded in B around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
pow124.1%
sqrt-unprod24.4%
Applied egg-rr24.4%
unpow124.4%
Simplified24.4%
associate-*l/24.4%
Applied egg-rr24.4%
associate-/l*24.2%
Simplified24.2%
pow1/224.2%
*-commutative24.2%
unpow-prod-down31.6%
pow1/231.6%
pow1/231.6%
Applied egg-rr31.6%
Final simplification31.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
(let* ((t_0 (* (* 4.0 A) C)) (t_1 (- (pow B_m 2.0) t_0)))
(if (<= (pow B_m 2.0) 2e-225)
(/ (* (sqrt (* 2.0 (* t_1 F))) (sqrt (* 2.0 C))) (- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 2e-67)
(* (pow (* (* 2.0 C) (* F (* 2.0 t_1))) 0.5) (/ -1.0 t_1))
(if (<= (pow B_m 2.0) 2e+71)
(/
(*
(sqrt (+ A (+ C (hypot (- A C) B_m))))
(sqrt (* F (* 2.0 (fma B_m B_m (* -4.0 (* A C)))))))
(- (fma B_m B_m (* A (* C -4.0)))))
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = pow(B_m, 2.0) - t_0;
double tmp;
if (pow(B_m, 2.0) <= 2e-225) {
tmp = (sqrt((2.0 * (t_1 * F))) * sqrt((2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 2e-67) {
tmp = pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else if (pow(B_m, 2.0) <= 2e+71) {
tmp = (sqrt((A + (C + hypot((A - C), B_m)))) * sqrt((F * (2.0 * fma(B_m, B_m, (-4.0 * (A * C))))))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = sqrt(F) * -sqrt((2.0 / B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64((B_m ^ 2.0) - t_0) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-225) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(t_1 * F))) * sqrt(Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 2e-67) tmp = Float64((Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_1))) ^ 0.5) * Float64(-1.0 / t_1)); elseif ((B_m ^ 2.0) <= 2e+71) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m)))) * sqrt(Float64(F * Float64(2.0 * fma(B_m, B_m, Float64(-4.0 * Float64(A * C))))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-225], N[(N[(N[Sqrt[N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-67], N[(N[Power[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+71], N[(N[(N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 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]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := {B\_m}^{2} - t\_0\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-225}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(t\_1 \cdot F\right)} \cdot \sqrt{2 \cdot C}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-67}:\\
\;\;\;\;{\left(\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_1\right)\right)\right)}^{0.5} \cdot \frac{-1}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+71}:\\
\;\;\;\;\frac{\sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)} \cdot \sqrt{F \cdot \left(2 \cdot \mathsf{fma}\left(B\_m, B\_m, -4 \cdot \left(A \cdot C\right)\right)\right)}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-225Initial program 21.2%
pow1/221.2%
*-commutative21.2%
unpow-prod-down25.0%
pow1/225.0%
associate-+l+25.2%
unpow225.2%
unpow225.2%
hypot-define38.4%
pow1/238.4%
Applied egg-rr38.4%
Taylor expanded in A around -inf 26.0%
if 1.9999999999999999e-225 < (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e-67Initial program 24.8%
pow1/225.3%
*-commutative25.3%
unpow-prod-down26.6%
pow1/226.6%
associate-+l+27.3%
unpow227.3%
unpow227.3%
hypot-define38.1%
pow1/238.1%
Applied egg-rr38.1%
pow1/238.1%
*-commutative38.1%
*-commutative38.1%
*-commutative38.1%
unpow-prod-down38.0%
pow1/238.0%
*-commutative38.0%
*-commutative38.0%
*-commutative38.0%
pow1/238.0%
Applied egg-rr38.0%
Taylor expanded in A around -inf 21.0%
div-inv21.0%
sqrt-prod21.1%
*-commutative21.1%
pow1/221.1%
pow1/221.1%
pow-prod-down29.7%
associate-*l*29.7%
Applied egg-rr29.7%
if 1.99999999999999989e-67 < (pow.f64 B #s(literal 2 binary64)) < 2.0000000000000001e71Initial program 33.7%
Simplified34.4%
pow1/234.4%
associate-*r*34.4%
associate-+r+34.0%
hypot-undefine34.1%
unpow234.1%
unpow234.1%
+-commutative34.1%
unpow-prod-down39.7%
*-commutative39.7%
pow1/239.7%
Applied egg-rr51.8%
unpow1/251.8%
associate-*l*51.8%
associate-*r*51.8%
Simplified51.8%
if 2.0000000000000001e71 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.4%
Taylor expanded in B around inf 24.1%
mul-1-neg24.1%
Simplified24.1%
pow124.1%
sqrt-unprod24.4%
Applied egg-rr24.4%
unpow124.4%
Simplified24.4%
associate-*l/24.4%
Applied egg-rr24.4%
associate-/l*24.2%
Simplified24.2%
pow1/224.2%
*-commutative24.2%
unpow-prod-down31.6%
pow1/231.6%
pow1/231.6%
Applied egg-rr31.6%
Final simplification31.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 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= (pow B_m 2.0) 1e+25)
(/ -1.0 (/ t_0 (* (sqrt (* 2.0 (* t_0 F))) (sqrt (* 2.0 C)))))
(if (<= (pow B_m 2.0) 1e+137)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* -4.0 (* A C))))))
(- (sqrt 2.0)))
(* (sqrt F) (- (sqrt (/ 2.0 B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B_m, 2.0) <= 1e+25) {
tmp = -1.0 / (t_0 / (sqrt((2.0 * (t_0 * F))) * sqrt((2.0 * C))));
} else if (pow(B_m, 2.0) <= 1e+137) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (Math.pow(B_m, 2.0) <= 1e+25) {
tmp = -1.0 / (t_0 / (Math.sqrt((2.0 * (t_0 * F))) * Math.sqrt((2.0 * C))));
} else if (Math.pow(B_m, 2.0) <= 1e+137) {
tmp = Math.sqrt((F * ((A + (C + Math.hypot(B_m, (A - C)))) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C) tmp = 0 if math.pow(B_m, 2.0) <= 1e+25: tmp = -1.0 / (t_0 / (math.sqrt((2.0 * (t_0 * F))) * math.sqrt((2.0 * C)))) elif math.pow(B_m, 2.0) <= 1e+137: tmp = math.sqrt((F * ((A + (C + math.hypot(B_m, (A - C)))) / (math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -math.sqrt(2.0) else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+25) tmp = Float64(-1.0 / Float64(t_0 / Float64(sqrt(Float64(2.0 * Float64(t_0 * F))) * sqrt(Float64(2.0 * C))))); elseif ((B_m ^ 2.0) <= 1e+137) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (B_m ^ 2.0) - ((4.0 * A) * C);
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e+25)
tmp = -1.0 / (t_0 / (sqrt((2.0 * (t_0 * F))) * sqrt((2.0 * C))));
elseif ((B_m ^ 2.0) <= 1e+137)
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / ((B_m ^ 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+25], N[(-1.0 / N[(t$95$0 / N[(N[Sqrt[N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+137], 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{+25}:\\
\;\;\;\;\frac{-1}{\frac{t\_0}{\sqrt{2 \cdot \left(t\_0 \cdot F\right)} \cdot \sqrt{2 \cdot C}}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+137}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000009e25Initial program 24.7%
pow1/224.9%
*-commutative24.9%
unpow-prod-down28.7%
pow1/228.7%
associate-+l+29.0%
unpow229.0%
unpow229.0%
hypot-define41.3%
pow1/241.3%
Applied egg-rr41.3%
pow1/241.3%
*-commutative41.3%
*-commutative41.3%
*-commutative41.3%
unpow-prod-down41.2%
pow1/241.2%
*-commutative41.2%
*-commutative41.2%
*-commutative41.2%
pow1/241.2%
Applied egg-rr41.2%
clear-num41.2%
inv-pow41.2%
Applied egg-rr40.6%
unpow-140.6%
hypot-undefine28.6%
unpow228.6%
unpow228.6%
+-commutative28.6%
unpow228.6%
unpow228.6%
hypot-undefine40.6%
associate-+l+41.3%
Simplified41.3%
Taylor expanded in A around -inf 25.0%
if 1.00000000000000009e25 < (pow.f64 B #s(literal 2 binary64)) < 1e137Initial program 26.6%
Taylor expanded in F around 0 30.4%
mul-1-neg30.4%
Simplified43.8%
if 1e137 < (pow.f64 B #s(literal 2 binary64)) Initial program 13.4%
Taylor expanded in B around inf 24.5%
mul-1-neg24.5%
Simplified24.5%
pow124.5%
sqrt-unprod24.8%
Applied egg-rr24.8%
unpow124.8%
Simplified24.8%
associate-*l/24.8%
Applied egg-rr24.8%
associate-/l*24.7%
Simplified24.7%
pow1/224.7%
*-commutative24.7%
unpow-prod-down33.0%
pow1/233.0%
pow1/233.0%
Applied egg-rr33.0%
Final simplification29.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 (* (* 4.0 A) C)))
(if (<= (pow B_m 2.0) 1e+25)
(/
(* (sqrt (* 2.0 (* (- (pow B_m 2.0) t_0) F))) (sqrt (* 2.0 C)))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 1e+137)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* -4.0 (* A C))))))
(- (sqrt 2.0)))
(* (sqrt F) (- (sqrt (/ 2.0 B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (pow(B_m, 2.0) <= 1e+25) {
tmp = (sqrt((2.0 * ((pow(B_m, 2.0) - t_0) * F))) * sqrt((2.0 * C))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 1e+137) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = (4.0 * A) * C;
double tmp;
if (Math.pow(B_m, 2.0) <= 1e+25) {
tmp = (Math.sqrt((2.0 * ((Math.pow(B_m, 2.0) - t_0) * F))) * Math.sqrt((2.0 * C))) / (t_0 - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 1e+137) {
tmp = Math.sqrt((F * ((A + (C + Math.hypot(B_m, (A - C)))) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C tmp = 0 if math.pow(B_m, 2.0) <= 1e+25: tmp = (math.sqrt((2.0 * ((math.pow(B_m, 2.0) - t_0) * F))) * math.sqrt((2.0 * C))) / (t_0 - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 1e+137: tmp = math.sqrt((F * ((A + (C + math.hypot(B_m, (A - C)))) / (math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -math.sqrt(2.0) else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+25) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F))) * sqrt(Float64(2.0 * C))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 1e+137) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e+25)
tmp = (sqrt((2.0 * (((B_m ^ 2.0) - t_0) * F))) * sqrt((2.0 * C))) / (t_0 - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 1e+137)
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / ((B_m ^ 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+25], N[(N[(N[Sqrt[N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+137], 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{+25}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)} \cdot \sqrt{2 \cdot C}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+137}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000009e25Initial program 24.7%
pow1/224.9%
*-commutative24.9%
unpow-prod-down28.7%
pow1/228.7%
associate-+l+29.0%
unpow229.0%
unpow229.0%
hypot-define41.3%
pow1/241.3%
Applied egg-rr41.3%
Taylor expanded in A around -inf 25.0%
if 1.00000000000000009e25 < (pow.f64 B #s(literal 2 binary64)) < 1e137Initial program 26.6%
Taylor expanded in F around 0 30.4%
mul-1-neg30.4%
Simplified43.8%
if 1e137 < (pow.f64 B #s(literal 2 binary64)) Initial program 13.4%
Taylor expanded in B around inf 24.5%
mul-1-neg24.5%
Simplified24.5%
pow124.5%
sqrt-unprod24.8%
Applied egg-rr24.8%
unpow124.8%
Simplified24.8%
associate-*l/24.8%
Applied egg-rr24.8%
associate-/l*24.7%
Simplified24.7%
pow1/224.7%
*-commutative24.7%
unpow-prod-down33.0%
pow1/233.0%
pow1/233.0%
Applied egg-rr33.0%
Final simplification29.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 (* (* 4.0 A) C)))
(if (<= (pow B_m 2.0) 2e-67)
(/
(sqrt (* F (* (* 2.0 C) (* 2.0 (- (pow B_m 2.0) t_0)))))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 1e+137)
(*
(sqrt
(*
F
(/
(+ A (+ C (hypot B_m (- A C))))
(+ (pow B_m 2.0) (* -4.0 (* A C))))))
(- (sqrt 2.0)))
(* (sqrt F) (- (sqrt (/ 2.0 B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double tmp;
if (pow(B_m, 2.0) <= 2e-67) {
tmp = sqrt((F * ((2.0 * C) * (2.0 * (pow(B_m, 2.0) - t_0))))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 1e+137) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / (pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 t_0 = (4.0 * A) * C;
double tmp;
if (Math.pow(B_m, 2.0) <= 2e-67) {
tmp = Math.sqrt((F * ((2.0 * C) * (2.0 * (Math.pow(B_m, 2.0) - t_0))))) / (t_0 - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 1e+137) {
tmp = Math.sqrt((F * ((A + (C + Math.hypot(B_m, (A - C)))) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -Math.sqrt(2.0);
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C tmp = 0 if math.pow(B_m, 2.0) <= 2e-67: tmp = math.sqrt((F * ((2.0 * C) * (2.0 * (math.pow(B_m, 2.0) - t_0))))) / (t_0 - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 1e+137: tmp = math.sqrt((F * ((A + (C + math.hypot(B_m, (A - C)))) / (math.pow(B_m, 2.0) + (-4.0 * (A * C)))))) * -math.sqrt(2.0) else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if ((B_m ^ 2.0) <= 2e-67) tmp = Float64(sqrt(Float64(F * Float64(Float64(2.0 * C) * Float64(2.0 * Float64((B_m ^ 2.0) - t_0))))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 1e+137) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
tmp = 0.0;
if ((B_m ^ 2.0) <= 2e-67)
tmp = sqrt((F * ((2.0 * C) * (2.0 * ((B_m ^ 2.0) - t_0))))) / (t_0 - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 1e+137)
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / ((B_m ^ 2.0) + (-4.0 * (A * C)))))) * -sqrt(2.0);
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-67], N[(N[Sqrt[N[(F * N[(N[(2.0 * C), $MachinePrecision] * N[(2.0 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+137], 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[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 2 \cdot 10^{-67}:\\
\;\;\;\;\frac{\sqrt{F \cdot \left(\left(2 \cdot C\right) \cdot \left(2 \cdot \left({B\_m}^{2} - t\_0\right)\right)\right)}}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+137}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.99999999999999989e-67Initial program 22.4%
pow1/222.6%
*-commutative22.6%
unpow-prod-down25.6%
pow1/225.6%
associate-+l+25.9%
unpow225.9%
unpow225.9%
hypot-define38.3%
pow1/238.3%
Applied egg-rr38.3%
pow1/238.3%
*-commutative38.3%
*-commutative38.3%
*-commutative38.3%
unpow-prod-down38.2%
pow1/238.2%
*-commutative38.2%
*-commutative38.2%
*-commutative38.2%
pow1/238.2%
Applied egg-rr38.2%
Taylor expanded in A around -inf 24.2%
*-un-lft-identity24.2%
distribute-frac-neg24.2%
Applied egg-rr23.9%
*-lft-identity23.9%
distribute-neg-frac223.9%
unpow1/223.7%
associate-*l*23.3%
Simplified23.3%
if 1.99999999999999989e-67 < (pow.f64 B #s(literal 2 binary64)) < 1e137Initial program 33.2%
Taylor expanded in F around 0 30.6%
mul-1-neg30.6%
Simplified41.1%
if 1e137 < (pow.f64 B #s(literal 2 binary64)) Initial program 13.4%
Taylor expanded in B around inf 24.5%
mul-1-neg24.5%
Simplified24.5%
pow124.5%
sqrt-unprod24.8%
Applied egg-rr24.8%
unpow124.8%
Simplified24.8%
associate-*l/24.8%
Applied egg-rr24.8%
associate-/l*24.7%
Simplified24.7%
pow1/224.7%
*-commutative24.7%
unpow-prod-down33.0%
pow1/233.0%
pow1/233.0%
Applied egg-rr33.0%
Final simplification29.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 (* (* 4.0 A) C)) (t_1 (- (pow B_m 2.0) t_0)))
(if (<= (pow B_m 2.0) 1e-225)
(/
(* (sqrt (* 2.0 C)) (* (sqrt 2.0) (sqrt (* -4.0 (* F (* A C))))))
(- t_0 (pow B_m 2.0)))
(if (<= (pow B_m 2.0) 5e+82)
(* (pow (* (* 2.0 C) (* F (* 2.0 t_1))) 0.5) (/ -1.0 t_1))
(* (sqrt F) (- (sqrt (/ 2.0 B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = (4.0 * A) * C;
double t_1 = pow(B_m, 2.0) - t_0;
double tmp;
if (pow(B_m, 2.0) <= 1e-225) {
tmp = (sqrt((2.0 * C)) * (sqrt(2.0) * sqrt((-4.0 * (F * (A * C)))))) / (t_0 - pow(B_m, 2.0));
} else if (pow(B_m, 2.0) <= 5e+82) {
tmp = pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (4.0d0 * a) * c
t_1 = (b_m ** 2.0d0) - t_0
if ((b_m ** 2.0d0) <= 1d-225) then
tmp = (sqrt((2.0d0 * c)) * (sqrt(2.0d0) * sqrt(((-4.0d0) * (f * (a * c)))))) / (t_0 - (b_m ** 2.0d0))
else if ((b_m ** 2.0d0) <= 5d+82) then
tmp = (((2.0d0 * c) * (f * (2.0d0 * t_1))) ** 0.5d0) * ((-1.0d0) / t_1)
else
tmp = sqrt(f) * -sqrt((2.0d0 / 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 t_0 = (4.0 * A) * C;
double t_1 = Math.pow(B_m, 2.0) - t_0;
double tmp;
if (Math.pow(B_m, 2.0) <= 1e-225) {
tmp = (Math.sqrt((2.0 * C)) * (Math.sqrt(2.0) * Math.sqrt((-4.0 * (F * (A * C)))))) / (t_0 - Math.pow(B_m, 2.0));
} else if (Math.pow(B_m, 2.0) <= 5e+82) {
tmp = Math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1);
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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): t_0 = (4.0 * A) * C t_1 = math.pow(B_m, 2.0) - t_0 tmp = 0 if math.pow(B_m, 2.0) <= 1e-225: tmp = (math.sqrt((2.0 * C)) * (math.sqrt(2.0) * math.sqrt((-4.0 * (F * (A * C)))))) / (t_0 - math.pow(B_m, 2.0)) elif math.pow(B_m, 2.0) <= 5e+82: tmp = math.pow(((2.0 * C) * (F * (2.0 * t_1))), 0.5) * (-1.0 / t_1) else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(4.0 * A) * C) t_1 = Float64((B_m ^ 2.0) - t_0) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-225) tmp = Float64(Float64(sqrt(Float64(2.0 * C)) * Float64(sqrt(2.0) * sqrt(Float64(-4.0 * Float64(F * Float64(A * C)))))) / Float64(t_0 - (B_m ^ 2.0))); elseif ((B_m ^ 2.0) <= 5e+82) tmp = Float64((Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_1))) ^ 0.5) * Float64(-1.0 / t_1)); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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)
t_0 = (4.0 * A) * C;
t_1 = (B_m ^ 2.0) - t_0;
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e-225)
tmp = (sqrt((2.0 * C)) * (sqrt(2.0) * sqrt((-4.0 * (F * (A * C)))))) / (t_0 - (B_m ^ 2.0));
elseif ((B_m ^ 2.0) <= 5e+82)
tmp = (((2.0 * C) * (F * (2.0 * t_1))) ^ 0.5) * (-1.0 / t_1);
else
tmp = sqrt(F) * -sqrt((2.0 / 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_] := Block[{t$95$0 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-225], N[(N[(N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] * N[Sqrt[N[(-4.0 * N[(F * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+82], N[(N[Power[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := {B\_m}^{2} - t\_0\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-225}:\\
\;\;\;\;\frac{\sqrt{2 \cdot C} \cdot \left(\sqrt{2} \cdot \sqrt{-4 \cdot \left(F \cdot \left(A \cdot C\right)\right)}\right)}{t\_0 - {B\_m}^{2}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+82}:\\
\;\;\;\;{\left(\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_1\right)\right)\right)}^{0.5} \cdot \frac{-1}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999996e-226Initial program 21.4%
pow1/221.5%
*-commutative21.5%
unpow-prod-down25.3%
pow1/225.3%
associate-+l+25.5%
unpow225.5%
unpow225.5%
hypot-define38.8%
pow1/238.8%
Applied egg-rr38.8%
pow1/238.8%
*-commutative38.8%
*-commutative38.8%
*-commutative38.8%
unpow-prod-down38.7%
pow1/238.7%
*-commutative38.7%
*-commutative38.7%
*-commutative38.7%
pow1/238.7%
Applied egg-rr38.7%
Taylor expanded in A around -inf 26.1%
Taylor expanded in B around 0 20.9%
associate-*r*26.1%
Simplified26.1%
if 9.9999999999999996e-226 < (pow.f64 B #s(literal 2 binary64)) < 5.00000000000000015e82Initial program 27.3%
pow1/227.8%
*-commutative27.8%
unpow-prod-down30.6%
pow1/230.6%
associate-+l+31.0%
unpow231.0%
unpow231.0%
hypot-define40.8%
pow1/240.8%
Applied egg-rr40.8%
pow1/240.8%
*-commutative40.8%
*-commutative40.8%
*-commutative40.8%
unpow-prod-down40.7%
pow1/240.7%
*-commutative40.7%
*-commutative40.7%
*-commutative40.7%
pow1/240.7%
Applied egg-rr40.7%
Taylor expanded in A around -inf 20.3%
div-inv20.2%
sqrt-prod20.3%
*-commutative20.3%
pow1/220.3%
pow1/220.3%
pow-prod-down24.7%
associate-*l*24.7%
Applied egg-rr24.7%
if 5.00000000000000015e82 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.8%
Taylor expanded in B around inf 24.6%
mul-1-neg24.6%
Simplified24.6%
pow124.6%
sqrt-unprod24.9%
Applied egg-rr24.9%
unpow124.9%
Simplified24.9%
associate-*l/24.9%
Applied egg-rr24.9%
associate-/l*24.8%
Simplified24.8%
pow1/224.8%
*-commutative24.8%
unpow-prod-down32.4%
pow1/232.4%
pow1/232.4%
Applied egg-rr32.4%
Final simplification27.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.5e-222)
(* (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))) -2.0)
(if (<= B_m 3.1e+43)
(/
(sqrt (* -16.0 (* A (* F (pow C 2.0)))))
(- (* 4.0 (* A C)) (pow B_m 2.0)))
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.5e-222) {
tmp = sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0;
} else if (B_m <= 3.1e+43) {
tmp = sqrt((-16.0 * (A * (F * pow(C, 2.0))))) / ((4.0 * (A * C)) - pow(B_m, 2.0));
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 <= 1.5d-222) then
tmp = sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c))))) * (-2.0d0)
else if (b_m <= 3.1d+43) then
tmp = sqrt(((-16.0d0) * (a * (f * (c ** 2.0d0))))) / ((4.0d0 * (a * c)) - (b_m ** 2.0d0))
else
tmp = sqrt(f) * -sqrt((2.0d0 / 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 <= 1.5e-222) {
tmp = Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0;
} else if (B_m <= 3.1e+43) {
tmp = Math.sqrt((-16.0 * (A * (F * Math.pow(C, 2.0))))) / ((4.0 * (A * C)) - Math.pow(B_m, 2.0));
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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 <= 1.5e-222: tmp = math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0 elif B_m <= 3.1e+43: tmp = math.sqrt((-16.0 * (A * (F * math.pow(C, 2.0))))) / ((4.0 * (A * C)) - math.pow(B_m, 2.0)) else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.5e-222) tmp = Float64(sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C))))) * -2.0); elseif (B_m <= 3.1e+43) tmp = Float64(sqrt(Float64(-16.0 * Float64(A * Float64(F * (C ^ 2.0))))) / Float64(Float64(4.0 * Float64(A * C)) - (B_m ^ 2.0))); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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 <= 1.5e-222)
tmp = sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C))))) * -2.0;
elseif (B_m <= 3.1e+43)
tmp = sqrt((-16.0 * (A * (F * (C ^ 2.0))))) / ((4.0 * (A * C)) - (B_m ^ 2.0));
else
tmp = sqrt(F) * -sqrt((2.0 / 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, 1.5e-222], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[B$95$m, 3.1e+43], 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], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.5 \cdot 10^{-222}:\\
\;\;\;\;\sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot -2\\
\mathbf{elif}\;B\_m \leq 3.1 \cdot 10^{+43}:\\
\;\;\;\;\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{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if B < 1.50000000000000015e-222Initial program 16.4%
pow1/216.6%
*-commutative16.6%
unpow-prod-down20.6%
pow1/220.6%
associate-+l+20.9%
unpow220.9%
unpow220.9%
hypot-define28.9%
pow1/228.9%
Applied egg-rr28.9%
pow1/228.9%
*-commutative28.9%
*-commutative28.9%
*-commutative28.9%
unpow-prod-down28.8%
pow1/228.8%
*-commutative28.8%
*-commutative28.8%
*-commutative28.8%
pow1/228.8%
Applied egg-rr28.8%
Taylor expanded in A around -inf 17.7%
Taylor expanded in F around -inf 0.0%
cancel-sign-sub-inv0.0%
metadata-eval0.0%
unpow20.0%
rem-square-sqrt13.2%
unpow213.2%
rem-square-sqrt13.4%
metadata-eval13.4%
Simplified13.4%
if 1.50000000000000015e-222 < B < 3.1000000000000002e43Initial program 32.6%
Simplified39.8%
Taylor expanded in A around -inf 17.1%
if 3.1000000000000002e43 < B Initial program 20.5%
Taylor expanded in B around inf 52.3%
mul-1-neg52.3%
Simplified52.3%
pow152.3%
sqrt-unprod52.9%
Applied egg-rr52.9%
unpow152.9%
Simplified52.9%
associate-*l/52.9%
Applied egg-rr52.9%
associate-/l*52.7%
Simplified52.7%
pow1/252.7%
*-commutative52.7%
unpow-prod-down70.4%
pow1/270.4%
pow1/270.4%
Applied egg-rr70.4%
Final simplification23.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 (<= B_m 3.1e+43)
(/ (sqrt (* (* F t_0) (* 4.0 C))) (- t_0))
(* (sqrt F) (- (sqrt (/ 2.0 B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 3.1e+43) {
tmp = sqrt(((F * t_0) * (4.0 * C))) / -t_0;
} else {
tmp = sqrt(F) * -sqrt((2.0 / B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 3.1e+43) tmp = Float64(sqrt(Float64(Float64(F * t_0) * Float64(4.0 * C))) / Float64(-t_0)); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.1e+43], N[(N[Sqrt[N[(N[(F * t$95$0), $MachinePrecision] * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 3.1 \cdot 10^{+43}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_0\right) \cdot \left(4 \cdot C\right)}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if B < 3.1000000000000002e43Initial program 21.5%
Simplified26.0%
Taylor expanded in A around -inf 18.1%
if 3.1000000000000002e43 < B Initial program 20.5%
Taylor expanded in B around inf 52.3%
mul-1-neg52.3%
Simplified52.3%
pow152.3%
sqrt-unprod52.9%
Applied egg-rr52.9%
unpow152.9%
Simplified52.9%
associate-*l/52.9%
Applied egg-rr52.9%
associate-/l*52.7%
Simplified52.7%
pow1/252.7%
*-commutative52.7%
unpow-prod-down70.4%
pow1/270.4%
pow1/270.4%
Applied egg-rr70.4%
Final simplification26.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 (<= B_m 1.45) (* (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))) -2.0) (* (sqrt F) (- (sqrt (/ 2.0 B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.45) {
tmp = sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0;
} else {
tmp = sqrt(F) * -sqrt((2.0 / 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 <= 1.45d0) then
tmp = sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c))))) * (-2.0d0)
else
tmp = sqrt(f) * -sqrt((2.0d0 / 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 <= 1.45) {
tmp = Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0;
} else {
tmp = Math.sqrt(F) * -Math.sqrt((2.0 / 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 <= 1.45: tmp = math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) * -2.0 else: tmp = math.sqrt(F) * -math.sqrt((2.0 / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.45) tmp = Float64(sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C))))) * -2.0); else tmp = Float64(sqrt(F) * Float64(-sqrt(Float64(2.0 / 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 <= 1.45)
tmp = sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C))))) * -2.0;
else
tmp = sqrt(F) * -sqrt((2.0 / 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, 1.45], N[(N[Sqrt[N[(N[(C * F), $MachinePrecision] / N[(N[Power[B$95$m, 2.0], $MachinePrecision] + N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * -2.0), $MachinePrecision], N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.45:\\
\;\;\;\;\sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}} \cdot -2\\
\mathbf{else}:\\
\;\;\;\;\sqrt{F} \cdot \left(-\sqrt{\frac{2}{B\_m}}\right)\\
\end{array}
\end{array}
if B < 1.44999999999999996Initial program 20.4%
pow1/220.6%
*-commutative20.6%
unpow-prod-down24.9%
pow1/224.9%
associate-+l+25.1%
unpow225.1%
unpow225.1%
hypot-define34.3%
pow1/234.3%
Applied egg-rr34.3%
pow1/234.3%
*-commutative34.3%
*-commutative34.3%
*-commutative34.3%
unpow-prod-down34.3%
pow1/234.3%
*-commutative34.3%
*-commutative34.3%
*-commutative34.3%
pow1/234.3%
Applied egg-rr34.3%
Taylor expanded in A around -inf 18.8%
Taylor expanded in F around -inf 0.0%
cancel-sign-sub-inv0.0%
metadata-eval0.0%
unpow20.0%
rem-square-sqrt11.2%
unpow211.2%
rem-square-sqrt11.3%
metadata-eval11.3%
Simplified11.3%
if 1.44999999999999996 < B Initial program 24.8%
Taylor expanded in B around inf 44.4%
mul-1-neg44.4%
Simplified44.4%
pow144.4%
sqrt-unprod44.8%
Applied egg-rr44.8%
unpow144.8%
Simplified44.8%
associate-*l/44.8%
Applied egg-rr44.8%
associate-/l*44.6%
Simplified44.6%
pow1/244.6%
*-commutative44.6%
unpow-prod-down57.7%
pow1/257.7%
pow1/257.7%
Applied egg-rr57.7%
Final simplification21.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 (* (sqrt F) (- (sqrt (/ 2.0 B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return sqrt(F) * -sqrt((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) * -sqrt((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) * -Math.sqrt((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) * -math.sqrt((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(F) * Float64(-sqrt(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) * -sqrt((2.0 / B_m));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[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 \left(-\sqrt{\frac{2}{B\_m}}\right)
\end{array}
Initial program 21.4%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
pow112.4%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
associate-*l/12.5%
Applied egg-rr12.5%
associate-/l*12.5%
Simplified12.5%
pow1/212.6%
*-commutative12.6%
unpow-prod-down15.3%
pow1/215.3%
pow1/215.3%
Applied egg-rr15.3%
Final simplification15.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 (fabs (* 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(fabs((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(abs((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(Math.abs((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(math.fabs((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(abs(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(abs((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[Abs[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\left|2 \cdot \frac{F}{B\_m}\right|}
\end{array}
Initial program 21.4%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
pow112.4%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
add-sqr-sqrt12.5%
pow1/212.5%
pow1/212.6%
pow-prod-down14.9%
pow214.9%
*-commutative14.9%
Applied egg-rr14.9%
unpow1/214.9%
unpow214.9%
rem-sqrt-square25.2%
Simplified25.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 (- (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 21.4%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
sqrt-unprod12.5%
pow1/212.6%
Applied egg-rr12.6%
Final simplification12.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 21.4%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
pow112.4%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
Final simplification12.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 21.4%
Taylor expanded in B around inf 12.4%
mul-1-neg12.4%
Simplified12.4%
pow112.4%
sqrt-unprod12.5%
Applied egg-rr12.5%
unpow112.5%
Simplified12.5%
associate-*l/12.5%
Applied egg-rr12.5%
associate-/l*12.5%
Simplified12.5%
herbie shell --seed 2024113
(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))))