
(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 14 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 (* A (* C -4.0)))
(t_1 (fma B_m B_m t_0))
(t_2 (- t_1))
(t_3 (hypot B_m (- A C))))
(if (<= B_m 1.16e-221)
(/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
(if (<= B_m 5.4e-69)
(/ (sqrt (* t_1 (* F (* 4.0 C)))) t_2)
(if (<= B_m 7.2e+87)
(/ (sqrt (* (* F t_1) (* 2.0 (+ A (+ C t_3))))) t_2)
(if (<= B_m 5e+149)
(* (sqrt 2.0) (- (sqrt (* F (/ (+ (+ A C) t_3) (pow B_m 2.0))))))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = A * (C * -4.0);
double t_1 = fma(B_m, B_m, t_0);
double t_2 = -t_1;
double t_3 = hypot(B_m, (A - C));
double tmp;
if (B_m <= 1.16e-221) {
tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
} else if (B_m <= 5.4e-69) {
tmp = sqrt((t_1 * (F * (4.0 * C)))) / t_2;
} else if (B_m <= 7.2e+87) {
tmp = sqrt(((F * t_1) * (2.0 * (A + (C + t_3))))) / t_2;
} else if (B_m <= 5e+149) {
tmp = sqrt(2.0) * -sqrt((F * (((A + C) + t_3) / pow(B_m, 2.0))));
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(A * Float64(C * -4.0)) t_1 = fma(B_m, B_m, t_0) t_2 = Float64(-t_1) t_3 = hypot(B_m, Float64(A - C)) tmp = 0.0 if (B_m <= 1.16e-221) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C)))); elseif (B_m <= 5.4e-69) tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / t_2); elseif (B_m <= 7.2e+87) tmp = Float64(sqrt(Float64(Float64(F * t_1) * Float64(2.0 * Float64(A + Float64(C + t_3))))) / t_2); elseif (B_m <= 5e+149) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(A + C) + t_3) / (B_m ^ 2.0)))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, Block[{t$95$2 = (-t$95$1)}, Block[{t$95$3 = N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]}, If[LessEqual[B$95$m, 1.16e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5.4e-69], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B$95$m, 7.2e+87], N[(N[Sqrt[N[(N[(F * t$95$1), $MachinePrecision] * N[(2.0 * N[(A + N[(C + t$95$3), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B$95$m, 5e+149], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + t$95$3), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
t_2 := -t\_1\\
t_3 := \mathsf{hypot}\left(B\_m, A - C\right)\\
\mathbf{if}\;B\_m \leq 1.16 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\
\mathbf{elif}\;B\_m \leq 5.4 \cdot 10^{-69}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{t\_2}\\
\mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+87}:\\
\;\;\;\;\frac{\sqrt{\left(F \cdot t\_1\right) \cdot \left(2 \cdot \left(A + \left(C + t\_3\right)\right)\right)}}{t\_2}\\
\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+149}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + t\_3}{{B\_m}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 1.1600000000000001e-221Initial program 21.7%
Simplified24.6%
Taylor expanded in A around -inf 10.8%
*-commutative10.8%
Simplified10.8%
clear-num10.8%
inv-pow10.8%
associate-*l*11.5%
Applied egg-rr11.5%
unpow-111.5%
Simplified11.5%
neg-sub011.5%
metadata-eval11.5%
div-sub9.1%
metadata-eval9.1%
*-commutative9.1%
sqrt-prod4.9%
fma-undefine4.9%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr7.3%
div09.5%
neg-sub09.6%
Simplified10.5%
pow1/210.5%
associate-*r*10.5%
unpow-prod-down11.2%
pow1/211.2%
Applied egg-rr11.2%
unpow1/211.2%
Simplified11.2%
if 1.1600000000000001e-221 < B < 5.3999999999999995e-69Initial program 31.7%
Simplified36.4%
Taylor expanded in A around -inf 8.2%
*-commutative8.2%
Simplified8.2%
*-un-lft-identity8.2%
associate-*l*11.1%
Applied egg-rr11.1%
*-lft-identity11.1%
Simplified11.1%
if 5.3999999999999995e-69 < B < 7.19999999999999988e87Initial program 33.1%
Simplified47.6%
if 7.19999999999999988e87 < B < 4.9999999999999999e149Initial program 27.8%
Taylor expanded in F around 0 21.6%
Simplified48.8%
Taylor expanded in C around 0 48.8%
if 4.9999999999999999e149 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification22.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
(/ (+ (+ A C) (hypot B_m (- A C))) (fma -4.0 (* A C) (pow B_m 2.0))))
(t_1 (fma B_m B_m (* A (* C -4.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-228)
(* (* (sqrt t_0) (sqrt F)) (- (sqrt 2.0)))
(if (<= t_3 0.0)
(* (sqrt (* F t_0)) (- (exp (* (log 2.0) 0.5))))
(if (<= t_3 INFINITY)
(/
(* (sqrt (* 2.0 (* F t_1))) (sqrt (+ A (+ C (hypot (- A C) B_m)))))
(- t_1))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = ((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0));
double t_1 = fma(B_m, B_m, (A * (C * -4.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-228) {
tmp = (sqrt(t_0) * sqrt(F)) * -sqrt(2.0);
} else if (t_3 <= 0.0) {
tmp = sqrt((F * t_0)) * -exp((log(2.0) * 0.5));
} else if (t_3 <= ((double) INFINITY)) {
tmp = (sqrt((2.0 * (F * t_1))) * sqrt((A + (C + hypot((A - C), B_m))))) / -t_1;
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.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-228) tmp = Float64(Float64(sqrt(t_0) * sqrt(F)) * Float64(-sqrt(2.0))); elseif (t_3 <= 0.0) tmp = Float64(sqrt(Float64(F * t_0)) * Float64(-exp(Float64(log(2.0) * 0.5)))); elseif (t_3 <= Inf) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(F * t_1))) * sqrt(Float64(A + Float64(C + hypot(Float64(A - C), B_m))))) / Float64(-t_1)); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, 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-228], N[(N[(N[Sqrt[t$95$0], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, 0.0], N[(N[Sqrt[N[(F * t$95$0), $MachinePrecision]], $MachinePrecision] * (-N[Exp[N[(N[Log[2.0], $MachinePrecision] * 0.5), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[t$95$3, Infinity], N[(N[(N[Sqrt[N[(2.0 * N[(F * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(A + N[(C + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-t$95$1)), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
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^{-228}:\\
\;\;\;\;\left(\sqrt{t\_0} \cdot \sqrt{F}\right) \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;t\_3 \leq 0:\\
\;\;\;\;\sqrt{F \cdot t\_0} \cdot \left(-e^{\log 2 \cdot 0.5}\right)\\
\mathbf{elif}\;t\_3 \leq \infty:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(F \cdot t\_1\right)} \cdot \sqrt{A + \left(C + \mathsf{hypot}\left(A - C, B\_m\right)\right)}}{-t\_1}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\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))) < -2.00000000000000007e-228Initial program 48.9%
Taylor expanded in F around 0 42.7%
Simplified58.8%
pow1/258.8%
*-commutative58.8%
metadata-eval58.8%
unpow-prod-down78.0%
metadata-eval78.0%
pow1/278.0%
metadata-eval78.0%
pow1/278.0%
Applied egg-rr78.0%
if -2.00000000000000007e-228 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < 0.0Initial program 22.7%
Taylor expanded in F around 0 26.5%
Simplified41.9%
pow1/241.9%
metadata-eval41.9%
pow-to-exp41.9%
metadata-eval41.9%
Applied egg-rr41.9%
if 0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 49.2%
Simplified67.7%
associate-*r*67.7%
associate-+r+67.7%
hypot-undefine49.2%
unpow249.2%
unpow249.2%
+-commutative49.2%
sqrt-prod53.7%
*-commutative53.7%
associate-+l+53.7%
Applied egg-rr94.9%
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 10.9%
mul-1-neg10.9%
*-commutative10.9%
Simplified10.9%
sqrt-div15.3%
Applied egg-rr15.3%
Final simplification44.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 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
(if (<= B_m 1.6e-221)
(/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
(if (<= B_m 3.2e-119)
(/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
(if (<= B_m 5.6e+147)
(*
(sqrt
(*
F
(/
(+ (+ A C) (hypot B_m (- A C)))
(fma -4.0 (* A C) (pow B_m 2.0)))))
(- (sqrt 2.0)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = A * (C * -4.0);
double t_1 = fma(B_m, B_m, t_0);
double tmp;
if (B_m <= 1.6e-221) {
tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
} else if (B_m <= 3.2e-119) {
tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
} else if (B_m <= 5.6e+147) {
tmp = sqrt((F * (((A + C) + hypot(B_m, (A - C))) / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -sqrt(2.0);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(A * Float64(C * -4.0)) t_1 = fma(B_m, B_m, t_0) tmp = 0.0 if (B_m <= 1.6e-221) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C)))); elseif (B_m <= 3.2e-119) tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1)); elseif (B_m <= 5.6e+147) tmp = Float64(sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-sqrt(2.0))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 1.6e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3.2e-119], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 5.6e+147], N[(N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 1.6 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\
\mathbf{elif}\;B\_m \leq 3.2 \cdot 10^{-119}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\
\mathbf{elif}\;B\_m \leq 5.6 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 1.60000000000000008e-221Initial program 21.7%
Simplified24.6%
Taylor expanded in A around -inf 10.8%
*-commutative10.8%
Simplified10.8%
clear-num10.8%
inv-pow10.8%
associate-*l*11.5%
Applied egg-rr11.5%
unpow-111.5%
Simplified11.5%
neg-sub011.5%
metadata-eval11.5%
div-sub9.1%
metadata-eval9.1%
*-commutative9.1%
sqrt-prod4.9%
fma-undefine4.9%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr7.3%
div09.5%
neg-sub09.6%
Simplified10.5%
pow1/210.5%
associate-*r*10.5%
unpow-prod-down11.2%
pow1/211.2%
Applied egg-rr11.2%
unpow1/211.2%
Simplified11.2%
if 1.60000000000000008e-221 < B < 3.19999999999999993e-119Initial program 26.8%
Simplified35.2%
Taylor expanded in A around -inf 15.0%
*-commutative15.0%
Simplified15.0%
*-un-lft-identity15.0%
associate-*l*14.9%
Applied egg-rr14.9%
*-lft-identity14.9%
Simplified14.9%
if 3.19999999999999993e-119 < B < 5.6000000000000002e147Initial program 32.7%
Taylor expanded in F around 0 30.6%
Simplified49.8%
if 5.6000000000000002e147 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification25.0%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 1e+26)
(- (sqrt (/ F (- A))))
(if (<= (pow B_m 2.0) 1e+292)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 1e+26) {
tmp = -sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 1e+292) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (Math.pow(B_m, 2.0) <= 1e+26) {
tmp = -Math.sqrt((F / -A));
} else if (Math.pow(B_m, 2.0) <= 1e+292) {
tmp = Math.sqrt((F * (A + Math.hypot(B_m, A)))) * (Math.sqrt(2.0) / -B_m);
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt(F) / -Math.sqrt(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 math.pow(B_m, 2.0) <= 1e+26: tmp = -math.sqrt((F / -A)) elif math.pow(B_m, 2.0) <= 1e+292: tmp = math.sqrt((F * (A + math.hypot(B_m, A)))) * (math.sqrt(2.0) / -B_m) else: tmp = math.sqrt(2.0) * (math.sqrt(F) / -math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+26) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); elseif ((B_m ^ 2.0) <= 1e+292) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e+26)
tmp = -sqrt((F / -A));
elseif ((B_m ^ 2.0) <= 1e+292)
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
else
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(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[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+26], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+292], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{+292}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e26Initial program 28.5%
Taylor expanded in F around 0 22.1%
Simplified38.2%
*-commutative38.2%
pow1/238.2%
metadata-eval38.2%
pow1/238.2%
metadata-eval38.2%
pow-prod-down38.3%
associate-*r/37.5%
metadata-eval37.5%
Applied egg-rr37.5%
unpow1/237.5%
Simplified37.5%
Taylor expanded in C around inf 23.9%
mul-1-neg23.9%
Simplified23.9%
if 1.00000000000000005e26 < (pow.f64 B #s(literal 2 binary64)) < 1e292Initial program 30.0%
Taylor expanded in C around 0 14.0%
mul-1-neg14.0%
*-commutative14.0%
*-commutative14.0%
+-commutative14.0%
unpow214.0%
unpow214.0%
hypot-define14.5%
Simplified14.5%
if 1e292 < (pow.f64 B #s(literal 2 binary64)) Initial program 1.6%
Taylor expanded in B around inf 18.9%
mul-1-neg18.9%
*-commutative18.9%
Simplified18.9%
sqrt-div26.6%
Applied egg-rr26.6%
Final simplification22.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 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
(if (<= B_m 7e-222)
(/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
(if (<= B_m 8000000000000.0)
(/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
(if (<= B_m 2.9e+147)
(*
(sqrt 2.0)
(- (sqrt (* F (/ (+ (+ A C) (hypot B_m (- A C))) (pow B_m 2.0))))))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = A * (C * -4.0);
double t_1 = fma(B_m, B_m, t_0);
double tmp;
if (B_m <= 7e-222) {
tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
} else if (B_m <= 8000000000000.0) {
tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
} else if (B_m <= 2.9e+147) {
tmp = sqrt(2.0) * -sqrt((F * (((A + C) + hypot(B_m, (A - C))) / pow(B_m, 2.0))));
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(A * Float64(C * -4.0)) t_1 = fma(B_m, B_m, t_0) tmp = 0.0 if (B_m <= 7e-222) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C)))); elseif (B_m <= 8000000000000.0) tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1)); elseif (B_m <= 2.9e+147) tmp = Float64(sqrt(2.0) * Float64(-sqrt(Float64(F * Float64(Float64(Float64(A + C) + hypot(B_m, Float64(A - C))) / (B_m ^ 2.0)))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 7e-222], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 8000000000000.0], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 2.9e+147], N[(N[Sqrt[2.0], $MachinePrecision] * (-N[Sqrt[N[(F * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision] / N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 7 \cdot 10^{-222}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\
\mathbf{elif}\;B\_m \leq 8000000000000:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\
\mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{2} \cdot \left(-\sqrt{F \cdot \frac{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}{{B\_m}^{2}}}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 7.00000000000000049e-222Initial program 21.7%
Simplified24.6%
Taylor expanded in A around -inf 10.8%
*-commutative10.8%
Simplified10.8%
clear-num10.8%
inv-pow10.8%
associate-*l*11.5%
Applied egg-rr11.5%
unpow-111.5%
Simplified11.5%
neg-sub011.5%
metadata-eval11.5%
div-sub9.1%
metadata-eval9.1%
*-commutative9.1%
sqrt-prod4.9%
fma-undefine4.9%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr7.3%
div09.5%
neg-sub09.6%
Simplified10.5%
pow1/210.5%
associate-*r*10.5%
unpow-prod-down11.2%
pow1/211.2%
Applied egg-rr11.2%
unpow1/211.2%
Simplified11.2%
if 7.00000000000000049e-222 < B < 8e12Initial program 33.9%
Simplified44.8%
Taylor expanded in A around -inf 11.5%
*-commutative11.5%
Simplified11.5%
*-un-lft-identity11.5%
associate-*l*13.7%
Applied egg-rr13.7%
*-lft-identity13.7%
Simplified13.7%
if 8e12 < B < 2.8999999999999998e147Initial program 27.2%
Taylor expanded in F around 0 23.9%
Simplified43.0%
Taylor expanded in C around 0 42.9%
if 2.8999999999999998e147 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification20.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 (* A (* C -4.0))) (t_1 (fma B_m B_m t_0)))
(if (<= B_m 3.3e-221)
(/ -1.0 (/ (hypot B_m (sqrt t_0)) (* (sqrt (* 4.0 F)) (sqrt C))))
(if (<= B_m 1.15e+14)
(/ (sqrt (* t_1 (* F (* 4.0 C)))) (- t_1))
(if (<= B_m 8.2e+145)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = A * (C * -4.0);
double t_1 = fma(B_m, B_m, t_0);
double tmp;
if (B_m <= 3.3e-221) {
tmp = -1.0 / (hypot(B_m, sqrt(t_0)) / (sqrt((4.0 * F)) * sqrt(C)));
} else if (B_m <= 1.15e+14) {
tmp = sqrt((t_1 * (F * (4.0 * C)))) / -t_1;
} else if (B_m <= 8.2e+145) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(A * Float64(C * -4.0)) t_1 = fma(B_m, B_m, t_0) tmp = 0.0 if (B_m <= 3.3e-221) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(t_0)) / Float64(sqrt(Float64(4.0 * F)) * sqrt(C)))); elseif (B_m <= 1.15e+14) tmp = Float64(sqrt(Float64(t_1 * Float64(F * Float64(4.0 * C)))) / Float64(-t_1)); elseif (B_m <= 8.2e+145) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + t$95$0), $MachinePrecision]}, If[LessEqual[B$95$m, 3.3e-221], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision] / N[(N[Sqrt[N[(4.0 * F), $MachinePrecision]], $MachinePrecision] * N[Sqrt[C], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 1.15e+14], N[(N[Sqrt[N[(t$95$1 * N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 8.2e+145], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, t\_0\right)\\
\mathbf{if}\;B\_m \leq 3.3 \cdot 10^{-221}:\\
\;\;\;\;\frac{-1}{\frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)}{\sqrt{4 \cdot F} \cdot \sqrt{C}}}\\
\mathbf{elif}\;B\_m \leq 1.15 \cdot 10^{+14}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot \left(F \cdot \left(4 \cdot C\right)\right)}}{-t\_1}\\
\mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{+145}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 3.2999999999999999e-221Initial program 21.7%
Simplified24.6%
Taylor expanded in A around -inf 10.8%
*-commutative10.8%
Simplified10.8%
clear-num10.8%
inv-pow10.8%
associate-*l*11.5%
Applied egg-rr11.5%
unpow-111.5%
Simplified11.5%
neg-sub011.5%
metadata-eval11.5%
div-sub9.1%
metadata-eval9.1%
*-commutative9.1%
sqrt-prod4.9%
fma-undefine4.9%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr7.3%
div09.5%
neg-sub09.6%
Simplified10.5%
pow1/210.5%
associate-*r*10.5%
unpow-prod-down11.2%
pow1/211.2%
Applied egg-rr11.2%
unpow1/211.2%
Simplified11.2%
if 3.2999999999999999e-221 < B < 1.15e14Initial program 33.9%
Simplified44.8%
Taylor expanded in A around -inf 11.5%
*-commutative11.5%
Simplified11.5%
*-un-lft-identity11.5%
associate-*l*13.7%
Applied egg-rr13.7%
*-lft-identity13.7%
Simplified13.7%
if 1.15e14 < B < 8.2000000000000003e145Initial program 27.2%
Taylor expanded in C around 0 28.4%
mul-1-neg28.4%
*-commutative28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
unpow228.4%
hypot-define29.0%
Simplified29.0%
if 8.2000000000000003e145 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification18.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 (* F (* 4.0 C))) (t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 2.02e-200)
(/ -1.0 (* (hypot B_m (sqrt (* -4.0 (* A C)))) (pow t_0 -0.5)))
(if (<= B_m 5e+15)
(/ (sqrt (* t_1 t_0)) (- t_1))
(if (<= B_m 1.6e+147)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = F * (4.0 * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 2.02e-200) {
tmp = -1.0 / (hypot(B_m, sqrt((-4.0 * (A * C)))) * pow(t_0, -0.5));
} else if (B_m <= 5e+15) {
tmp = sqrt((t_1 * t_0)) / -t_1;
} else if (B_m <= 1.6e+147) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(F * Float64(4.0 * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 2.02e-200) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * (t_0 ^ -0.5))); elseif (B_m <= 5e+15) tmp = Float64(sqrt(Float64(t_1 * t_0)) / Float64(-t_1)); elseif (B_m <= 1.6e+147) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 2.02e-200], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[Power[t$95$0, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 5e+15], N[(N[Sqrt[N[(t$95$1 * t$95$0), $MachinePrecision]], $MachinePrecision] / (-t$95$1)), $MachinePrecision], If[LessEqual[B$95$m, 1.6e+147], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := F \cdot \left(4 \cdot C\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 2.02 \cdot 10^{-200}:\\
\;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {t\_0}^{-0.5}}\\
\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+15}:\\
\;\;\;\;\frac{\sqrt{t\_1 \cdot t\_0}}{-t\_1}\\
\mathbf{elif}\;B\_m \leq 1.6 \cdot 10^{+147}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 2.02000000000000001e-200Initial program 21.2%
Simplified24.0%
Taylor expanded in A around -inf 10.6%
*-commutative10.6%
Simplified10.6%
clear-num10.6%
inv-pow10.6%
associate-*l*11.3%
Applied egg-rr11.3%
unpow-111.3%
Simplified11.3%
neg-sub011.3%
metadata-eval11.3%
div-sub8.9%
metadata-eval8.9%
*-commutative8.9%
sqrt-prod4.8%
fma-undefine4.8%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr8.3%
div010.5%
neg-sub010.6%
Simplified11.5%
div-inv11.4%
associate-*r*11.4%
*-commutative11.4%
*-commutative11.4%
pow1/211.5%
pow-flip11.5%
*-commutative11.5%
metadata-eval11.5%
Applied egg-rr11.5%
if 2.02000000000000001e-200 < B < 5e15Initial program 37.2%
Simplified49.2%
Taylor expanded in A around -inf 12.4%
*-commutative12.4%
Simplified12.4%
*-un-lft-identity12.4%
associate-*l*14.9%
Applied egg-rr14.9%
*-lft-identity14.9%
Simplified14.9%
if 5e15 < B < 1.59999999999999989e147Initial program 27.2%
Taylor expanded in C around 0 28.4%
mul-1-neg28.4%
*-commutative28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
unpow228.4%
hypot-define29.0%
Simplified29.0%
if 1.59999999999999989e147 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification19.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 1.26e-199)
(/
-1.0
(* (hypot B_m (sqrt (* -4.0 (* A C)))) (pow (* F (* 4.0 C)) -0.5)))
(if (<= B_m 13500000000000.0)
(/ (sqrt (* (* 4.0 C) (* F t_0))) (- t_0))
(if (<= B_m 5e+146)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 1.26e-199) {
tmp = -1.0 / (hypot(B_m, sqrt((-4.0 * (A * C)))) * pow((F * (4.0 * C)), -0.5));
} else if (B_m <= 13500000000000.0) {
tmp = sqrt(((4.0 * C) * (F * t_0))) / -t_0;
} else if (B_m <= 5e+146) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 1.26e-199) tmp = Float64(-1.0 / Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * (Float64(F * Float64(4.0 * C)) ^ -0.5))); elseif (B_m <= 13500000000000.0) tmp = Float64(sqrt(Float64(Float64(4.0 * C) * Float64(F * t_0))) / Float64(-t_0)); elseif (B_m <= 5e+146) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := 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, 1.26e-199], N[(-1.0 / N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[Power[N[(F * N[(4.0 * C), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 13500000000000.0], N[(N[Sqrt[N[(N[(4.0 * C), $MachinePrecision] * N[(F * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision], If[LessEqual[B$95$m, 5e+146], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 1.26 \cdot 10^{-199}:\\
\;\;\;\;\frac{-1}{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot {\left(F \cdot \left(4 \cdot C\right)\right)}^{-0.5}}\\
\mathbf{elif}\;B\_m \leq 13500000000000:\\
\;\;\;\;\frac{\sqrt{\left(4 \cdot C\right) \cdot \left(F \cdot t\_0\right)}}{-t\_0}\\
\mathbf{elif}\;B\_m \leq 5 \cdot 10^{+146}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 1.26000000000000006e-199Initial program 21.2%
Simplified24.0%
Taylor expanded in A around -inf 10.6%
*-commutative10.6%
Simplified10.6%
clear-num10.6%
inv-pow10.6%
associate-*l*11.3%
Applied egg-rr11.3%
unpow-111.3%
Simplified11.3%
neg-sub011.3%
metadata-eval11.3%
div-sub8.9%
metadata-eval8.9%
*-commutative8.9%
sqrt-prod4.8%
fma-undefine4.8%
add-sqr-sqrt4.7%
hypot-define4.7%
associate-*r*4.7%
Applied egg-rr8.3%
div010.5%
neg-sub010.6%
Simplified11.5%
div-inv11.4%
associate-*r*11.4%
*-commutative11.4%
*-commutative11.4%
pow1/211.5%
pow-flip11.5%
*-commutative11.5%
metadata-eval11.5%
Applied egg-rr11.5%
if 1.26000000000000006e-199 < B < 1.35e13Initial program 37.2%
Simplified49.2%
Taylor expanded in A around -inf 12.4%
*-commutative12.4%
Simplified12.4%
if 1.35e13 < B < 4.9999999999999999e146Initial program 27.2%
Taylor expanded in C around 0 28.4%
mul-1-neg28.4%
*-commutative28.4%
*-commutative28.4%
+-commutative28.4%
unpow228.4%
unpow228.4%
hypot-define29.0%
Simplified29.0%
if 4.9999999999999999e146 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification18.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 7.3e-118)
(- (sqrt (/ F (- A))))
(if (<= B_m 1.05e+21)
(-
(sqrt
(*
2.0
(/
(* F (+ (+ A C) (hypot B_m (- A C))))
(fma -4.0 (* A C) (* B_m B_m))))))
(if (<= B_m 1e+146)
(* (sqrt (* F (+ A (hypot B_m A)))) (/ (sqrt 2.0) (- B_m)))
(* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 7.3e-118) {
tmp = -sqrt((F / -A));
} else if (B_m <= 1.05e+21) {
tmp = -sqrt((2.0 * ((F * ((A + C) + hypot(B_m, (A - C)))) / fma(-4.0, (A * C), (B_m * B_m)))));
} else if (B_m <= 1e+146) {
tmp = sqrt((F * (A + hypot(B_m, A)))) * (sqrt(2.0) / -B_m);
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(B_m));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 7.3e-118) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); elseif (B_m <= 1.05e+21) tmp = Float64(-sqrt(Float64(2.0 * Float64(Float64(F * Float64(Float64(A + C) + hypot(B_m, Float64(A - C)))) / fma(-4.0, Float64(A * C), Float64(B_m * B_m)))))); elseif (B_m <= 1e+146) tmp = Float64(sqrt(Float64(F * Float64(A + hypot(B_m, A)))) * Float64(sqrt(2.0) / Float64(-B_m))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(B_m)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 7.3e-118], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), If[LessEqual[B$95$m, 1.05e+21], (-N[Sqrt[N[(2.0 * N[(N[(F * N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(-4.0 * N[(A * C), $MachinePrecision] + N[(B$95$m * B$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), If[LessEqual[B$95$m, 1e+146], N[(N[Sqrt[N[(F * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[2.0], $MachinePrecision] / (-B$95$m)), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 7.3 \cdot 10^{-118}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{+21}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F \cdot \left(\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{\mathsf{fma}\left(-4, A \cdot C, B\_m \cdot B\_m\right)}}\\
\mathbf{elif}\;B\_m \leq 10^{+146}:\\
\;\;\;\;\sqrt{F \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)} \cdot \frac{\sqrt{2}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 7.2999999999999999e-118Initial program 22.2%
Taylor expanded in F around 0 15.2%
Simplified31.0%
*-commutative31.0%
pow1/231.0%
metadata-eval31.0%
pow1/231.0%
metadata-eval31.0%
pow-prod-down31.1%
associate-*r/28.1%
metadata-eval28.1%
Applied egg-rr28.1%
unpow1/228.1%
Simplified28.1%
Taylor expanded in C around inf 18.5%
mul-1-neg18.5%
Simplified18.5%
if 7.2999999999999999e-118 < B < 1.05e21Initial program 40.4%
Taylor expanded in F around 0 39.6%
Simplified58.0%
*-commutative58.0%
pow1/258.0%
metadata-eval58.0%
pow1/258.0%
metadata-eval58.0%
pow-prod-down58.4%
associate-*r/58.3%
metadata-eval58.3%
Applied egg-rr58.3%
unpow1/258.3%
Simplified58.3%
unpow258.3%
Applied egg-rr58.3%
if 1.05e21 < B < 9.99999999999999934e145Initial program 24.4%
Taylor expanded in C around 0 25.7%
mul-1-neg25.7%
*-commutative25.7%
*-commutative25.7%
+-commutative25.7%
unpow225.7%
unpow225.7%
hypot-define26.3%
Simplified26.3%
if 9.99999999999999934e145 < B Initial program 0.0%
Taylor expanded in B around inf 44.3%
mul-1-neg44.3%
*-commutative44.3%
Simplified44.3%
sqrt-div66.9%
Applied egg-rr66.9%
Final simplification28.4%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= (pow B_m 2.0) 1e+26) (- (sqrt (/ F (- A)))) (- (sqrt (* 2.0 (fabs (/ F B_m)))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 1e+26) {
tmp = -sqrt((F / -A));
} else {
tmp = -sqrt((2.0 * fabs((F / B_m))));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if ((b_m ** 2.0d0) <= 1d+26) then
tmp = -sqrt((f / -a))
else
tmp = -sqrt((2.0d0 * abs((f / b_m))))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (Math.pow(B_m, 2.0) <= 1e+26) {
tmp = -Math.sqrt((F / -A));
} else {
tmp = -Math.sqrt((2.0 * Math.abs((F / B_m))));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if math.pow(B_m, 2.0) <= 1e+26: tmp = -math.sqrt((F / -A)) else: tmp = -math.sqrt((2.0 * math.fabs((F / B_m)))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 1e+26) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); else tmp = Float64(-sqrt(Float64(2.0 * abs(Float64(F / B_m))))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((B_m ^ 2.0) <= 1e+26)
tmp = -sqrt((F / -A));
else
tmp = -sqrt((2.0 * abs((F / B_m))));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e+26], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[Abs[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])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{+26}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \left|\frac{F}{B\_m}\right|}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 1.00000000000000005e26Initial program 28.5%
Taylor expanded in F around 0 22.1%
Simplified38.2%
*-commutative38.2%
pow1/238.2%
metadata-eval38.2%
pow1/238.2%
metadata-eval38.2%
pow-prod-down38.3%
associate-*r/37.5%
metadata-eval37.5%
Applied egg-rr37.5%
unpow1/237.5%
Simplified37.5%
Taylor expanded in C around inf 23.9%
mul-1-neg23.9%
Simplified23.9%
if 1.00000000000000005e26 < (pow.f64 B #s(literal 2 binary64)) Initial program 15.3%
Taylor expanded in B around inf 16.9%
mul-1-neg16.9%
*-commutative16.9%
Simplified16.9%
*-commutative16.9%
pow1/216.9%
metadata-eval16.9%
pow1/216.9%
metadata-eval16.9%
pow-prod-down17.0%
metadata-eval17.0%
Applied egg-rr17.0%
unpow1/217.0%
Simplified17.0%
add-sqr-sqrt16.9%
sqrt-unprod31.4%
pow231.4%
Applied egg-rr31.4%
unpow231.4%
rem-sqrt-square42.9%
Simplified42.9%
Final simplification32.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.5e+14) (- (sqrt (/ F (- A)))) (* (sqrt 2.0) (/ (sqrt F) (- (sqrt B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 5.5e+14) {
tmp = -sqrt((F / -A));
} else {
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(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 <= 5.5d+14) then
tmp = -sqrt((f / -a))
else
tmp = sqrt(2.0d0) * (sqrt(f) / -sqrt(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 <= 5.5e+14) {
tmp = -Math.sqrt((F / -A));
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt(F) / -Math.sqrt(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 <= 5.5e+14: tmp = -math.sqrt((F / -A)) else: tmp = math.sqrt(2.0) * (math.sqrt(F) / -math.sqrt(B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 5.5e+14) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) / Float64(-sqrt(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 <= 5.5e+14)
tmp = -sqrt((F / -A));
else
tmp = sqrt(2.0) * (sqrt(F) / -sqrt(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, 5.5e+14], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] / (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 5.5 \cdot 10^{+14}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \frac{\sqrt{F}}{-\sqrt{B\_m}}\\
\end{array}
\end{array}
if B < 5.5e14Initial program 24.3%
Taylor expanded in F around 0 18.1%
Simplified34.4%
*-commutative34.4%
pow1/234.4%
metadata-eval34.4%
pow1/234.4%
metadata-eval34.4%
pow-prod-down34.5%
associate-*r/31.9%
metadata-eval31.9%
Applied egg-rr31.9%
unpow1/231.9%
Simplified31.9%
Taylor expanded in C around inf 18.2%
mul-1-neg18.2%
Simplified18.2%
if 5.5e14 < B Initial program 14.1%
Taylor expanded in B around inf 37.0%
mul-1-neg37.0%
*-commutative37.0%
Simplified37.0%
sqrt-div49.6%
Applied egg-rr49.6%
Final simplification24.6%
B_m = (fabs.f64 B) NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. (FPCore (A B_m C F) :precision binary64 (if (<= B_m 2.15e+15) (- (sqrt (/ F (- A)))) (- (sqrt (/ (* 2.0 F) B_m)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.15e+15) {
tmp = -sqrt((F / -A));
} else {
tmp = -sqrt(((2.0 * F) / B_m));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 2.15d+15) then
tmp = -sqrt((f / -a))
else
tmp = -sqrt(((2.0d0 * f) / b_m))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 2.15e+15) {
tmp = -Math.sqrt((F / -A));
} else {
tmp = -Math.sqrt(((2.0 * F) / B_m));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 2.15e+15: tmp = -math.sqrt((F / -A)) else: tmp = -math.sqrt(((2.0 * F) / B_m)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 2.15e+15) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); else tmp = Float64(-sqrt(Float64(Float64(2.0 * F) / B_m))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 2.15e+15)
tmp = -sqrt((F / -A));
else
tmp = -sqrt(((2.0 * F) / B_m));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 2.15e+15], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] / B$95$m), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 2.15 \cdot 10^{+15}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{\frac{2 \cdot F}{B\_m}}\\
\end{array}
\end{array}
if B < 2.15e15Initial program 24.3%
Taylor expanded in F around 0 18.1%
Simplified34.4%
*-commutative34.4%
pow1/234.4%
metadata-eval34.4%
pow1/234.4%
metadata-eval34.4%
pow-prod-down34.5%
associate-*r/31.9%
metadata-eval31.9%
Applied egg-rr31.9%
unpow1/231.9%
Simplified31.9%
Taylor expanded in C around inf 18.2%
mul-1-neg18.2%
Simplified18.2%
if 2.15e15 < B Initial program 14.1%
Taylor expanded in B around inf 37.0%
mul-1-neg37.0%
*-commutative37.0%
Simplified37.0%
*-commutative37.0%
pow1/237.0%
metadata-eval37.0%
pow1/237.0%
metadata-eval37.0%
pow-prod-down37.2%
metadata-eval37.2%
Applied egg-rr37.2%
unpow1/237.2%
Simplified37.2%
Taylor expanded in F around 0 37.2%
associate-*r/37.3%
*-commutative37.3%
Simplified37.3%
Final simplification22.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 1.45e+15) (- (sqrt (/ F (- A)))) (- (sqrt (* 2.0 (/ F B_m))))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.45e+15) {
tmp = -sqrt((F / -A));
} else {
tmp = -sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (b_m <= 1.45d+15) then
tmp = -sqrt((f / -a))
else
tmp = -sqrt((2.0d0 * (f / b_m)))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 1.45e+15) {
tmp = -Math.sqrt((F / -A));
} else {
tmp = -Math.sqrt((2.0 * (F / B_m)));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if B_m <= 1.45e+15: tmp = -math.sqrt((F / -A)) else: tmp = -math.sqrt((2.0 * (F / B_m))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 1.45e+15) tmp = Float64(-sqrt(Float64(F / Float64(-A)))); else tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (B_m <= 1.45e+15)
tmp = -sqrt((F / -A));
else
tmp = -sqrt((2.0 * (F / B_m)));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 1.45e+15], (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]), (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 1.45 \cdot 10^{+15}:\\
\;\;\;\;-\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if B < 1.45e15Initial program 24.3%
Taylor expanded in F around 0 18.1%
Simplified34.4%
*-commutative34.4%
pow1/234.4%
metadata-eval34.4%
pow1/234.4%
metadata-eval34.4%
pow-prod-down34.5%
associate-*r/31.9%
metadata-eval31.9%
Applied egg-rr31.9%
unpow1/231.9%
Simplified31.9%
Taylor expanded in C around inf 18.2%
mul-1-neg18.2%
Simplified18.2%
if 1.45e15 < B Initial program 14.1%
Taylor expanded in B around inf 37.0%
mul-1-neg37.0%
*-commutative37.0%
Simplified37.0%
*-commutative37.0%
pow1/237.0%
metadata-eval37.0%
pow1/237.0%
metadata-eval37.0%
pow-prod-down37.2%
metadata-eval37.2%
Applied egg-rr37.2%
unpow1/237.2%
Simplified37.2%
Final simplification22.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 (- A)))))
B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
return -sqrt((F / -A));
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
code = -sqrt((f / -a))
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
return -Math.sqrt((F / -A));
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): return -math.sqrt((F / -A))
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) return Float64(-sqrt(Float64(F / Float64(-A)))) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = -sqrt((F / -A));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := (-N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision])
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
-\sqrt{\frac{F}{-A}}
\end{array}
Initial program 22.2%
Taylor expanded in F around 0 17.0%
Simplified32.4%
*-commutative32.4%
pow1/232.4%
metadata-eval32.4%
pow1/232.4%
metadata-eval32.4%
pow-prod-down32.4%
associate-*r/29.1%
metadata-eval29.1%
Applied egg-rr29.1%
unpow1/229.1%
Simplified29.1%
Taylor expanded in C around inf 18.1%
mul-1-neg18.1%
Simplified18.1%
Final simplification18.1%
herbie shell --seed 2024172
(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))))