
(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 21 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 (+ C (hypot B_m C)))
(t_1 (* (* 4.0 A) C))
(t_2 (* 2.0 (* (- (pow B_m 2.0) t_1) F)))
(t_3 (- t_1 (pow B_m 2.0)))
(t_4
(/
(sqrt (* t_2 (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0))))))
t_3))
(t_5 (* A (* C -4.0))))
(if (<= t_4 (- INFINITY))
(*
(/ (sqrt F) -1.0)
(/
(* (hypot B_m (sqrt t_5)) (sqrt (* 2.0 (* 2.0 C))))
(fma B_m B_m t_5)))
(if (<= t_4 -5e-169)
(/ (sqrt (* t_2 t_0)) t_3)
(if (<= t_4 4e+257)
(/ (sqrt (* t_2 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))) t_3)
(if (<= t_4 INFINITY)
(sqrt (/ F (- A)))
(* (* (sqrt F) (sqrt t_0)) (/ (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 = C + hypot(B_m, C);
double t_1 = (4.0 * A) * C;
double t_2 = 2.0 * ((pow(B_m, 2.0) - t_1) * F);
double t_3 = t_1 - pow(B_m, 2.0);
double t_4 = sqrt((t_2 * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_3;
double t_5 = A * (C * -4.0);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = (sqrt(F) / -1.0) * ((hypot(B_m, sqrt(t_5)) * sqrt((2.0 * (2.0 * C)))) / fma(B_m, B_m, t_5));
} else if (t_4 <= -5e-169) {
tmp = sqrt((t_2 * t_0)) / t_3;
} else if (t_4 <= 4e+257) {
tmp = sqrt((t_2 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_3;
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt((F / -A));
} else {
tmp = (sqrt(F) * sqrt(t_0)) * (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(C + hypot(B_m, C)) t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) t_3 = Float64(t_1 - (B_m ^ 2.0)) t_4 = Float64(sqrt(Float64(t_2 * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0)))))) / t_3) t_5 = Float64(A * Float64(C * -4.0)) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(Float64(sqrt(F) / -1.0) * Float64(Float64(hypot(B_m, sqrt(t_5)) * sqrt(Float64(2.0 * Float64(2.0 * C)))) / fma(B_m, B_m, t_5))); elseif (t_4 <= -5e-169) tmp = Float64(sqrt(Float64(t_2 * t_0)) / t_3); elseif (t_4 <= 4e+257) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / t_3); elseif (t_4 <= Inf) tmp = sqrt(Float64(F / Float64(-A))); else tmp = Float64(Float64(sqrt(F) * sqrt(t_0)) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[Sqrt[N[(t$95$2 * 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] / t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[Sqrt[F], $MachinePrecision] / -1.0), $MachinePrecision] * N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$5], $MachinePrecision] ^ 2], $MachinePrecision] * N[Sqrt[N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + t$95$5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, -5e-169], N[(N[Sqrt[N[(t$95$2 * t$95$0), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$4, 4e+257], N[(N[Sqrt[N[(t$95$2 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[t$95$4, Infinity], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := C + \mathsf{hypot}\left(B\_m, C\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := 2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\\
t_3 := t\_1 - {B\_m}^{2}\\
t_4 := \frac{\sqrt{t\_2 \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_3}\\
t_5 := A \cdot \left(C \cdot -4\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{F}}{-1} \cdot \frac{\mathsf{hypot}\left(B\_m, \sqrt{t\_5}\right) \cdot \sqrt{2 \cdot \left(2 \cdot C\right)}}{\mathsf{fma}\left(B\_m, B\_m, t\_5\right)}\\
\mathbf{elif}\;t\_4 \leq -5 \cdot 10^{-169}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot t\_0}}{t\_3}\\
\mathbf{elif}\;t\_4 \leq 4 \cdot 10^{+257}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_3}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{t\_0}\right) \cdot \frac{\sqrt{2}}{-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))) < -inf.0Initial program 3.4%
Simplified28.3%
associate-*r*28.3%
associate-+r+27.3%
hypot-undefine3.4%
unpow23.4%
unpow23.4%
+-commutative3.4%
sqrt-prod13.2%
*-commutative13.2%
associate-*r*13.2%
associate-+l+13.2%
Applied egg-rr48.2%
Taylor expanded in A around -inf 27.6%
pow127.6%
sqrt-unprod23.7%
associate-*l*23.7%
associate-*r*23.7%
*-commutative23.7%
Applied egg-rr23.7%
unpow123.7%
associate-*l*17.8%
Simplified17.8%
sqrt-prod23.6%
neg-mul-123.6%
times-frac23.6%
associate-*l*23.6%
sqrt-prod39.3%
fma-undefine39.3%
add-sqr-sqrt37.1%
hypot-define37.1%
Applied egg-rr37.1%
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))) < -5.0000000000000002e-169Initial program 95.9%
Taylor expanded in A around 0 83.3%
unpow283.3%
unpow283.3%
hypot-define83.3%
Simplified83.3%
if -5.0000000000000002e-169 < (/.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.00000000000000012e257Initial program 18.9%
Taylor expanded in A around -inf 29.1%
if 4.00000000000000012e257 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) < +inf.0Initial program 4.0%
Simplified30.7%
add-sqr-sqrt30.8%
sqrt-unprod30.7%
frac-times18.4%
Applied egg-rr18.4%
Taylor expanded in A around -inf 41.8%
associate-*r/41.8%
mul-1-neg41.8%
Simplified41.8%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 #s(literal 2 binary64) (*.f64 (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) #s(literal 2 binary64)) (pow.f64 B #s(literal 2 binary64)))))))) (-.f64 (pow.f64 B #s(literal 2 binary64)) (*.f64 (*.f64 #s(literal 4 binary64) A) C))) Initial program 0.0%
Taylor expanded in A around 0 1.8%
mul-1-neg1.8%
*-commutative1.8%
distribute-rgt-neg-in1.8%
unpow21.8%
unpow21.8%
hypot-define19.0%
Simplified19.0%
pow1/219.1%
*-commutative19.1%
unpow-prod-down27.8%
pow1/227.8%
pow1/227.8%
Applied egg-rr27.8%
Final simplification38.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 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0))))
(if (<= (pow B_m 2.0) 1e-266)
t_0
(if (<= (pow B_m 2.0) 5e-186)
(sqrt (/ F (- A)))
(if (<= (pow B_m 2.0) 2e-72)
t_0
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double tmp;
if (pow(B_m, 2.0) <= 1e-266) {
tmp = t_0;
} else if (pow(B_m, 2.0) <= 5e-186) {
tmp = sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 2e-72) {
tmp = t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-266) tmp = t_0; elseif ((B_m ^ 2.0) <= 5e-186) tmp = sqrt(Float64(F / Float64(-A))); elseif ((B_m ^ 2.0) <= 2e-72) tmp = t_0; else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-266], t$95$0, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-186], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-72], t$95$0, N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 10^{-266}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-72}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-267 or 5e-186 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-72Initial program 17.4%
Simplified28.5%
associate-*r*28.5%
associate-+r+26.1%
hypot-undefine17.4%
unpow217.4%
unpow217.4%
+-commutative17.4%
sqrt-prod20.0%
*-commutative20.0%
associate-*r*20.0%
associate-+l+21.2%
Applied egg-rr33.3%
Taylor expanded in A around -inf 21.7%
Taylor expanded in F around 0 16.2%
associate-*r*16.2%
mul-1-neg16.2%
associate-/l*18.0%
fma-define18.0%
unpow218.0%
rem-square-sqrt18.3%
Simplified18.3%
if 9.9999999999999998e-267 < (pow.f64 B #s(literal 2 binary64)) < 5e-186Initial program 19.7%
Simplified24.9%
add-sqr-sqrt24.2%
sqrt-unprod20.3%
frac-times19.3%
Applied egg-rr19.3%
Taylor expanded in A around -inf 55.1%
associate-*r/55.1%
mul-1-neg55.1%
Simplified55.1%
if 1.9999999999999999e-72 < (pow.f64 B #s(literal 2 binary64)) Initial program 17.0%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
*-commutative13.6%
distribute-rgt-neg-in13.6%
unpow213.6%
unpow213.6%
hypot-define27.8%
Simplified27.8%
pow1/227.9%
*-commutative27.9%
unpow-prod-down36.8%
pow1/236.8%
pow1/236.8%
Applied egg-rr36.8%
Taylor expanded in C around 0 30.8%
Final simplification27.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 1e-266)
(/
(* (sqrt (* 2.0 (* -4.0 (* A (* C F))))) (sqrt (* 2.0 C)))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e-186)
(sqrt (/ F (- A)))
(if (<= (pow B_m 2.0) 2e-72)
(* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C)))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 1e-266) {
tmp = (sqrt((2.0 * (-4.0 * (A * (C * F))))) * sqrt((2.0 * C))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (pow(B_m, 2.0) <= 5e-186) {
tmp = sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 2e-72) {
tmp = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 1e-266) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(-4.0 * Float64(A * Float64(C * F))))) * sqrt(Float64(2.0 * C))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif ((B_m ^ 2.0) <= 5e-186) tmp = sqrt(Float64(F / Float64(-A))); elseif ((B_m ^ 2.0) <= 2e-72) tmp = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-266], N[(N[(N[Sqrt[N[(2.0 * N[(-4.0 * N[(A * N[(C * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-186], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-72], N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 10^{-266}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(-4 \cdot \left(A \cdot \left(C \cdot F\right)\right)\right)} \cdot \sqrt{2 \cdot C}}{-\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-72}:\\
\;\;\;\;\sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 9.9999999999999998e-267Initial program 17.0%
Simplified29.3%
associate-*r*29.3%
associate-+r+26.4%
hypot-undefine17.0%
unpow217.0%
unpow217.0%
+-commutative17.0%
sqrt-prod18.3%
*-commutative18.3%
associate-*r*18.3%
associate-+l+19.6%
Applied egg-rr31.2%
Taylor expanded in A around -inf 25.4%
Taylor expanded in B around 0 23.3%
if 9.9999999999999998e-267 < (pow.f64 B #s(literal 2 binary64)) < 5e-186Initial program 19.7%
Simplified24.9%
add-sqr-sqrt24.2%
sqrt-unprod20.3%
frac-times19.3%
Applied egg-rr19.3%
Taylor expanded in A around -inf 55.1%
associate-*r/55.1%
mul-1-neg55.1%
Simplified55.1%
if 5e-186 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-72Initial program 18.6%
Simplified26.4%
associate-*r*26.4%
associate-+r+25.3%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
+-commutative18.6%
sqrt-prod24.4%
*-commutative24.4%
associate-*r*24.4%
associate-+l+25.5%
Applied egg-rr39.0%
Taylor expanded in A around -inf 11.5%
Taylor expanded in F around 0 14.8%
associate-*r*14.8%
mul-1-neg14.8%
associate-/l*21.1%
fma-define21.1%
unpow221.1%
rem-square-sqrt21.3%
Simplified21.3%
if 1.9999999999999999e-72 < (pow.f64 B #s(literal 2 binary64)) Initial program 17.0%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
*-commutative13.6%
distribute-rgt-neg-in13.6%
unpow213.6%
unpow213.6%
hypot-define27.8%
Simplified27.8%
pow1/227.9%
*-commutative27.9%
unpow-prod-down36.8%
pow1/236.8%
pow1/236.8%
Applied egg-rr36.8%
Taylor expanded in C around 0 30.8%
Final simplification29.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 (* A (* C -4.0)))
(t_1 (* (* 4.0 A) C))
(t_2 (- t_1 (pow B_m 2.0)))
(t_3 (* 2.0 (* (- (pow B_m 2.0) t_1) F))))
(if (<= B_m 3.1e-262)
(* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0))
(if (<= B_m 2.3e-131)
(/ (sqrt (* t_3 (* 2.0 C))) t_2)
(if (<= B_m 1.9e-93)
(sqrt (/ F (- A)))
(if (<= B_m 4.8e-32)
(/
(* (sqrt (* 2.0 (* 2.0 C))) (* (sqrt F) (hypot B_m (sqrt t_0))))
(- (fma B_m B_m t_0)))
(if (<= B_m 4e+49)
(/ (sqrt (* t_3 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))) t_2)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(/ (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 = A * (C * -4.0);
double t_1 = (4.0 * A) * C;
double t_2 = t_1 - pow(B_m, 2.0);
double t_3 = 2.0 * ((pow(B_m, 2.0) - t_1) * F);
double tmp;
if (B_m <= 3.1e-262) {
tmp = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
} else if (B_m <= 2.3e-131) {
tmp = sqrt((t_3 * (2.0 * C))) / t_2;
} else if (B_m <= 1.9e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 4.8e-32) {
tmp = (sqrt((2.0 * (2.0 * C))) * (sqrt(F) * hypot(B_m, sqrt(t_0)))) / -fma(B_m, B_m, t_0);
} else if (B_m <= 4e+49) {
tmp = sqrt((t_3 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_2;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (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(A * Float64(C * -4.0)) t_1 = Float64(Float64(4.0 * A) * C) t_2 = Float64(t_1 - (B_m ^ 2.0)) t_3 = Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) tmp = 0.0 if (B_m <= 3.1e-262) tmp = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)); elseif (B_m <= 2.3e-131) tmp = Float64(sqrt(Float64(t_3 * Float64(2.0 * C))) / t_2); elseif (B_m <= 1.9e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 4.8e-32) tmp = Float64(Float64(sqrt(Float64(2.0 * Float64(2.0 * C))) * Float64(sqrt(F) * hypot(B_m, sqrt(t_0)))) / Float64(-fma(B_m, B_m, t_0))); elseif (B_m <= 4e+49) tmp = Float64(sqrt(Float64(t_3 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / t_2); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 3.1e-262], N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision], If[LessEqual[B$95$m, 2.3e-131], N[(N[Sqrt[N[(t$95$3 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[B$95$m, 1.9e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 4.8e-32], N[(N[(N[Sqrt[N[(2.0 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$0], $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-N[(B$95$m * B$95$m + t$95$0), $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 4e+49], N[(N[Sqrt[N[(t$95$3 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$2), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := A \cdot \left(C \cdot -4\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
t_2 := t\_1 - {B\_m}^{2}\\
t_3 := 2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\\
\mathbf{if}\;B\_m \leq 3.1 \cdot 10^{-262}:\\
\;\;\;\;\sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
\mathbf{elif}\;B\_m \leq 2.3 \cdot 10^{-131}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(2 \cdot C\right)}}{t\_2}\\
\mathbf{elif}\;B\_m \leq 1.9 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 4.8 \cdot 10^{-32}:\\
\;\;\;\;\frac{\sqrt{2 \cdot \left(2 \cdot C\right)} \cdot \left(\sqrt{F} \cdot \mathsf{hypot}\left(B\_m, \sqrt{t\_0}\right)\right)}{-\mathsf{fma}\left(B\_m, B\_m, t\_0\right)}\\
\mathbf{elif}\;B\_m \leq 4 \cdot 10^{+49}:\\
\;\;\;\;\frac{\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 3.0999999999999998e-262Initial program 15.5%
Simplified25.2%
associate-*r*25.2%
associate-+r+23.8%
hypot-undefine15.5%
unpow215.5%
unpow215.5%
+-commutative15.5%
sqrt-prod18.5%
*-commutative18.5%
associate-*r*18.5%
associate-+l+19.2%
Applied egg-rr30.3%
Taylor expanded in A around -inf 13.2%
Taylor expanded in F around 0 8.4%
associate-*r*8.4%
mul-1-neg8.4%
associate-/l*10.0%
fma-define10.0%
unpow210.0%
rem-square-sqrt10.1%
Simplified10.1%
if 3.0999999999999998e-262 < B < 2.30000000000000022e-131Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 2.30000000000000022e-131 < B < 1.8999999999999999e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 1.8999999999999999e-93 < B < 4.8000000000000003e-32Initial program 19.5%
Simplified35.3%
associate-*r*35.3%
associate-+r+35.3%
hypot-undefine19.5%
unpow219.5%
unpow219.5%
+-commutative19.5%
sqrt-prod27.1%
*-commutative27.1%
associate-*r*27.1%
associate-+l+28.4%
Applied egg-rr52.1%
Taylor expanded in A around -inf 27.3%
pow127.3%
sqrt-unprod27.4%
associate-*l*27.4%
associate-*r*27.4%
*-commutative27.4%
Applied egg-rr27.4%
unpow127.4%
associate-*l*35.2%
Simplified35.2%
sqrt-prod34.4%
associate-*l*34.4%
sqrt-prod42.3%
fma-undefine42.3%
add-sqr-sqrt42.3%
hypot-define42.3%
Applied egg-rr42.3%
associate-*r*42.2%
Simplified42.2%
if 4.8000000000000003e-32 < B < 3.99999999999999979e49Initial program 39.2%
Taylor expanded in A around -inf 20.2%
if 3.99999999999999979e49 < B Initial program 15.7%
Taylor expanded in A around 0 21.7%
mul-1-neg21.7%
*-commutative21.7%
distribute-rgt-neg-in21.7%
unpow221.7%
unpow221.7%
hypot-define55.3%
Simplified55.3%
pow1/255.3%
*-commutative55.3%
unpow-prod-down74.1%
pow1/274.1%
pow1/274.1%
Applied egg-rr74.1%
Final simplification27.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 (* (* 4.0 A) C))
(t_1 (- t_0 (pow B_m 2.0)))
(t_2 (* 2.0 (* (- (pow B_m 2.0) t_0) F))))
(if (<= B_m 1.45e-264)
(* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0))
(if (<= B_m 6.8e-129)
(/ (sqrt (* t_2 (* 2.0 C))) t_1)
(if (<= B_m 1.85e-93)
(sqrt (/ F (- A)))
(if (<= B_m 5e-32)
(/
(*
(hypot B_m (sqrt (* -4.0 (* A C))))
(* (sqrt F) (- (sqrt (* 4.0 C)))))
(fma B_m B_m (* A (* C -4.0))))
(if (<= B_m 4e+48)
(/ (sqrt (* t_2 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C)))) t_1)
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(/ (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 = 2.0 * ((pow(B_m, 2.0) - t_0) * F);
double tmp;
if (B_m <= 1.45e-264) {
tmp = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
} else if (B_m <= 6.8e-129) {
tmp = sqrt((t_2 * (2.0 * C))) / t_1;
} else if (B_m <= 1.85e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 5e-32) {
tmp = (hypot(B_m, sqrt((-4.0 * (A * C)))) * (sqrt(F) * -sqrt((4.0 * C)))) / fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 4e+48) {
tmp = sqrt((t_2 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_1;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (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(2.0 * Float64(Float64((B_m ^ 2.0) - t_0) * F)) tmp = 0.0 if (B_m <= 1.45e-264) tmp = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)); elseif (B_m <= 6.8e-129) tmp = Float64(sqrt(Float64(t_2 * Float64(2.0 * C))) / t_1); elseif (B_m <= 1.85e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 5e-32) tmp = Float64(Float64(hypot(B_m, sqrt(Float64(-4.0 * Float64(A * C)))) * Float64(sqrt(F) * Float64(-sqrt(Float64(4.0 * C))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); elseif (B_m <= 4e+48) tmp = Float64(sqrt(Float64(t_2 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C)))) / t_1); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(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[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$0), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[B$95$m, 1.45e-264], N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision], If[LessEqual[B$95$m, 6.8e-129], N[(N[Sqrt[N[(t$95$2 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[B$95$m, 1.85e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 5e-32], N[(N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[N[(-4.0 * N[(A * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(4.0 * C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 4e+48], N[(N[Sqrt[N[(t$95$2 * N[(N[(-0.5 * N[(N[Power[B$95$m, 2.0], $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision] + N[(2.0 * C), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := \left(4 \cdot A\right) \cdot C\\
t_1 := t\_0 - {B\_m}^{2}\\
t_2 := 2 \cdot \left(\left({B\_m}^{2} - t\_0\right) \cdot F\right)\\
\mathbf{if}\;B\_m \leq 1.45 \cdot 10^{-264}:\\
\;\;\;\;\sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
\mathbf{elif}\;B\_m \leq 6.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(2 \cdot C\right)}}{t\_1}\\
\mathbf{elif}\;B\_m \leq 1.85 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 5 \cdot 10^{-32}:\\
\;\;\;\;\frac{\mathsf{hypot}\left(B\_m, \sqrt{-4 \cdot \left(A \cdot C\right)}\right) \cdot \left(\sqrt{F} \cdot \left(-\sqrt{4 \cdot C}\right)\right)}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{elif}\;B\_m \leq 4 \cdot 10^{+48}:\\
\;\;\;\;\frac{\sqrt{t\_2 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 1.4499999999999999e-264Initial program 15.5%
Simplified25.2%
associate-*r*25.2%
associate-+r+23.8%
hypot-undefine15.5%
unpow215.5%
unpow215.5%
+-commutative15.5%
sqrt-prod18.5%
*-commutative18.5%
associate-*r*18.5%
associate-+l+19.2%
Applied egg-rr30.3%
Taylor expanded in A around -inf 13.2%
Taylor expanded in F around 0 8.4%
associate-*r*8.4%
mul-1-neg8.4%
associate-/l*10.0%
fma-define10.0%
unpow210.0%
rem-square-sqrt10.1%
Simplified10.1%
if 1.4499999999999999e-264 < B < 6.80000000000000026e-129Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 6.80000000000000026e-129 < B < 1.85000000000000001e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 1.85000000000000001e-93 < B < 5e-32Initial program 19.5%
Simplified35.3%
associate-*l*43.2%
sqrt-prod34.3%
fma-undefine34.3%
add-sqr-sqrt34.3%
hypot-define34.3%
associate-*r*34.3%
hypot-undefine26.4%
unpow226.4%
unpow226.4%
+-commutative26.4%
unpow226.4%
unpow226.4%
hypot-define34.3%
Applied egg-rr34.3%
Taylor expanded in A around -inf 34.4%
pow1/234.4%
*-commutative34.4%
unpow-prod-down42.3%
pow1/242.3%
associate-*r*42.3%
metadata-eval42.3%
pow1/242.3%
Applied egg-rr42.3%
if 5e-32 < B < 4.00000000000000018e48Initial program 39.2%
Taylor expanded in A around -inf 20.2%
if 4.00000000000000018e48 < B Initial program 15.7%
Taylor expanded in A around 0 21.7%
mul-1-neg21.7%
*-commutative21.7%
distribute-rgt-neg-in21.7%
unpow221.7%
unpow221.7%
hypot-define55.3%
Simplified55.3%
pow1/255.3%
*-commutative55.3%
unpow-prod-down74.1%
pow1/274.1%
pow1/274.1%
Applied egg-rr74.1%
Final simplification27.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))))
(t_1 (fma -4.0 (* A C) (pow B_m 2.0)))
(t_2 (* (* 4.0 A) C)))
(if (<= B_m 1.1e-263)
(* (sqrt (* C (/ F t_1))) (- 2.0))
(if (<= B_m 7.2e-129)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_2) F)) (* 2.0 C)))
(- t_2 (pow B_m 2.0)))
(if (<= B_m 2e-93)
(sqrt (/ F (- A)))
(if (<= B_m 2.3e-64)
(*
(sqrt (* F (/ (+ A (+ C (hypot B_m (- A C)))) t_1)))
(- (sqrt 2.0)))
(if (<= B_m 5.4e-18)
(* (sqrt (* F (* 2.0 t_0))) (/ (sqrt (* 2.0 C)) (- t_0)))
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(/ (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 t_1 = fma(-4.0, (A * C), pow(B_m, 2.0));
double t_2 = (4.0 * A) * C;
double tmp;
if (B_m <= 1.1e-263) {
tmp = sqrt((C * (F / t_1))) * -2.0;
} else if (B_m <= 7.2e-129) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_2) * F)) * (2.0 * C))) / (t_2 - pow(B_m, 2.0));
} else if (B_m <= 2e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 2.3e-64) {
tmp = sqrt((F * ((A + (C + hypot(B_m, (A - C)))) / t_1))) * -sqrt(2.0);
} else if (B_m <= 5.4e-18) {
tmp = sqrt((F * (2.0 * t_0))) * (sqrt((2.0 * C)) / -t_0);
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (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))) t_1 = fma(-4.0, Float64(A * C), (B_m ^ 2.0)) t_2 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 1.1e-263) tmp = Float64(sqrt(Float64(C * Float64(F / t_1))) * Float64(-2.0)); elseif (B_m <= 7.2e-129) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_2) * F)) * Float64(2.0 * C))) / Float64(t_2 - (B_m ^ 2.0))); elseif (B_m <= 2e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 2.3e-64) tmp = Float64(sqrt(Float64(F * Float64(Float64(A + Float64(C + hypot(B_m, Float64(A - C)))) / t_1))) * Float64(-sqrt(2.0))); elseif (B_m <= 5.4e-18) tmp = Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(sqrt(Float64(2.0 * C)) / Float64(-t_0))); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 1.1e-263], N[(N[Sqrt[N[(C * N[(F / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision], If[LessEqual[B$95$m, 7.2e-129], 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[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 2.3e-64], N[(N[Sqrt[N[(F * N[(N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision], If[LessEqual[B$95$m, 5.4e-18], N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)\\
t_2 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 1.1 \cdot 10^{-263}:\\
\;\;\;\;\sqrt{C \cdot \frac{F}{t\_1}} \cdot \left(-2\right)\\
\mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 2.3 \cdot 10^{-64}:\\
\;\;\;\;\sqrt{F \cdot \frac{A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)}{t\_1}} \cdot \left(-\sqrt{2}\right)\\
\mathbf{elif}\;B\_m \leq 5.4 \cdot 10^{-18}:\\
\;\;\;\;\sqrt{F \cdot \left(2 \cdot t\_0\right)} \cdot \frac{\sqrt{2 \cdot C}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 1.1e-263Initial program 15.5%
Simplified25.2%
associate-*r*25.2%
associate-+r+23.8%
hypot-undefine15.5%
unpow215.5%
unpow215.5%
+-commutative15.5%
sqrt-prod18.5%
*-commutative18.5%
associate-*r*18.5%
associate-+l+19.2%
Applied egg-rr30.3%
Taylor expanded in A around -inf 13.2%
Taylor expanded in F around 0 8.4%
associate-*r*8.4%
mul-1-neg8.4%
associate-/l*10.0%
fma-define10.0%
unpow210.0%
rem-square-sqrt10.1%
Simplified10.1%
if 1.1e-263 < B < 7.2e-129Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 7.2e-129 < B < 1.9999999999999998e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 1.9999999999999998e-93 < B < 2.3000000000000001e-64Initial program 31.0%
Taylor expanded in F around 0 16.7%
mul-1-neg16.7%
*-commutative16.7%
distribute-rgt-neg-in16.7%
associate-/l*27.4%
cancel-sign-sub-inv27.4%
metadata-eval27.4%
+-commutative27.4%
Simplified27.8%
if 2.3000000000000001e-64 < B < 5.39999999999999977e-18Initial program 27.5%
Simplified51.2%
associate-*r*51.2%
associate-+r+51.2%
hypot-undefine27.5%
unpow227.5%
unpow227.5%
+-commutative27.5%
sqrt-prod27.5%
*-commutative27.5%
associate-*r*27.5%
associate-+l+27.5%
Applied egg-rr75.1%
Taylor expanded in A around -inf 15.2%
associate-/l*15.4%
associate-*l*15.4%
associate-*r*15.4%
*-commutative15.4%
Applied egg-rr15.4%
if 5.39999999999999977e-18 < B Initial program 19.4%
Taylor expanded in A around 0 22.5%
mul-1-neg22.5%
*-commutative22.5%
distribute-rgt-neg-in22.5%
unpow222.5%
unpow222.5%
hypot-define48.8%
Simplified48.8%
pow1/248.8%
*-commutative48.8%
unpow-prod-down66.8%
pow1/266.8%
pow1/266.8%
Applied egg-rr66.8%
Final simplification27.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) 5e-186)
(sqrt (/ F (- A)))
(if (<= (pow B_m 2.0) 2e-72)
(* -2.0 (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double tmp;
if (pow(B_m, 2.0) <= 5e-186) {
tmp = sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
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) <= 5d-186) then
tmp = sqrt((f / -a))
else if ((b_m ** 2.0d0) <= 2d-72) then
tmp = (-2.0d0) * sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c)))))
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt(f) * -sqrt((b_m + c)))
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) <= 5e-186) {
tmp = Math.sqrt((F / -A));
} else if (Math.pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt((B_m + C)));
}
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) <= 5e-186: tmp = math.sqrt((F / -A)) elif math.pow(B_m, 2.0) <= 2e-72: tmp = -2.0 * math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt((B_m + C))) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-186) tmp = sqrt(Float64(F / Float64(-A))); elseif ((B_m ^ 2.0) <= 2e-72) tmp = Float64(-2.0 * sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); 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) <= 5e-186)
tmp = sqrt((F / -A));
elseif ((B_m ^ 2.0) <= 2e-72)
tmp = -2.0 * sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C)))));
else
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
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], 5e-186], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-72], N[(-2.0 * 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]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-72}:\\
\;\;\;\;-2 \cdot \sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 5e-186Initial program 17.6%
Simplified28.4%
add-sqr-sqrt13.2%
sqrt-unprod10.6%
frac-times8.7%
Applied egg-rr8.7%
Taylor expanded in A around -inf 22.0%
associate-*r/22.0%
mul-1-neg22.0%
Simplified22.0%
if 5e-186 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-72Initial program 18.6%
Simplified26.4%
associate-*r*26.4%
associate-+r+25.3%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
+-commutative18.6%
sqrt-prod24.4%
*-commutative24.4%
associate-*r*24.4%
associate-+l+25.5%
Applied egg-rr39.0%
Taylor expanded in A around -inf 11.5%
pow111.5%
sqrt-unprod12.2%
associate-*l*12.2%
associate-*r*12.2%
*-commutative12.2%
Applied egg-rr12.2%
unpow112.2%
associate-*l*15.0%
Simplified15.0%
Taylor expanded in F around 0 15.0%
if 1.9999999999999999e-72 < (pow.f64 B #s(literal 2 binary64)) Initial program 17.0%
Taylor expanded in A around 0 13.6%
mul-1-neg13.6%
*-commutative13.6%
distribute-rgt-neg-in13.6%
unpow213.6%
unpow213.6%
hypot-define27.8%
Simplified27.8%
pow1/227.9%
*-commutative27.9%
unpow-prod-down36.8%
pow1/236.8%
pow1/236.8%
Applied egg-rr36.8%
Taylor expanded in C around 0 30.8%
Final simplification25.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e-186)
(sqrt (/ F (- A)))
(if (<= (pow B_m 2.0) 2e-72)
(* -2.0 (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))))
(* (sqrt 2.0) (* (sqrt F) (- (sqrt (/ 1.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 (pow(B_m, 2.0) <= 5e-186) {
tmp = sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.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 ** 2.0d0) <= 5d-186) then
tmp = sqrt((f / -a))
else if ((b_m ** 2.0d0) <= 2d-72) then
tmp = (-2.0d0) * sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c)))))
else
tmp = sqrt(2.0d0) * (sqrt(f) * -sqrt((1.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 (Math.pow(B_m, 2.0) <= 5e-186) {
tmp = Math.sqrt((F / -A));
} else if (Math.pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = Math.sqrt(2.0) * (Math.sqrt(F) * -Math.sqrt((1.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 math.pow(B_m, 2.0) <= 5e-186: tmp = math.sqrt((F / -A)) elif math.pow(B_m, 2.0) <= 2e-72: tmp = -2.0 * math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) else: tmp = math.sqrt(2.0) * (math.sqrt(F) * -math.sqrt((1.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 ^ 2.0) <= 5e-186) tmp = sqrt(Float64(F / Float64(-A))); elseif ((B_m ^ 2.0) <= 2e-72) tmp = Float64(-2.0 * sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))); else tmp = Float64(sqrt(2.0) * Float64(sqrt(F) * Float64(-sqrt(Float64(1.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 ^ 2.0) <= 5e-186)
tmp = sqrt((F / -A));
elseif ((B_m ^ 2.0) <= 2e-72)
tmp = -2.0 * sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C)))));
else
tmp = sqrt(2.0) * (sqrt(F) * -sqrt((1.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[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-186], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-72], N[(-2.0 * 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]), $MachinePrecision], N[(N[Sqrt[2.0], $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(1.0 / 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 5 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-72}:\\
\;\;\;\;-2 \cdot \sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{2} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{\frac{1}{B\_m}}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 5e-186Initial program 17.6%
Simplified28.4%
add-sqr-sqrt13.2%
sqrt-unprod10.6%
frac-times8.7%
Applied egg-rr8.7%
Taylor expanded in A around -inf 22.0%
associate-*r/22.0%
mul-1-neg22.0%
Simplified22.0%
if 5e-186 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-72Initial program 18.6%
Simplified26.4%
associate-*r*26.4%
associate-+r+25.3%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
+-commutative18.6%
sqrt-prod24.4%
*-commutative24.4%
associate-*r*24.4%
associate-+l+25.5%
Applied egg-rr39.0%
Taylor expanded in A around -inf 11.5%
pow111.5%
sqrt-unprod12.2%
associate-*l*12.2%
associate-*r*12.2%
*-commutative12.2%
Applied egg-rr12.2%
unpow112.2%
associate-*l*15.0%
Simplified15.0%
Taylor expanded in F around 0 15.0%
if 1.9999999999999999e-72 < (pow.f64 B #s(literal 2 binary64)) Initial program 17.0%
Taylor expanded in B around inf 23.6%
mul-1-neg23.6%
*-commutative23.6%
distribute-rgt-neg-in23.6%
Simplified23.6%
pow1/223.6%
div-inv23.6%
unpow-prod-down30.9%
pow1/230.9%
Applied egg-rr30.9%
unpow1/230.9%
Simplified30.9%
Final simplification25.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(if (<= (pow B_m 2.0) 5e-186)
(sqrt (/ F (- A)))
(if (<= (pow B_m 2.0) 2e-72)
(* -2.0 (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))))
(- (* (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) <= 5e-186) {
tmp = sqrt((F / -A));
} else if (pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C)))));
} 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 ** 2.0d0) <= 5d-186) then
tmp = sqrt((f / -a))
else if ((b_m ** 2.0d0) <= 2d-72) then
tmp = (-2.0d0) * sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c)))))
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 (Math.pow(B_m, 2.0) <= 5e-186) {
tmp = Math.sqrt((F / -A));
} else if (Math.pow(B_m, 2.0) <= 2e-72) {
tmp = -2.0 * Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))));
} 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) <= 5e-186: tmp = math.sqrt((F / -A)) elif math.pow(B_m, 2.0) <= 2e-72: tmp = -2.0 * math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) 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) <= 5e-186) tmp = sqrt(Float64(F / Float64(-A))); elseif ((B_m ^ 2.0) <= 2e-72) tmp = Float64(-2.0 * sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))); else tmp = Float64(-Float64(sqrt(2.0) * Float64(sqrt(F) / 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) <= 5e-186)
tmp = sqrt((F / -A));
elseif ((B_m ^ 2.0) <= 2e-72)
tmp = -2.0 * sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C)))));
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], 5e-186], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e-72], N[(-2.0 * 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]), $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 5 \cdot 10^{-186}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{-72}:\\
\;\;\;\;-2 \cdot \sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2} \cdot \frac{\sqrt{F}}{\sqrt{B\_m}}\\
\end{array}
\end{array}
if (pow.f64 B #s(literal 2 binary64)) < 5e-186Initial program 17.6%
Simplified28.4%
add-sqr-sqrt13.2%
sqrt-unprod10.6%
frac-times8.7%
Applied egg-rr8.7%
Taylor expanded in A around -inf 22.0%
associate-*r/22.0%
mul-1-neg22.0%
Simplified22.0%
if 5e-186 < (pow.f64 B #s(literal 2 binary64)) < 1.9999999999999999e-72Initial program 18.6%
Simplified26.4%
associate-*r*26.4%
associate-+r+25.3%
hypot-undefine18.6%
unpow218.6%
unpow218.6%
+-commutative18.6%
sqrt-prod24.4%
*-commutative24.4%
associate-*r*24.4%
associate-+l+25.5%
Applied egg-rr39.0%
Taylor expanded in A around -inf 11.5%
pow111.5%
sqrt-unprod12.2%
associate-*l*12.2%
associate-*r*12.2%
*-commutative12.2%
Applied egg-rr12.2%
unpow112.2%
associate-*l*15.0%
Simplified15.0%
Taylor expanded in F around 0 15.0%
if 1.9999999999999999e-72 < (pow.f64 B #s(literal 2 binary64)) Initial program 17.0%
Taylor expanded in B around inf 23.6%
mul-1-neg23.6%
*-commutative23.6%
distribute-rgt-neg-in23.6%
Simplified23.6%
sqrt-div30.8%
Applied egg-rr30.8%
Final simplification25.3%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* A (* C -4.0))))
(t_1 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0)))
(t_2 (* (* 4.0 A) C)))
(if (<= B_m 1.6e-264)
t_1
(if (<= B_m 1.8e-129)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_2) F)) (* 2.0 C)))
(- t_2 (pow B_m 2.0)))
(if (<= B_m 2.8e-93)
(sqrt (/ F (- A)))
(if (<= B_m 2.3e-64)
t_1
(if (<= B_m 1.55e-17)
(* (sqrt (* F (* 2.0 t_0))) (/ (sqrt (* 2.0 C)) (- t_0)))
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(/ (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 t_1 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double t_2 = (4.0 * A) * C;
double tmp;
if (B_m <= 1.6e-264) {
tmp = t_1;
} else if (B_m <= 1.8e-129) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_2) * F)) * (2.0 * C))) / (t_2 - pow(B_m, 2.0));
} else if (B_m <= 2.8e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 2.3e-64) {
tmp = t_1;
} else if (B_m <= 1.55e-17) {
tmp = sqrt((F * (2.0 * t_0))) * (sqrt((2.0 * C)) / -t_0);
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (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))) t_1 = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) t_2 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 1.6e-264) tmp = t_1; elseif (B_m <= 1.8e-129) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_2) * F)) * Float64(2.0 * C))) / Float64(t_2 - (B_m ^ 2.0))); elseif (B_m <= 2.8e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 2.3e-64) tmp = t_1; elseif (B_m <= 1.55e-17) tmp = Float64(sqrt(Float64(F * Float64(2.0 * t_0))) * Float64(sqrt(Float64(2.0 * C)) / Float64(-t_0))); else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision]}, Block[{t$95$2 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 1.6e-264], t$95$1, If[LessEqual[B$95$m, 1.8e-129], 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[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$2 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.8e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 2.3e-64], t$95$1, If[LessEqual[B$95$m, 1.55e-17], N[(N[Sqrt[N[(F * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[N[(2.0 * C), $MachinePrecision]], $MachinePrecision] / (-t$95$0)), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_1 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
t_2 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 1.6 \cdot 10^{-264}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 1.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_2\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_2 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2.8 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 2.3 \cdot 10^{-64}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 1.55 \cdot 10^{-17}:\\
\;\;\;\;\sqrt{F \cdot \left(2 \cdot t\_0\right)} \cdot \frac{\sqrt{2 \cdot C}}{-t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 1.59999999999999998e-264 or 2.79999999999999998e-93 < B < 2.3000000000000001e-64Initial program 16.2%
Simplified25.5%
associate-*r*25.5%
associate-+r+24.1%
hypot-undefine16.2%
unpow216.2%
unpow216.2%
+-commutative16.2%
sqrt-prod19.7%
*-commutative19.7%
associate-*r*19.7%
associate-+l+20.5%
Applied egg-rr31.1%
Taylor expanded in A around -inf 14.0%
Taylor expanded in F around 0 9.4%
associate-*r*9.4%
mul-1-neg9.4%
associate-/l*11.5%
fma-define11.5%
unpow211.5%
rem-square-sqrt11.7%
Simplified11.7%
if 1.59999999999999998e-264 < B < 1.8e-129Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 1.8e-129 < B < 2.79999999999999998e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 2.3000000000000001e-64 < B < 1.5499999999999999e-17Initial program 27.5%
Simplified51.2%
associate-*r*51.2%
associate-+r+51.2%
hypot-undefine27.5%
unpow227.5%
unpow227.5%
+-commutative27.5%
sqrt-prod27.5%
*-commutative27.5%
associate-*r*27.5%
associate-+l+27.5%
Applied egg-rr75.1%
Taylor expanded in A around -inf 15.2%
associate-/l*15.4%
associate-*l*15.4%
associate-*r*15.4%
*-commutative15.4%
Applied egg-rr15.4%
if 1.5499999999999999e-17 < B Initial program 19.4%
Taylor expanded in A around 0 22.5%
mul-1-neg22.5%
*-commutative22.5%
distribute-rgt-neg-in22.5%
unpow222.5%
unpow222.5%
hypot-define48.8%
Simplified48.8%
pow1/248.8%
*-commutative48.8%
unpow-prod-down66.8%
pow1/266.8%
pow1/266.8%
Applied egg-rr66.8%
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
(let* ((t_0 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0)))
(t_1 (* (* 4.0 A) C)))
(if (<= B_m 1.95e-264)
t_0
(if (<= B_m 7.6e-129)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_1) F)) (* 2.0 C)))
(- t_1 (pow B_m 2.0)))
(if (<= B_m 2.9e-93)
(sqrt (/ F (- A)))
(if (<= B_m 3.6e-32)
t_0
(*
(* (sqrt F) (sqrt (+ C (hypot B_m C))))
(/ (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 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double t_1 = (4.0 * A) * C;
double tmp;
if (B_m <= 1.95e-264) {
tmp = t_0;
} else if (B_m <= 7.6e-129) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_1) * F)) * (2.0 * C))) / (t_1 - pow(B_m, 2.0));
} else if (B_m <= 2.9e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 3.6e-32) {
tmp = t_0;
} else {
tmp = (sqrt(F) * sqrt((C + hypot(B_m, C)))) * (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(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) t_1 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 1.95e-264) tmp = t_0; elseif (B_m <= 7.6e-129) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) * Float64(2.0 * C))) / Float64(t_1 - (B_m ^ 2.0))); elseif (B_m <= 2.9e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 3.6e-32) tmp = t_0; else tmp = Float64(Float64(sqrt(F) * sqrt(Float64(C + hypot(B_m, C)))) * Float64(sqrt(2.0) / Float64(-B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 1.95e-264], t$95$0, If[LessEqual[B$95$m, 7.6e-129], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.9e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 3.6e-32], t$95$0, N[(N[(N[Sqrt[F], $MachinePrecision] * N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(N[Sqrt[2.0], $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}
t_0 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 1.95 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 7.6 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_1 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2.9 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 3.6 \cdot 10^{-32}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{F} \cdot \sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right) \cdot \frac{\sqrt{2}}{-B\_m}\\
\end{array}
\end{array}
if B < 1.9499999999999999e-264 or 2.8999999999999998e-93 < B < 3.59999999999999993e-32Initial program 15.9%
Simplified25.5%
associate-*r*25.5%
associate-+r+24.2%
hypot-undefine15.9%
unpow215.9%
unpow215.9%
+-commutative15.9%
sqrt-prod19.3%
*-commutative19.3%
associate-*r*19.3%
associate-+l+20.0%
Applied egg-rr31.6%
Taylor expanded in A around -inf 13.7%
Taylor expanded in F around 0 9.8%
associate-*r*9.8%
mul-1-neg9.8%
associate-/l*11.9%
fma-define11.9%
unpow211.9%
rem-square-sqrt12.1%
Simplified12.1%
if 1.9499999999999999e-264 < B < 7.59999999999999969e-129Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 7.59999999999999969e-129 < B < 2.8999999999999998e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 3.59999999999999993e-32 < B Initial program 21.5%
Taylor expanded in A around 0 24.3%
mul-1-neg24.3%
*-commutative24.3%
distribute-rgt-neg-in24.3%
unpow224.3%
unpow224.3%
hypot-define50.5%
Simplified50.5%
pow1/250.5%
*-commutative50.5%
unpow-prod-down67.3%
pow1/267.3%
pow1/267.3%
Applied egg-rr67.3%
Final simplification29.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 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0))))
(if (<= B_m 1.45e-264)
t_0
(if (<= B_m 1.32e-132)
(/
(* 2.0 (sqrt (* C (* F (+ (pow B_m 2.0) (* -4.0 (* A C)))))))
(- (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 2.85e-93)
(sqrt (/ F (- A)))
(if (<= B_m 2.7e-33)
t_0
(if (<= B_m 2.65e+174)
(* (sqrt (* F (+ C (hypot B_m C)))) (/ -1.0 (/ B_m (sqrt 2.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double tmp;
if (B_m <= 1.45e-264) {
tmp = t_0;
} else if (B_m <= 1.32e-132) {
tmp = (2.0 * sqrt((C * (F * (pow(B_m, 2.0) + (-4.0 * (A * C))))))) / -fma(B_m, B_m, (A * (C * -4.0)));
} else if (B_m <= 2.85e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 2.7e-33) {
tmp = t_0;
} else if (B_m <= 2.65e+174) {
tmp = sqrt((F * (C + hypot(B_m, C)))) * (-1.0 / (B_m / sqrt(2.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) tmp = 0.0 if (B_m <= 1.45e-264) tmp = t_0; elseif (B_m <= 1.32e-132) tmp = Float64(Float64(2.0 * sqrt(Float64(C * Float64(F * Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C))))))) / Float64(-fma(B_m, B_m, Float64(A * Float64(C * -4.0))))); elseif (B_m <= 2.85e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 2.7e-33) tmp = t_0; elseif (B_m <= 2.65e+174) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B_m, C)))) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision]}, If[LessEqual[B$95$m, 1.45e-264], t$95$0, If[LessEqual[B$95$m, 1.32e-132], N[(N[(2.0 * N[Sqrt[N[(C * N[(F * N[(N[Power[B$95$m, 2.0], $MachinePrecision] + 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], If[LessEqual[B$95$m, 2.85e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 2.7e-33], t$95$0, If[LessEqual[B$95$m, 2.65e+174], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
\mathbf{if}\;B\_m \leq 1.45 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 1.32 \cdot 10^{-132}:\\
\;\;\;\;\frac{2 \cdot \sqrt{C \cdot \left(F \cdot \left({B\_m}^{2} + -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{elif}\;B\_m \leq 2.85 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 2.7 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 2.65 \cdot 10^{+174}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)} \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 1.4499999999999999e-264 or 2.85000000000000013e-93 < B < 2.7000000000000001e-33Initial program 15.9%
Simplified25.5%
associate-*r*25.5%
associate-+r+24.2%
hypot-undefine15.9%
unpow215.9%
unpow215.9%
+-commutative15.9%
sqrt-prod19.3%
*-commutative19.3%
associate-*r*19.3%
associate-+l+20.0%
Applied egg-rr31.6%
Taylor expanded in A around -inf 13.7%
Taylor expanded in F around 0 9.8%
associate-*r*9.8%
mul-1-neg9.8%
associate-/l*11.9%
fma-define11.9%
unpow211.9%
rem-square-sqrt12.1%
Simplified12.1%
if 1.4499999999999999e-264 < B < 1.32000000000000004e-132Initial program 18.3%
Simplified28.6%
associate-*r*28.6%
associate-+r+25.6%
hypot-undefine18.3%
unpow218.3%
unpow218.3%
+-commutative18.3%
sqrt-prod19.7%
*-commutative19.7%
associate-*r*19.7%
associate-+l+20.3%
Applied egg-rr30.7%
Taylor expanded in A around -inf 28.7%
pow128.7%
sqrt-unprod28.2%
associate-*l*28.2%
associate-*r*28.2%
*-commutative28.2%
Applied egg-rr28.2%
unpow128.2%
associate-*l*19.3%
Simplified19.3%
Taylor expanded in F around 0 27.9%
if 1.32000000000000004e-132 < B < 2.85000000000000013e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 2.7000000000000001e-33 < B < 2.6499999999999999e174Initial program 36.6%
Taylor expanded in A around 0 39.9%
mul-1-neg39.9%
*-commutative39.9%
distribute-rgt-neg-in39.9%
unpow239.9%
unpow239.9%
hypot-define45.5%
Simplified45.5%
clear-num45.5%
inv-pow45.5%
Applied egg-rr45.5%
unpow-145.5%
Simplified45.5%
if 2.6499999999999999e174 < B Initial program 0.0%
Taylor expanded in A around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
distribute-rgt-neg-in2.2%
unpow22.2%
unpow22.2%
hypot-define57.6%
Simplified57.6%
pow1/257.6%
*-commutative57.6%
unpow-prod-down87.0%
pow1/287.0%
pow1/287.0%
Applied egg-rr87.0%
Taylor expanded in C around 0 77.7%
Final simplification26.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 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= B_m 7e-260)
t_0
(if (<= B_m 7.6e-129)
(* (sqrt (* (* 2.0 C) (* F (* 2.0 t_1)))) (/ -1.0 t_1))
(if (<= B_m 3e-93)
(sqrt (/ F (- A)))
(if (<= B_m 3e-36)
t_0
(if (<= B_m 2.2e+174)
(* (sqrt (* F (+ C (hypot B_m C)))) (/ -1.0 (/ B_m (sqrt 2.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (B_m <= 7e-260) {
tmp = t_0;
} else if (B_m <= 7.6e-129) {
tmp = sqrt(((2.0 * C) * (F * (2.0 * t_1)))) * (-1.0 / t_1);
} else if (B_m <= 3e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 3e-36) {
tmp = t_0;
} else if (B_m <= 2.2e+174) {
tmp = sqrt((F * (C + hypot(B_m, C)))) * (-1.0 / (B_m / sqrt(2.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (B_m <= 7e-260) tmp = t_0; elseif (B_m <= 7.6e-129) tmp = Float64(sqrt(Float64(Float64(2.0 * C) * Float64(F * Float64(2.0 * t_1)))) * Float64(-1.0 / t_1)); elseif (B_m <= 3e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 3e-36) tmp = t_0; elseif (B_m <= 2.2e+174) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B_m, C)))) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $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, 7e-260], t$95$0, If[LessEqual[B$95$m, 7.6e-129], N[(N[Sqrt[N[(N[(2.0 * C), $MachinePrecision] * N[(F * N[(2.0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 3e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 3e-36], t$95$0, If[LessEqual[B$95$m, 2.2e+174], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;B\_m \leq 7 \cdot 10^{-260}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 7.6 \cdot 10^{-129}:\\
\;\;\;\;\sqrt{\left(2 \cdot C\right) \cdot \left(F \cdot \left(2 \cdot t\_1\right)\right)} \cdot \frac{-1}{t\_1}\\
\mathbf{elif}\;B\_m \leq 3 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 3 \cdot 10^{-36}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 2.2 \cdot 10^{+174}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)} \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 6.9999999999999999e-260 or 3.0000000000000001e-93 < B < 3.0000000000000002e-36Initial program 15.9%
Simplified25.5%
associate-*r*25.5%
associate-+r+24.2%
hypot-undefine15.9%
unpow215.9%
unpow215.9%
+-commutative15.9%
sqrt-prod19.3%
*-commutative19.3%
associate-*r*19.3%
associate-+l+20.0%
Applied egg-rr31.6%
Taylor expanded in A around -inf 13.7%
Taylor expanded in F around 0 9.8%
associate-*r*9.8%
mul-1-neg9.8%
associate-/l*11.9%
fma-define11.9%
unpow211.9%
rem-square-sqrt12.1%
Simplified12.1%
if 6.9999999999999999e-260 < B < 7.59999999999999969e-129Initial program 18.3%
Simplified28.6%
associate-*r*28.6%
associate-+r+25.6%
hypot-undefine18.3%
unpow218.3%
unpow218.3%
+-commutative18.3%
sqrt-prod19.7%
*-commutative19.7%
associate-*r*19.7%
associate-+l+20.3%
Applied egg-rr30.7%
Taylor expanded in A around -inf 28.7%
div-inv28.6%
sqrt-unprod28.1%
associate-*l*28.1%
associate-*r*28.1%
*-commutative28.1%
Applied egg-rr28.1%
if 7.59999999999999969e-129 < B < 3.0000000000000001e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 3.0000000000000002e-36 < B < 2.2000000000000002e174Initial program 36.6%
Taylor expanded in A around 0 39.9%
mul-1-neg39.9%
*-commutative39.9%
distribute-rgt-neg-in39.9%
unpow239.9%
unpow239.9%
hypot-define45.5%
Simplified45.5%
clear-num45.5%
inv-pow45.5%
Applied egg-rr45.5%
unpow-145.5%
Simplified45.5%
if 2.2000000000000002e174 < B Initial program 0.0%
Taylor expanded in A around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
distribute-rgt-neg-in2.2%
unpow22.2%
unpow22.2%
hypot-define57.6%
Simplified57.6%
pow1/257.6%
*-commutative57.6%
unpow-prod-down87.0%
pow1/287.0%
pow1/287.0%
Applied egg-rr87.0%
Taylor expanded in C around 0 77.7%
Final simplification26.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 (* (sqrt (* C (/ F (fma -4.0 (* A C) (pow B_m 2.0))))) (- 2.0)))
(t_1 (* (* 4.0 A) C)))
(if (<= B_m 1.45e-264)
t_0
(if (<= B_m 6.8e-129)
(/
(sqrt (* (* 2.0 (* (- (pow B_m 2.0) t_1) F)) (* 2.0 C)))
(- t_1 (pow B_m 2.0)))
(if (<= B_m 2.1e-93)
(sqrt (/ F (- A)))
(if (<= B_m 7.6e-33)
t_0
(if (<= B_m 1.8e+174)
(* (sqrt (* F (+ C (hypot B_m C)))) (/ -1.0 (/ B_m (sqrt 2.0))))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ B_m C))))))))))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((C * (F / fma(-4.0, (A * C), pow(B_m, 2.0))))) * -2.0;
double t_1 = (4.0 * A) * C;
double tmp;
if (B_m <= 1.45e-264) {
tmp = t_0;
} else if (B_m <= 6.8e-129) {
tmp = sqrt(((2.0 * ((pow(B_m, 2.0) - t_1) * F)) * (2.0 * C))) / (t_1 - pow(B_m, 2.0));
} else if (B_m <= 2.1e-93) {
tmp = sqrt((F / -A));
} else if (B_m <= 7.6e-33) {
tmp = t_0;
} else if (B_m <= 1.8e+174) {
tmp = sqrt((F * (C + hypot(B_m, C)))) * (-1.0 / (B_m / sqrt(2.0)));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((B_m + C)));
}
return tmp;
}
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = Float64(sqrt(Float64(C * Float64(F / fma(-4.0, Float64(A * C), (B_m ^ 2.0))))) * Float64(-2.0)) t_1 = Float64(Float64(4.0 * A) * C) tmp = 0.0 if (B_m <= 1.45e-264) tmp = t_0; elseif (B_m <= 6.8e-129) tmp = Float64(sqrt(Float64(Float64(2.0 * Float64(Float64((B_m ^ 2.0) - t_1) * F)) * Float64(2.0 * C))) / Float64(t_1 - (B_m ^ 2.0))); elseif (B_m <= 2.1e-93) tmp = sqrt(Float64(F / Float64(-A))); elseif (B_m <= 7.6e-33) tmp = t_0; elseif (B_m <= 1.8e+174) tmp = Float64(sqrt(Float64(F * Float64(C + hypot(B_m, C)))) * Float64(-1.0 / Float64(B_m / sqrt(2.0)))); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(B_m + C))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[N[(C * N[(F / N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-2.0)), $MachinePrecision]}, Block[{t$95$1 = N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]}, If[LessEqual[B$95$m, 1.45e-264], t$95$0, If[LessEqual[B$95$m, 6.8e-129], N[(N[Sqrt[N[(N[(2.0 * N[(N[(N[Power[B$95$m, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision] * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[(t$95$1 - N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[B$95$m, 2.1e-93], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 7.6e-33], t$95$0, If[LessEqual[B$95$m, 1.8e+174], N[(N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(-1.0 / N[(B$95$m / N[Sqrt[2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\begin{array}{l}
t_0 := \sqrt{C \cdot \frac{F}{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}} \cdot \left(-2\right)\\
t_1 := \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;B\_m \leq 1.45 \cdot 10^{-264}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 6.8 \cdot 10^{-129}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot \left(\left({B\_m}^{2} - t\_1\right) \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_1 - {B\_m}^{2}}\\
\mathbf{elif}\;B\_m \leq 2.1 \cdot 10^{-93}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{elif}\;B\_m \leq 7.6 \cdot 10^{-33}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;B\_m \leq 1.8 \cdot 10^{+174}:\\
\;\;\;\;\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)} \cdot \frac{-1}{\frac{B\_m}{\sqrt{2}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m + C}\right)\right)\\
\end{array}
\end{array}
if B < 1.4499999999999999e-264 or 2.1000000000000001e-93 < B < 7.59999999999999988e-33Initial program 15.9%
Simplified25.5%
associate-*r*25.5%
associate-+r+24.2%
hypot-undefine15.9%
unpow215.9%
unpow215.9%
+-commutative15.9%
sqrt-prod19.3%
*-commutative19.3%
associate-*r*19.3%
associate-+l+20.0%
Applied egg-rr31.6%
Taylor expanded in A around -inf 13.7%
Taylor expanded in F around 0 9.8%
associate-*r*9.8%
mul-1-neg9.8%
associate-/l*11.9%
fma-define11.9%
unpow211.9%
rem-square-sqrt12.1%
Simplified12.1%
if 1.4499999999999999e-264 < B < 6.80000000000000026e-129Initial program 18.3%
Taylor expanded in A around -inf 28.2%
if 6.80000000000000026e-129 < B < 2.1000000000000001e-93Initial program 13.4%
Simplified13.8%
add-sqr-sqrt13.2%
sqrt-unprod13.4%
frac-times11.8%
Applied egg-rr11.8%
Taylor expanded in A around -inf 55.4%
associate-*r/55.4%
mul-1-neg55.4%
Simplified55.4%
if 7.59999999999999988e-33 < B < 1.8000000000000001e174Initial program 36.6%
Taylor expanded in A around 0 39.9%
mul-1-neg39.9%
*-commutative39.9%
distribute-rgt-neg-in39.9%
unpow239.9%
unpow239.9%
hypot-define45.5%
Simplified45.5%
clear-num45.5%
inv-pow45.5%
Applied egg-rr45.5%
unpow-145.5%
Simplified45.5%
if 1.8000000000000001e174 < B Initial program 0.0%
Taylor expanded in A around 0 2.2%
mul-1-neg2.2%
*-commutative2.2%
distribute-rgt-neg-in2.2%
unpow22.2%
unpow22.2%
hypot-define57.6%
Simplified57.6%
pow1/257.6%
*-commutative57.6%
unpow-prod-down87.0%
pow1/287.0%
pow1/287.0%
Applied egg-rr87.0%
Taylor expanded in C around 0 77.7%
Final simplification26.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 (<= C -1.35e-199)
(/ (sqrt F) (sqrt (- A)))
(if (<= C 1.85e+101)
(- (pow (* 2.0 (/ F B_m)) 0.5))
(if (<= C 8.4e+216)
(* -2.0 (sqrt (/ (* C F) (+ (pow B_m 2.0) (* -4.0 (* A C))))))
(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) {
double tmp;
if (C <= -1.35e-199) {
tmp = sqrt(F) / sqrt(-A);
} else if (C <= 1.85e+101) {
tmp = -pow((2.0 * (F / B_m)), 0.5);
} else if (C <= 8.4e+216) {
tmp = -2.0 * sqrt(((C * F) / (pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = sqrt((F / -A));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= (-1.35d-199)) then
tmp = sqrt(f) / sqrt(-a)
else if (c <= 1.85d+101) then
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
else if (c <= 8.4d+216) then
tmp = (-2.0d0) * sqrt(((c * f) / ((b_m ** 2.0d0) + ((-4.0d0) * (a * c)))))
else
tmp = sqrt((f / -a))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= -1.35e-199) {
tmp = Math.sqrt(F) / Math.sqrt(-A);
} else if (C <= 1.85e+101) {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
} else if (C <= 8.4e+216) {
tmp = -2.0 * Math.sqrt(((C * F) / (Math.pow(B_m, 2.0) + (-4.0 * (A * C)))));
} else {
tmp = Math.sqrt((F / -A));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= -1.35e-199: tmp = math.sqrt(F) / math.sqrt(-A) elif C <= 1.85e+101: tmp = -math.pow((2.0 * (F / B_m)), 0.5) elif C <= 8.4e+216: tmp = -2.0 * math.sqrt(((C * F) / (math.pow(B_m, 2.0) + (-4.0 * (A * C))))) else: tmp = math.sqrt((F / -A)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= -1.35e-199) tmp = Float64(sqrt(F) / sqrt(Float64(-A))); elseif (C <= 1.85e+101) tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); elseif (C <= 8.4e+216) tmp = Float64(-2.0 * sqrt(Float64(Float64(C * F) / Float64((B_m ^ 2.0) + Float64(-4.0 * Float64(A * C)))))); else tmp = sqrt(Float64(F / Float64(-A))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= -1.35e-199)
tmp = sqrt(F) / sqrt(-A);
elseif (C <= 1.85e+101)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
elseif (C <= 8.4e+216)
tmp = -2.0 * sqrt(((C * F) / ((B_m ^ 2.0) + (-4.0 * (A * C)))));
else
tmp = sqrt((F / -A));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, -1.35e-199], N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 1.85e+101], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), If[LessEqual[C, 8.4e+216], N[(-2.0 * 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]), $MachinePrecision], 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])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq -1.35 \cdot 10^{-199}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{-A}}\\
\mathbf{elif}\;C \leq 1.85 \cdot 10^{+101}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\mathbf{elif}\;C \leq 8.4 \cdot 10^{+216}:\\
\;\;\;\;-2 \cdot \sqrt{\frac{C \cdot F}{{B\_m}^{2} + -4 \cdot \left(A \cdot C\right)}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\end{array}
\end{array}
if C < -1.34999999999999995e-199Initial program 9.6%
Simplified15.3%
add-sqr-sqrt2.6%
sqrt-unprod2.8%
frac-times2.2%
Applied egg-rr2.3%
Taylor expanded in A around -inf 10.6%
associate-*r/10.6%
mul-1-neg10.6%
Simplified10.6%
frac-2neg10.6%
sqrt-div10.2%
add-sqr-sqrt0.0%
sqrt-unprod0.7%
sqr-neg0.7%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod6.8%
sqr-neg6.8%
sqrt-unprod10.2%
add-sqr-sqrt10.2%
Applied egg-rr10.2%
if -1.34999999999999995e-199 < C < 1.8499999999999999e101Initial program 26.8%
Taylor expanded in B around inf 16.8%
mul-1-neg16.8%
*-commutative16.8%
distribute-rgt-neg-in16.8%
Simplified16.8%
distribute-rgt-neg-out16.8%
pow1/216.8%
pow1/217.0%
pow-prod-down17.1%
Applied egg-rr17.1%
if 1.8499999999999999e101 < C < 8.40000000000000006e216Initial program 34.9%
Simplified61.5%
associate-*r*61.5%
associate-+r+61.5%
hypot-undefine34.9%
unpow234.9%
unpow234.9%
+-commutative34.9%
sqrt-prod40.1%
*-commutative40.1%
associate-*r*40.1%
associate-+l+40.1%
Applied egg-rr66.6%
Taylor expanded in A around -inf 66.6%
pow166.6%
sqrt-unprod61.5%
associate-*l*61.5%
associate-*r*61.5%
*-commutative61.5%
Applied egg-rr61.5%
unpow161.5%
associate-*l*50.7%
Simplified50.7%
Taylor expanded in F around 0 35.8%
if 8.40000000000000006e216 < C Initial program 1.6%
Simplified9.0%
add-sqr-sqrt4.5%
sqrt-unprod4.7%
frac-times0.6%
Applied egg-rr0.6%
Taylor expanded in A around -inf 44.0%
associate-*r/44.0%
mul-1-neg44.0%
Simplified44.0%
Final simplification18.2%
B_m = (fabs.f64 B)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (sqrt (/ F (- A)))))
(if (<= F -7.5e-307)
t_0
(if (<= F 5e-44)
(* (/ (sqrt 2.0) B_m) (- (sqrt (* B_m F))))
(if (or (<= F 8e+182) (not (<= F 1.25e+204)))
(- (sqrt (* 2.0 (/ F B_m))))
t_0)))))B_m = fabs(B);
assert(A < B_m && B_m < C && C < F);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt((F / -A));
double tmp;
if (F <= -7.5e-307) {
tmp = t_0;
} else if (F <= 5e-44) {
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
} else if ((F <= 8e+182) || !(F <= 1.25e+204)) {
tmp = -sqrt((2.0 * (F / B_m)));
} else {
tmp = t_0;
}
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) :: tmp
t_0 = sqrt((f / -a))
if (f <= (-7.5d-307)) then
tmp = t_0
else if (f <= 5d-44) then
tmp = (sqrt(2.0d0) / b_m) * -sqrt((b_m * f))
else if ((f <= 8d+182) .or. (.not. (f <= 1.25d+204))) then
tmp = -sqrt((2.0d0 * (f / b_m)))
else
tmp = t_0
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 = Math.sqrt((F / -A));
double tmp;
if (F <= -7.5e-307) {
tmp = t_0;
} else if (F <= 5e-44) {
tmp = (Math.sqrt(2.0) / B_m) * -Math.sqrt((B_m * F));
} else if ((F <= 8e+182) || !(F <= 1.25e+204)) {
tmp = -Math.sqrt((2.0 * (F / B_m)));
} else {
tmp = t_0;
}
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.sqrt((F / -A)) tmp = 0 if F <= -7.5e-307: tmp = t_0 elif F <= 5e-44: tmp = (math.sqrt(2.0) / B_m) * -math.sqrt((B_m * F)) elif (F <= 8e+182) or not (F <= 1.25e+204): tmp = -math.sqrt((2.0 * (F / B_m))) else: tmp = t_0 return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) t_0 = sqrt(Float64(F / Float64(-A))) tmp = 0.0 if (F <= -7.5e-307) tmp = t_0; elseif (F <= 5e-44) tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(-sqrt(Float64(B_m * F)))); elseif ((F <= 8e+182) || !(F <= 1.25e+204)) tmp = Float64(-sqrt(Float64(2.0 * Float64(F / B_m)))); else tmp = t_0; 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 = sqrt((F / -A));
tmp = 0.0;
if (F <= -7.5e-307)
tmp = t_0;
elseif (F <= 5e-44)
tmp = (sqrt(2.0) / B_m) * -sqrt((B_m * F));
elseif ((F <= 8e+182) || ~((F <= 1.25e+204)))
tmp = -sqrt((2.0 * (F / B_m)));
else
tmp = t_0;
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[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[F, -7.5e-307], t$95$0, If[LessEqual[F, 5e-44], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * (-N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[Or[LessEqual[F, 8e+182], N[Not[LessEqual[F, 1.25e+204]], $MachinePrecision]], (-N[Sqrt[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), t$95$0]]]]
\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 := \sqrt{\frac{F}{-A}}\\
\mathbf{if}\;F \leq -7.5 \cdot 10^{-307}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;F \leq 5 \cdot 10^{-44}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(-\sqrt{B\_m \cdot F}\right)\\
\mathbf{elif}\;F \leq 8 \cdot 10^{+182} \lor \neg \left(F \leq 1.25 \cdot 10^{+204}\right):\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if F < -7.5000000000000006e-307 or 8.0000000000000005e182 < F < 1.25000000000000002e204Initial program 18.9%
Simplified30.8%
add-sqr-sqrt30.0%
sqrt-unprod24.2%
frac-times18.7%
Applied egg-rr18.7%
Taylor expanded in A around -inf 43.5%
associate-*r/43.5%
mul-1-neg43.5%
Simplified43.5%
if -7.5000000000000006e-307 < F < 5.00000000000000039e-44Initial program 22.6%
Taylor expanded in A around 0 10.6%
mul-1-neg10.6%
*-commutative10.6%
distribute-rgt-neg-in10.6%
unpow210.6%
unpow210.6%
hypot-define23.8%
Simplified23.8%
Taylor expanded in C around 0 19.9%
if 5.00000000000000039e-44 < F < 8.0000000000000005e182 or 1.25000000000000002e204 < F Initial program 12.0%
Taylor expanded in B around inf 18.9%
mul-1-neg18.9%
*-commutative18.9%
distribute-rgt-neg-in18.9%
Simplified18.9%
pow118.9%
distribute-rgt-neg-out18.9%
pow1/218.9%
pow1/219.3%
pow-prod-down19.4%
Applied egg-rr19.4%
unpow119.4%
unpow1/219.0%
Simplified19.0%
Final simplification23.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 (<= C -4.6e-197) (/ (sqrt F) (sqrt (- A))) (if (<= C 2.8e+126) (- (pow (* 2.0 (/ F B_m)) 0.5)) (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) {
double tmp;
if (C <= -4.6e-197) {
tmp = sqrt(F) / sqrt(-A);
} else if (C <= 2.8e+126) {
tmp = -pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = sqrt((F / -A));
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (c <= (-4.6d-197)) then
tmp = sqrt(f) / sqrt(-a)
else if (c <= 2.8d+126) then
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
else
tmp = sqrt((f / -a))
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (C <= -4.6e-197) {
tmp = Math.sqrt(F) / Math.sqrt(-A);
} else if (C <= 2.8e+126) {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
} else {
tmp = Math.sqrt((F / -A));
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if C <= -4.6e-197: tmp = math.sqrt(F) / math.sqrt(-A) elif C <= 2.8e+126: tmp = -math.pow((2.0 * (F / B_m)), 0.5) else: tmp = math.sqrt((F / -A)) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if (C <= -4.6e-197) tmp = Float64(sqrt(F) / sqrt(Float64(-A))); elseif (C <= 2.8e+126) tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); else tmp = sqrt(Float64(F / Float64(-A))); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if (C <= -4.6e-197)
tmp = sqrt(F) / sqrt(-A);
elseif (C <= 2.8e+126)
tmp = -((2.0 * (F / B_m)) ^ 0.5);
else
tmp = sqrt((F / -A));
end
tmp_2 = tmp;
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := If[LessEqual[C, -4.6e-197], N[(N[Sqrt[F], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision], If[LessEqual[C, 2.8e+126], (-N[Power[N[(2.0 * N[(F / B$95$m), $MachinePrecision]), $MachinePrecision], 0.5], $MachinePrecision]), 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])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq -4.6 \cdot 10^{-197}:\\
\;\;\;\;\frac{\sqrt{F}}{\sqrt{-A}}\\
\mathbf{elif}\;C \leq 2.8 \cdot 10^{+126}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\end{array}
\end{array}
if C < -4.6000000000000001e-197Initial program 9.6%
Simplified15.3%
add-sqr-sqrt2.6%
sqrt-unprod2.8%
frac-times2.2%
Applied egg-rr2.3%
Taylor expanded in A around -inf 10.6%
associate-*r/10.6%
mul-1-neg10.6%
Simplified10.6%
frac-2neg10.6%
sqrt-div10.2%
add-sqr-sqrt0.0%
sqrt-unprod0.7%
sqr-neg0.7%
sqrt-unprod0.0%
add-sqr-sqrt0.0%
add-sqr-sqrt0.0%
sqrt-unprod6.8%
sqr-neg6.8%
sqrt-unprod10.2%
add-sqr-sqrt10.2%
Applied egg-rr10.2%
if -4.6000000000000001e-197 < C < 2.80000000000000009e126Initial program 27.9%
Taylor expanded in B around inf 16.5%
mul-1-neg16.5%
*-commutative16.5%
distribute-rgt-neg-in16.5%
Simplified16.5%
distribute-rgt-neg-out16.5%
pow1/216.5%
pow1/216.6%
pow-prod-down16.8%
Applied egg-rr16.8%
if 2.80000000000000009e126 < C Initial program 11.5%
Simplified27.8%
add-sqr-sqrt7.8%
sqrt-unprod8.2%
frac-times5.5%
Applied egg-rr5.5%
Taylor expanded in A around -inf 35.6%
associate-*r/35.6%
mul-1-neg35.6%
Simplified35.6%
Final simplification17.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 (or (<= C -2.15e-193) (not (<= C 7.6e+122))) (sqrt (/ F (- A))) (- (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) {
double tmp;
if ((C <= -2.15e-193) || !(C <= 7.6e+122)) {
tmp = sqrt((F / -A));
} else {
tmp = -pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = abs(b)
NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function.
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if ((c <= (-2.15d-193)) .or. (.not. (c <= 7.6d+122))) then
tmp = sqrt((f / -a))
else
tmp = -((2.0d0 * (f / b_m)) ** 0.5d0)
end if
code = tmp
end function
B_m = Math.abs(B);
assert A < B_m && B_m < C && C < F;
public static double code(double A, double B_m, double C, double F) {
double tmp;
if ((C <= -2.15e-193) || !(C <= 7.6e+122)) {
tmp = Math.sqrt((F / -A));
} else {
tmp = -Math.pow((2.0 * (F / B_m)), 0.5);
}
return tmp;
}
B_m = math.fabs(B) [A, B_m, C, F] = sort([A, B_m, C, F]) def code(A, B_m, C, F): tmp = 0 if (C <= -2.15e-193) or not (C <= 7.6e+122): tmp = math.sqrt((F / -A)) else: tmp = -math.pow((2.0 * (F / B_m)), 0.5) return tmp
B_m = abs(B) A, B_m, C, F = sort([A, B_m, C, F]) function code(A, B_m, C, F) tmp = 0.0 if ((C <= -2.15e-193) || !(C <= 7.6e+122)) tmp = sqrt(Float64(F / Float64(-A))); else tmp = Float64(-(Float64(2.0 * Float64(F / B_m)) ^ 0.5)); end return tmp end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp_2 = code(A, B_m, C, F)
tmp = 0.0;
if ((C <= -2.15e-193) || ~((C <= 7.6e+122)))
tmp = sqrt((F / -A));
else
tmp = -((2.0 * (F / B_m)) ^ 0.5);
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[Or[LessEqual[C, -2.15e-193], N[Not[LessEqual[C, 7.6e+122]], $MachinePrecision]], N[Sqrt[N[(F / (-A)), $MachinePrecision]], $MachinePrecision], (-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])\\
\\
\begin{array}{l}
\mathbf{if}\;C \leq -2.15 \cdot 10^{-193} \lor \neg \left(C \leq 7.6 \cdot 10^{+122}\right):\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-{\left(2 \cdot \frac{F}{B\_m}\right)}^{0.5}\\
\end{array}
\end{array}
if C < -2.1500000000000001e-193 or 7.5999999999999996e122 < C Initial program 10.1%
Simplified18.7%
add-sqr-sqrt4.0%
sqrt-unprod4.3%
frac-times3.1%
Applied egg-rr3.1%
Taylor expanded in A around -inf 17.4%
associate-*r/17.4%
mul-1-neg17.4%
Simplified17.4%
if -2.1500000000000001e-193 < C < 7.5999999999999996e122Initial program 27.9%
Taylor expanded in B around inf 16.5%
mul-1-neg16.5%
*-commutative16.5%
distribute-rgt-neg-in16.5%
Simplified16.5%
distribute-rgt-neg-out16.5%
pow1/216.5%
pow1/216.6%
pow-prod-down16.8%
Applied egg-rr16.8%
Final simplification17.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 (or (<= C -9e-198) (not (<= C 6.5e+121))) (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 ((C <= -9e-198) || !(C <= 6.5e+121)) {
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 ((c <= (-9d-198)) .or. (.not. (c <= 6.5d+121))) 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 ((C <= -9e-198) || !(C <= 6.5e+121)) {
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 (C <= -9e-198) or not (C <= 6.5e+121): 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 ((C <= -9e-198) || !(C <= 6.5e+121)) tmp = 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 ((C <= -9e-198) || ~((C <= 6.5e+121)))
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[Or[LessEqual[C, -9e-198], N[Not[LessEqual[C, 6.5e+121]], $MachinePrecision]], 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}\;C \leq -9 \cdot 10^{-198} \lor \neg \left(C \leq 6.5 \cdot 10^{+121}\right):\\
\;\;\;\;\sqrt{\frac{F}{-A}}\\
\mathbf{else}:\\
\;\;\;\;-\sqrt{2 \cdot \frac{F}{B\_m}}\\
\end{array}
\end{array}
if C < -8.9999999999999996e-198 or 6.50000000000000019e121 < C Initial program 10.1%
Simplified18.7%
add-sqr-sqrt4.0%
sqrt-unprod4.3%
frac-times3.1%
Applied egg-rr3.1%
Taylor expanded in A around -inf 17.4%
associate-*r/17.4%
mul-1-neg17.4%
Simplified17.4%
if -8.9999999999999996e-198 < C < 6.50000000000000019e121Initial program 27.9%
Taylor expanded in B around inf 16.5%
mul-1-neg16.5%
*-commutative16.5%
distribute-rgt-neg-in16.5%
Simplified16.5%
pow116.5%
distribute-rgt-neg-out16.5%
pow1/216.5%
pow1/216.6%
pow-prod-down16.8%
Applied egg-rr16.8%
unpow116.8%
unpow1/216.6%
Simplified16.6%
Final simplification17.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 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 17.4%
Simplified25.2%
add-sqr-sqrt6.7%
sqrt-unprod6.0%
frac-times4.8%
Applied egg-rr4.8%
Taylor expanded in A around -inf 13.1%
associate-*r/13.1%
mul-1-neg13.1%
Simplified13.1%
Final simplification13.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 sqrt(Float64(F / A)) end
B_m = abs(B);
A, B_m, C, F = num2cell(sort([A, B_m, C, F])){:}
function tmp = code(A, B_m, C, F)
tmp = sqrt((F / A));
end
B_m = N[Abs[B], $MachinePrecision] NOTE: A, B_m, C, and F should be sorted in increasing order before calling this function. code[A_, B$95$m_, C_, F_] := N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
[A, B_m, C, F] = \mathsf{sort}([A, B_m, C, F])\\
\\
\sqrt{\frac{F}{A}}
\end{array}
Initial program 17.4%
Simplified25.2%
add-sqr-sqrt6.7%
sqrt-unprod6.0%
frac-times4.8%
Applied egg-rr4.8%
Taylor expanded in A around -inf 13.1%
associate-*r/13.1%
mul-1-neg13.1%
Simplified13.1%
*-un-lft-identity13.1%
add-sqr-sqrt6.8%
sqrt-unprod6.2%
sqr-neg6.2%
sqrt-unprod1.0%
add-sqr-sqrt1.1%
Applied egg-rr1.1%
*-lft-identity1.1%
Simplified1.1%
Final simplification1.1%
herbie shell --seed 2024072
(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))))