
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 17 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (A B C F)
:precision binary64
(let* ((t_0 (- (pow B 2.0) (* (* 4.0 A) C))))
(/
(-
(sqrt
(*
(* 2.0 (* t_0 F))
(+ (+ A C) (sqrt (+ (pow (- A C) 2.0) (pow B 2.0)))))))
t_0)))
double code(double A, double B, double C, double F) {
double t_0 = pow(B, 2.0) - ((4.0 * A) * C);
return -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((pow((A - C), 2.0) + pow(B, 2.0)))))) / t_0;
}
real(8) function code(a, b, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: t_0
t_0 = (b ** 2.0d0) - ((4.0d0 * a) * c)
code = -sqrt(((2.0d0 * (t_0 * f)) * ((a + c) + sqrt((((a - c) ** 2.0d0) + (b ** 2.0d0)))))) / t_0
end function
public static double code(double A, double B, double C, double F) {
double t_0 = Math.pow(B, 2.0) - ((4.0 * A) * C);
return -Math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + Math.sqrt((Math.pow((A - C), 2.0) + Math.pow(B, 2.0)))))) / t_0;
}
def code(A, B, C, F): t_0 = math.pow(B, 2.0) - ((4.0 * A) * C) return -math.sqrt(((2.0 * (t_0 * F)) * ((A + C) + math.sqrt((math.pow((A - C), 2.0) + math.pow(B, 2.0)))))) / t_0
function code(A, B, C, F) t_0 = Float64((B ^ 2.0) - Float64(Float64(4.0 * A) * C)) return Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(Float64(A + C) + sqrt(Float64((Float64(A - C) ^ 2.0) + (B ^ 2.0))))))) / t_0) end
function tmp = code(A, B, C, F) t_0 = (B ^ 2.0) - ((4.0 * A) * C); tmp = -sqrt(((2.0 * (t_0 * F)) * ((A + C) + sqrt((((A - C) ^ 2.0) + (B ^ 2.0)))))) / t_0; end
code[A_, B_, C_, F_] := Block[{t$95$0 = N[(N[Power[B, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(N[Power[N[(A - C), $MachinePrecision], 2.0], $MachinePrecision] + N[Power[B, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {B}^{2} - \left(4 \cdot A\right) \cdot C\\
\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(\left(A + C\right) + \sqrt{{\left(A - C\right)}^{2} + {B}^{2}}\right)}}{t\_0}
\end{array}
\end{array}
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (hypot (- A C) B_m))
(t_1 (* (* A C) -4.0))
(t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_3 (* 2.0 (* t_2 F)))
(t_4
(/
(-
(sqrt
(* t_3 (+ (+ A C) (sqrt (+ (pow B_m 2.0) (pow (- A C) 2.0)))))))
t_2))
(t_5 (fma B_m B_m (* A (* C -4.0)))))
(if (<= t_4 (- INFINITY))
(/
(*
(sqrt (+ A (+ C t_0)))
(* (hypot B_m (sqrt t_1)) (- (sqrt (* 2.0 F)))))
t_5)
(if (<= t_4 -2e-189)
(/
(* (sqrt (* (fma B_m B_m t_1) (* 2.0 F))) (- (sqrt (+ (+ A C) t_0))))
t_5)
(if (<= t_4 0.0)
(/ (- (sqrt (* t_3 (+ (* -0.5 (/ (pow B_m 2.0) A)) (* 2.0 C))))) t_2)
(if (<= t_4 INFINITY)
(sqrt
(*
2.0
(/
F
(/
(fma -4.0 (* A C) (pow B_m 2.0))
(+ (+ A C) (hypot B_m (- A C)))))))
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(- (/ (sqrt 2.0) B_m)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = hypot((A - C), B_m);
double t_1 = (A * C) * -4.0;
double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_3 = 2.0 * (t_2 * F);
double t_4 = -sqrt((t_3 * ((A + C) + sqrt((pow(B_m, 2.0) + pow((A - C), 2.0)))))) / t_2;
double t_5 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = (sqrt((A + (C + t_0))) * (hypot(B_m, sqrt(t_1)) * -sqrt((2.0 * F)))) / t_5;
} else if (t_4 <= -2e-189) {
tmp = (sqrt((fma(B_m, B_m, t_1) * (2.0 * F))) * -sqrt(((A + C) + t_0))) / t_5;
} else if (t_4 <= 0.0) {
tmp = -sqrt((t_3 * ((-0.5 * (pow(B_m, 2.0) / A)) + (2.0 * C)))) / t_2;
} else if (t_4 <= ((double) INFINITY)) {
tmp = sqrt((2.0 * (F / (fma(-4.0, (A * C), pow(B_m, 2.0)) / ((A + C) + hypot(B_m, (A - C)))))));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * -(sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = hypot(Float64(A - C), B_m) t_1 = Float64(Float64(A * C) * -4.0) t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(2.0 * Float64(t_2 * F)) t_4 = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(A + C) + sqrt(Float64((B_m ^ 2.0) + (Float64(A - C) ^ 2.0))))))) / t_2) t_5 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(Float64(sqrt(Float64(A + Float64(C + t_0))) * Float64(hypot(B_m, sqrt(t_1)) * Float64(-sqrt(Float64(2.0 * F))))) / t_5); elseif (t_4 <= -2e-189) tmp = Float64(Float64(sqrt(Float64(fma(B_m, B_m, t_1) * Float64(2.0 * F))) * Float64(-sqrt(Float64(Float64(A + C) + t_0)))) / t_5); elseif (t_4 <= 0.0) tmp = Float64(Float64(-sqrt(Float64(t_3 * Float64(Float64(-0.5 * Float64((B_m ^ 2.0) / A)) + Float64(2.0 * C))))) / t_2); elseif (t_4 <= Inf) tmp = sqrt(Float64(2.0 * Float64(F / Float64(fma(-4.0, Float64(A * C), (B_m ^ 2.0)) / Float64(Float64(A + C) + hypot(B_m, Float64(A - C))))))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-Float64(sqrt(2.0) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]}, Block[{t$95$1 = N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[((-N[Sqrt[N[(t$95$3 * 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$2), $MachinePrecision]}, Block[{t$95$5 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(N[Sqrt[N[(A + N[(C + t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[Sqrt[B$95$m ^ 2 + N[Sqrt[t$95$1], $MachinePrecision] ^ 2], $MachinePrecision] * (-N[Sqrt[N[(2.0 * F), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[t$95$4, -2e-189], N[(N[(N[Sqrt[N[(N[(B$95$m * B$95$m + t$95$1), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(N[(A + C), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / t$95$5), $MachinePrecision], If[LessEqual[t$95$4, 0.0], 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], If[LessEqual[t$95$4, Infinity], N[Sqrt[N[(2.0 * N[(F / N[(N[(-4.0 * N[(A * C), $MachinePrecision] + N[Power[B$95$m, 2.0], $MachinePrecision]), $MachinePrecision] / N[(N[(A + C), $MachinePrecision] + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision])), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{hypot}\left(A - C, B\_m\right)\\
t_1 := \left(A \cdot C\right) \cdot -4\\
t_2 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := 2 \cdot \left(t\_2 \cdot F\right)\\
t_4 := \frac{-\sqrt{t\_3 \cdot \left(\left(A + C\right) + \sqrt{{B\_m}^{2} + {\left(A - C\right)}^{2}}\right)}}{t\_2}\\
t_5 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\frac{\sqrt{A + \left(C + t\_0\right)} \cdot \left(\mathsf{hypot}\left(B\_m, \sqrt{t\_1}\right) \cdot \left(-\sqrt{2 \cdot F}\right)\right)}{t\_5}\\
\mathbf{elif}\;t\_4 \leq -2 \cdot 10^{-189}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B\_m, B\_m, t\_1\right) \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{\left(A + C\right) + t\_0}\right)}{t\_5}\\
\mathbf{elif}\;t\_4 \leq 0:\\
\;\;\;\;\frac{-\sqrt{t\_3 \cdot \left(-0.5 \cdot \frac{{B\_m}^{2}}{A} + 2 \cdot C\right)}}{t\_2}\\
\mathbf{elif}\;t\_4 \leq \infty:\\
\;\;\;\;\sqrt{2 \cdot \frac{F}{\frac{\mathsf{fma}\left(-4, A \cdot C, {B\_m}^{2}\right)}{\left(A + C\right) + \mathsf{hypot}\left(B\_m, A - C\right)}}}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{B\_m}\right)\\
\end{array}
\end{array}
if (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -inf.0Initial program 3.3%
Simplified12.9%
sqrt-prod25.4%
sqrt-prod52.6%
fma-udef52.6%
add-sqr-sqrt43.6%
hypot-def43.6%
associate-*r*43.6%
*-commutative43.6%
hypot-udef23.9%
unpow223.9%
unpow223.9%
+-commutative23.9%
unpow223.9%
unpow223.9%
hypot-def43.6%
Applied egg-rr43.6%
if -inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -2.00000000000000014e-189Initial program 97.4%
Simplified97.5%
add-exp-log92.8%
hypot-udef92.8%
unpow292.8%
unpow292.8%
+-commutative92.8%
unpow292.8%
unpow292.8%
hypot-def92.8%
Applied egg-rr92.8%
pow1/292.8%
*-commutative92.8%
rem-exp-log97.5%
unpow-prod-down97.9%
pow1/297.9%
associate-+r+97.9%
pow1/297.9%
associate-*r*97.9%
*-commutative97.9%
Applied egg-rr97.9%
if -2.00000000000000014e-189 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < -0.0Initial program 3.7%
Taylor expanded in A around -inf 38.9%
if -0.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) < +inf.0Initial program 66.0%
Simplified75.7%
add-sqr-sqrt75.0%
sqrt-unprod71.0%
frac-times41.8%
Applied egg-rr41.8%
Taylor expanded in F around 0 61.3%
associate-/l*66.1%
fma-def66.1%
associate-+r+66.1%
unpow266.1%
unpow266.1%
hypot-def90.2%
Simplified90.2%
if +inf.0 < (/.f64 (neg.f64 (sqrt.f64 (*.f64 (*.f64 2 (*.f64 (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C)) F)) (+.f64 (+.f64 A C) (sqrt.f64 (+.f64 (pow.f64 (-.f64 A C) 2) (pow.f64 B 2))))))) (-.f64 (pow.f64 B 2) (*.f64 (*.f64 4 A) C))) Initial program 0.0%
Taylor expanded in C around 0 2.0%
mul-1-neg2.0%
*-commutative2.0%
distribute-rgt-neg-in2.0%
*-commutative2.0%
+-commutative2.0%
unpow22.0%
unpow22.0%
hypot-def18.1%
Simplified18.1%
sqrt-prod29.9%
Applied egg-rr29.9%
Final simplification51.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0))
(t_3 (/ (sqrt 2.0) B_m))
(t_4 (* t_3 (- (sqrt (* F (+ C (hypot B_m C))))))))
(if (<= (pow B_m 2.0) 5e-273)
t_2
(if (<= (pow B_m 2.0) 5e-175)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= (pow B_m 2.0) 5e-39)
t_4
(if (<= (pow B_m 2.0) 4e+46)
t_2
(if (<= (pow B_m 2.0) 5e+218)
t_4
(* t_3 (* (sqrt (+ B_m C)) (- (sqrt F)))))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
double t_3 = sqrt(2.0) / B_m;
double t_4 = t_3 * -sqrt((F * (C + hypot(B_m, C))));
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 5e-175) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (pow(B_m, 2.0) <= 5e-39) {
tmp = t_4;
} else if (pow(B_m, 2.0) <= 4e+46) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 5e+218) {
tmp = t_4;
} else {
tmp = t_3 * (sqrt((B_m + C)) * -sqrt(F));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0) t_3 = Float64(sqrt(2.0) / B_m) t_4 = Float64(t_3 * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = t_2; elseif ((B_m ^ 2.0) <= 5e-175) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif ((B_m ^ 2.0) <= 5e-39) tmp = t_4; elseif ((B_m ^ 2.0) <= 4e+46) tmp = t_2; elseif ((B_m ^ 2.0) <= 5e+218) tmp = t_4; else tmp = Float64(t_3 * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-175], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-39], t$95$4, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+46], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e+218], t$95$4, N[(t$95$3 * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\
t_3 := \frac{\sqrt{2}}{B\_m}\\
t_4 := t\_3 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-175}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-39}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+46}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{+218}:\\
\;\;\;\;t\_4\\
\mathbf{else}:\\
\;\;\;\;t\_3 \cdot \left(\sqrt{B\_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273 or 4.9999999999999998e-39 < (pow.f64 B 2) < 4e46Initial program 26.9%
Taylor expanded in A around -inf 35.3%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 5e-175Initial program 26.7%
Simplified40.0%
Taylor expanded in A around inf 40.8%
distribute-rgt1-in40.8%
metadata-eval40.8%
mul0-lft40.8%
Simplified40.8%
if 5e-175 < (pow.f64 B 2) < 4.9999999999999998e-39 or 4e46 < (pow.f64 B 2) < 4.99999999999999983e218Initial program 40.9%
Taylor expanded in A around 0 23.2%
mul-1-neg23.2%
distribute-rgt-neg-in23.2%
*-commutative23.2%
unpow223.2%
unpow223.2%
hypot-def25.0%
Simplified25.0%
if 4.99999999999999983e218 < (pow.f64 B 2) Initial program 6.2%
Taylor expanded in A around 0 9.7%
mul-1-neg9.7%
distribute-rgt-neg-in9.7%
*-commutative9.7%
unpow29.7%
unpow29.7%
hypot-def27.4%
Simplified27.4%
sqrt-prod45.8%
Applied egg-rr45.8%
Taylor expanded in C around 0 43.0%
Final simplification34.9%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0))))
(t_2 (/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0))
(t_3 (/ (sqrt 2.0) B_m)))
(if (<= (pow B_m 2.0) 5e-273)
t_2
(if (<= (pow B_m 2.0) 5e-175)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(if (<= (pow B_m 2.0) 5e-39)
(* t_3 (- (sqrt (* F (+ C (hypot B_m C))))))
(if (<= (pow B_m 2.0) 4e+46)
t_2
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (- t_3))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double t_2 = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
double t_3 = sqrt(2.0) / B_m;
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = t_2;
} else if (pow(B_m, 2.0) <= 5e-175) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else if (pow(B_m, 2.0) <= 5e-39) {
tmp = t_3 * -sqrt((F * (C + hypot(B_m, C))));
} else if (pow(B_m, 2.0) <= 4e+46) {
tmp = t_2;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * -t_3;
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) t_2 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0) t_3 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = t_2; elseif ((B_m ^ 2.0) <= 5e-175) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); elseif ((B_m ^ 2.0) <= 5e-39) tmp = Float64(t_3 * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); elseif ((B_m ^ 2.0) <= 4e+46) tmp = t_2; else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-t_3)); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], t$95$2, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-175], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-39], N[(t$95$3 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 4e+46], t$95$2, N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-t$95$3)), $MachinePrecision]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
t_2 := \frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\
t_3 := \frac{\sqrt{2}}{B\_m}\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-175}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-39}:\\
\;\;\;\;t\_3 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{elif}\;{B\_m}^{2} \leq 4 \cdot 10^{+46}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(-t\_3\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273 or 4.9999999999999998e-39 < (pow.f64 B 2) < 4e46Initial program 26.9%
Taylor expanded in A around -inf 35.3%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 5e-175Initial program 26.7%
Simplified40.0%
Taylor expanded in A around inf 40.8%
distribute-rgt1-in40.8%
metadata-eval40.8%
mul0-lft40.8%
Simplified40.8%
if 5e-175 < (pow.f64 B 2) < 4.9999999999999998e-39Initial program 48.4%
Taylor expanded in A around 0 26.9%
mul-1-neg26.9%
distribute-rgt-neg-in26.9%
*-commutative26.9%
unpow226.9%
unpow226.9%
hypot-def27.4%
Simplified27.4%
if 4e46 < (pow.f64 B 2) Initial program 17.5%
Taylor expanded in C around 0 13.0%
mul-1-neg13.0%
*-commutative13.0%
distribute-rgt-neg-in13.0%
*-commutative13.0%
+-commutative13.0%
unpow213.0%
unpow213.0%
hypot-def25.7%
Simplified25.7%
sqrt-prod35.8%
Applied egg-rr35.8%
Final simplification35.2%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (fma B_m B_m (* (* A C) -4.0)))
(t_1 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_2 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e-273)
(/ (- (sqrt (* (* 2.0 (* t_1 F)) (* 2.0 C)))) t_1)
(if (<= (pow B_m 2.0) 1e-233)
(/ (- (sqrt (* (* t_2 (* 2.0 F)) (+ A A)))) t_2)
(if (<= (pow B_m 2.0) 2e+114)
(/
(- (sqrt (* t_0 (* (+ (+ A C) (hypot (- A C) B_m)) (* 2.0 F)))))
t_0)
(*
(* (sqrt (+ A (hypot B_m A))) (sqrt F))
(- (/ (sqrt 2.0) B_m))))))))B_m = fabs(B);
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 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_2 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = -sqrt(((2.0 * (t_1 * F)) * (2.0 * C))) / t_1;
} else if (pow(B_m, 2.0) <= 1e-233) {
tmp = -sqrt(((t_2 * (2.0 * F)) * (A + A))) / t_2;
} else if (pow(B_m, 2.0) <= 2e+114) {
tmp = -sqrt((t_0 * (((A + C) + hypot((A - C), B_m)) * (2.0 * F)))) / t_0;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * -(sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = fma(B_m, B_m, Float64(Float64(A * C) * -4.0)) t_1 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_2 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_1 * F)) * Float64(2.0 * C)))) / t_1); elseif ((B_m ^ 2.0) <= 1e-233) tmp = Float64(Float64(-sqrt(Float64(Float64(t_2 * Float64(2.0 * F)) * Float64(A + A)))) / t_2); elseif ((B_m ^ 2.0) <= 2e+114) tmp = Float64(Float64(-sqrt(Float64(t_0 * Float64(Float64(Float64(A + C) + hypot(Float64(A - C), B_m)) * Float64(2.0 * F))))) / t_0); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-Float64(sqrt(2.0) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(B$95$m * B$95$m + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$1 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 1e-233], N[((-N[Sqrt[N[(N[(t$95$2 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+114], N[((-N[Sqrt[N[(t$95$0 * N[(N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision])), $MachinePrecision]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(B\_m, B\_m, \left(A \cdot C\right) \cdot -4\right)\\
t_1 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_2 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t\_1 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_1}\\
\mathbf{elif}\;{B\_m}^{2} \leq 10^{-233}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_2 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t\_2}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+114}:\\
\;\;\;\;\frac{-\sqrt{t\_0 \cdot \left(\left(\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)\right) \cdot \left(2 \cdot F\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{B\_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273Initial program 23.5%
Taylor expanded in A around -inf 32.7%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 9.99999999999999958e-234Initial program 27.1%
Simplified30.5%
Taylor expanded in A around inf 43.0%
distribute-rgt1-in43.0%
metadata-eval43.0%
mul0-lft43.0%
Simplified43.0%
if 9.99999999999999958e-234 < (pow.f64 B 2) < 2e114Initial program 44.0%
Simplified52.3%
add-exp-log49.4%
hypot-udef42.5%
unpow242.5%
unpow242.5%
+-commutative42.5%
unpow242.5%
unpow242.5%
hypot-def49.4%
Applied egg-rr49.4%
distribute-frac-neg49.4%
associate-*l*48.5%
associate-*r*48.5%
*-commutative48.5%
rem-exp-log51.4%
associate-+r+50.4%
associate-*r*50.4%
*-commutative50.4%
Applied egg-rr50.4%
if 2e114 < (pow.f64 B 2) Initial program 10.7%
Taylor expanded in C around 0 11.3%
mul-1-neg11.3%
*-commutative11.3%
distribute-rgt-neg-in11.3%
*-commutative11.3%
+-commutative11.3%
unpow211.3%
unpow211.3%
hypot-def26.1%
Simplified26.1%
sqrt-prod37.9%
Applied egg-rr37.9%
Final simplification40.7%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C))))
(if (<= (pow B_m 2.0) 0.0)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 2e+113)
(/
(*
(sqrt (* (fma B_m B_m (* (* A C) -4.0)) (* 2.0 F)))
(- (sqrt (+ (+ A C) (hypot (- A C) B_m)))))
(fma B_m B_m (* A (* C -4.0))))
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (- (/ (sqrt 2.0) B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double tmp;
if (pow(B_m, 2.0) <= 0.0) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+113) {
tmp = (sqrt((fma(B_m, B_m, ((A * C) * -4.0)) * (2.0 * F))) * -sqrt(((A + C) + hypot((A - C), B_m)))) / fma(B_m, B_m, (A * (C * -4.0)));
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * -(sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) tmp = 0.0 if ((B_m ^ 2.0) <= 0.0) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 2e+113) tmp = Float64(Float64(sqrt(Float64(fma(B_m, B_m, Float64(Float64(A * C) * -4.0)) * Float64(2.0 * F))) * Float64(-sqrt(Float64(Float64(A + C) + hypot(Float64(A - C), B_m))))) / fma(B_m, B_m, Float64(A * Float64(C * -4.0)))); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-Float64(sqrt(2.0) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 0.0], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+113], N[(N[(N[Sqrt[N[(N[(B$95$m * B$95$m + N[(N[(A * C), $MachinePrecision] * -4.0), $MachinePrecision]), $MachinePrecision] * N[(2.0 * F), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[N[(N[(A + C), $MachinePrecision] + N[Sqrt[N[(A - C), $MachinePrecision] ^ 2 + B$95$m ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision] / N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision])), $MachinePrecision]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
\mathbf{if}\;{B\_m}^{2} \leq 0:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\frac{\sqrt{\mathsf{fma}\left(B\_m, B\_m, \left(A \cdot C\right) \cdot -4\right) \cdot \left(2 \cdot F\right)} \cdot \left(-\sqrt{\left(A + C\right) + \mathsf{hypot}\left(A - C, B\_m\right)}\right)}{\mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{B\_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 0.0Initial program 24.3%
Taylor expanded in A around -inf 34.9%
if 0.0 < (pow.f64 B 2) < 2e113Initial program 38.9%
Simplified45.8%
add-exp-log43.2%
hypot-udef37.5%
unpow237.5%
unpow237.5%
+-commutative37.5%
unpow237.5%
unpow237.5%
hypot-def43.2%
Applied egg-rr43.2%
pow1/243.3%
*-commutative43.3%
rem-exp-log45.8%
unpow-prod-down51.8%
pow1/251.8%
associate-+r+51.1%
pow1/251.1%
associate-*r*51.1%
*-commutative51.1%
Applied egg-rr51.1%
if 2e113 < (pow.f64 B 2) Initial program 11.7%
Taylor expanded in C around 0 12.2%
mul-1-neg12.2%
*-commutative12.2%
distribute-rgt-neg-in12.2%
*-commutative12.2%
+-commutative12.2%
unpow212.2%
unpow212.2%
hypot-def26.8%
Simplified26.8%
sqrt-prod38.5%
Applied egg-rr38.5%
Final simplification42.8%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e-273)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 2e+113)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A (+ C (hypot B_m (- A C))))))) t_1)
(* (* (sqrt (+ A (hypot B_m A))) (sqrt F)) (- (/ (sqrt 2.0) B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 2e+113) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + (C + hypot(B_m, (A - C)))))) / t_1;
} else {
tmp = (sqrt((A + hypot(B_m, A))) * sqrt(F)) * -(sqrt(2.0) / B_m);
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 2e+113) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + Float64(C + hypot(B_m, Float64(A - C))))))) / t_1); else tmp = Float64(Float64(sqrt(Float64(A + hypot(B_m, A))) * sqrt(F)) * Float64(-Float64(sqrt(2.0) / B_m))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 2e+113], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + N[(C + N[Sqrt[B$95$m ^ 2 + N[(A - C), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[F], $MachinePrecision]), $MachinePrecision] * (-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision])), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 2 \cdot 10^{+113}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + \left(C + \mathsf{hypot}\left(B\_m, A - C\right)\right)\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\left(\sqrt{A + \mathsf{hypot}\left(B\_m, A\right)} \cdot \sqrt{F}\right) \cdot \left(-\frac{\sqrt{2}}{B\_m}\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273Initial program 23.5%
Taylor expanded in A around -inf 32.7%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 2e113Initial program 41.2%
Simplified48.9%
if 2e113 < (pow.f64 B 2) Initial program 11.7%
Taylor expanded in C around 0 12.2%
mul-1-neg12.2%
*-commutative12.2%
distribute-rgt-neg-in12.2%
*-commutative12.2%
+-commutative12.2%
unpow212.2%
unpow212.2%
hypot-def26.8%
Simplified26.8%
sqrt-prod38.5%
Applied egg-rr38.5%
Final simplification40.7%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C))) (t_1 (* 2.0 (* t_0 F))))
(if (<= (pow B_m 2.0) 5e-273)
(/ (- (sqrt (* t_1 (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 5e-105)
(/ (- (sqrt (* t_1 (+ A (hypot B_m A))))) t_0)
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ C (hypot B_m C))))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = 2.0 * (t_0 * F);
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = -sqrt((t_1 * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 5e-105) {
tmp = -sqrt((t_1 * (A + hypot(B_m, A)))) / t_0;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((C + hypot(B_m, C))));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = 2.0 * (t_0 * F);
double tmp;
if (Math.pow(B_m, 2.0) <= 5e-273) {
tmp = -Math.sqrt((t_1 * (2.0 * C))) / t_0;
} else if (Math.pow(B_m, 2.0) <= 5e-105) {
tmp = -Math.sqrt((t_1 * (A + Math.hypot(B_m, A)))) / t_0;
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt((C + Math.hypot(B_m, C))));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.pow(B_m, 2.0) - ((4.0 * A) * C) t_1 = 2.0 * (t_0 * F) tmp = 0 if math.pow(B_m, 2.0) <= 5e-273: tmp = -math.sqrt((t_1 * (2.0 * C))) / t_0 elif math.pow(B_m, 2.0) <= 5e-105: tmp = -math.sqrt((t_1 * (A + math.hypot(B_m, A)))) / t_0 else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt((C + math.hypot(B_m, C)))) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = Float64(2.0 * Float64(t_0 * F)) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 5e-105) tmp = Float64(Float64(-sqrt(Float64(t_1 * Float64(A + hypot(B_m, A))))) / t_0); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(C + hypot(B_m, C)))))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = (B_m ^ 2.0) - ((4.0 * A) * C); t_1 = 2.0 * (t_0 * F); tmp = 0.0; if ((B_m ^ 2.0) <= 5e-273) tmp = -sqrt((t_1 * (2.0 * C))) / t_0; elseif ((B_m ^ 2.0) <= 5e-105) tmp = -sqrt((t_1 * (A + hypot(B_m, A)))) / t_0; else tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((C + hypot(B_m, C)))); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], N[((-N[Sqrt[N[(t$95$1 * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-105], N[((-N[Sqrt[N[(t$95$1 * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := 2 \cdot \left(t\_0 \cdot F\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(2 \cdot C\right)}}{t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\frac{-\sqrt{t\_1 \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)}}{t\_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273Initial program 23.5%
Taylor expanded in A around -inf 32.7%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 4.99999999999999963e-105Initial program 41.5%
Taylor expanded in C around 0 44.1%
+-commutative44.1%
unpow244.1%
unpow244.1%
hypot-def46.6%
Simplified46.6%
if 4.99999999999999963e-105 < (pow.f64 B 2) Initial program 21.4%
Taylor expanded in A around 0 13.2%
mul-1-neg13.2%
distribute-rgt-neg-in13.2%
*-commutative13.2%
unpow213.2%
unpow213.2%
hypot-def22.6%
Simplified22.6%
sqrt-prod31.3%
Applied egg-rr31.3%
Final simplification34.3%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_1 (fma B_m B_m (* A (* C -4.0)))))
(if (<= (pow B_m 2.0) 5e-273)
(/ (- (sqrt (* (* 2.0 (* t_0 F)) (* 2.0 C)))) t_0)
(if (<= (pow B_m 2.0) 5e-175)
(/ (- (sqrt (* (* t_1 (* 2.0 F)) (+ A A)))) t_1)
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt (+ C (hypot B_m C))))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_1 = fma(B_m, B_m, (A * (C * -4.0)));
double tmp;
if (pow(B_m, 2.0) <= 5e-273) {
tmp = -sqrt(((2.0 * (t_0 * F)) * (2.0 * C))) / t_0;
} else if (pow(B_m, 2.0) <= 5e-175) {
tmp = -sqrt(((t_1 * (2.0 * F)) * (A + A))) / t_1;
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt((C + hypot(B_m, C))));
}
return tmp;
}
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_1 = fma(B_m, B_m, Float64(A * Float64(C * -4.0))) tmp = 0.0 if ((B_m ^ 2.0) <= 5e-273) tmp = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_0 * F)) * Float64(2.0 * C)))) / t_0); elseif ((B_m ^ 2.0) <= 5e-175) tmp = Float64(Float64(-sqrt(Float64(Float64(t_1 * Float64(2.0 * F)) * Float64(A + A)))) / t_1); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(Float64(C + hypot(B_m, C)))))); end return tmp end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(B$95$m * B$95$m + N[(A * N[(C * -4.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-273], N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$0 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$0), $MachinePrecision], If[LessEqual[N[Power[B$95$m, 2.0], $MachinePrecision], 5e-175], N[((-N[Sqrt[N[(N[(t$95$1 * N[(2.0 * F), $MachinePrecision]), $MachinePrecision] * N[(A + A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$1), $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_1 := \mathsf{fma}\left(B\_m, B\_m, A \cdot \left(C \cdot -4\right)\right)\\
\mathbf{if}\;{B\_m}^{2} \leq 5 \cdot 10^{-273}:\\
\;\;\;\;\frac{-\sqrt{\left(2 \cdot \left(t\_0 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_0}\\
\mathbf{elif}\;{B\_m}^{2} \leq 5 \cdot 10^{-175}:\\
\;\;\;\;\frac{-\sqrt{\left(t\_1 \cdot \left(2 \cdot F\right)\right) \cdot \left(A + A\right)}}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{C + \mathsf{hypot}\left(B\_m, C\right)}\right)\right)\\
\end{array}
\end{array}
if (pow.f64 B 2) < 4.99999999999999965e-273Initial program 23.5%
Taylor expanded in A around -inf 32.7%
if 4.99999999999999965e-273 < (pow.f64 B 2) < 5e-175Initial program 26.7%
Simplified40.0%
Taylor expanded in A around inf 40.8%
distribute-rgt1-in40.8%
metadata-eval40.8%
mul0-lft40.8%
Simplified40.8%
if 5e-175 < (pow.f64 B 2) Initial program 26.0%
Taylor expanded in A around 0 15.7%
mul-1-neg15.7%
distribute-rgt-neg-in15.7%
*-commutative15.7%
unpow215.7%
unpow215.7%
hypot-def24.1%
Simplified24.1%
sqrt-prod32.0%
Applied egg-rr32.0%
Final simplification33.1%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B_m))
(t_1 (* t_0 (- (sqrt (* F (+ C (hypot B_m C)))))))
(t_2 (- (pow B_m 2.0) (* (* 4.0 A) C)))
(t_3 (/ (- (sqrt (* (* 2.0 (* t_2 F)) (* 2.0 C)))) t_2)))
(if (<= B_m 1.65e-200)
t_3
(if (<= B_m 7.8e-88)
(sqrt (/ (- F) C))
(if (<= B_m 7.7e-19)
t_1
(if (<= B_m 1.5e+23)
t_3
(if (<= B_m 7.2e+112)
t_1
(* t_0 (* (sqrt (+ B_m C)) (- (sqrt F)))))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt(2.0) / B_m;
double t_1 = t_0 * -sqrt((F * (C + hypot(B_m, C))));
double t_2 = pow(B_m, 2.0) - ((4.0 * A) * C);
double t_3 = -sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2;
double tmp;
if (B_m <= 1.65e-200) {
tmp = t_3;
} else if (B_m <= 7.8e-88) {
tmp = sqrt((-F / C));
} else if (B_m <= 7.7e-19) {
tmp = t_1;
} else if (B_m <= 1.5e+23) {
tmp = t_3;
} else if (B_m <= 7.2e+112) {
tmp = t_1;
} else {
tmp = t_0 * (sqrt((B_m + C)) * -sqrt(F));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.sqrt(2.0) / B_m;
double t_1 = t_0 * -Math.sqrt((F * (C + Math.hypot(B_m, C))));
double t_2 = Math.pow(B_m, 2.0) - ((4.0 * A) * C);
double t_3 = -Math.sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2;
double tmp;
if (B_m <= 1.65e-200) {
tmp = t_3;
} else if (B_m <= 7.8e-88) {
tmp = Math.sqrt((-F / C));
} else if (B_m <= 7.7e-19) {
tmp = t_1;
} else if (B_m <= 1.5e+23) {
tmp = t_3;
} else if (B_m <= 7.2e+112) {
tmp = t_1;
} else {
tmp = t_0 * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.sqrt(2.0) / B_m t_1 = t_0 * -math.sqrt((F * (C + math.hypot(B_m, C)))) t_2 = math.pow(B_m, 2.0) - ((4.0 * A) * C) t_3 = -math.sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2 tmp = 0 if B_m <= 1.65e-200: tmp = t_3 elif B_m <= 7.8e-88: tmp = math.sqrt((-F / C)) elif B_m <= 7.7e-19: tmp = t_1 elif B_m <= 1.5e+23: tmp = t_3 elif B_m <= 7.2e+112: tmp = t_1 else: tmp = t_0 * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(sqrt(2.0) / B_m) t_1 = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))) t_2 = Float64((B_m ^ 2.0) - Float64(Float64(4.0 * A) * C)) t_3 = Float64(Float64(-sqrt(Float64(Float64(2.0 * Float64(t_2 * F)) * Float64(2.0 * C)))) / t_2) tmp = 0.0 if (B_m <= 1.65e-200) tmp = t_3; elseif (B_m <= 7.8e-88) tmp = sqrt(Float64(Float64(-F) / C)); elseif (B_m <= 7.7e-19) tmp = t_1; elseif (B_m <= 1.5e+23) tmp = t_3; elseif (B_m <= 7.2e+112) tmp = t_1; else tmp = Float64(t_0 * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = sqrt(2.0) / B_m; t_1 = t_0 * -sqrt((F * (C + hypot(B_m, C)))); t_2 = (B_m ^ 2.0) - ((4.0 * A) * C); t_3 = -sqrt(((2.0 * (t_2 * F)) * (2.0 * C))) / t_2; tmp = 0.0; if (B_m <= 1.65e-200) tmp = t_3; elseif (B_m <= 7.8e-88) tmp = sqrt((-F / C)); elseif (B_m <= 7.7e-19) tmp = t_1; elseif (B_m <= 1.5e+23) tmp = t_3; elseif (B_m <= 7.2e+112) tmp = t_1; else tmp = t_0 * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[B$95$m, 2.0], $MachinePrecision] - N[(N[(4.0 * A), $MachinePrecision] * C), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[((-N[Sqrt[N[(N[(2.0 * N[(t$95$2 * F), $MachinePrecision]), $MachinePrecision] * N[(2.0 * C), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]) / t$95$2), $MachinePrecision]}, If[LessEqual[B$95$m, 1.65e-200], t$95$3, If[LessEqual[B$95$m, 7.8e-88], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 7.7e-19], t$95$1, If[LessEqual[B$95$m, 1.5e+23], t$95$3, If[LessEqual[B$95$m, 7.2e+112], t$95$1, N[(t$95$0 * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B\_m}\\
t_1 := t\_0 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
t_2 := {B\_m}^{2} - \left(4 \cdot A\right) \cdot C\\
t_3 := \frac{-\sqrt{\left(2 \cdot \left(t\_2 \cdot F\right)\right) \cdot \left(2 \cdot C\right)}}{t\_2}\\
\mathbf{if}\;B\_m \leq 1.65 \cdot 10^{-200}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;B\_m \leq 7.8 \cdot 10^{-88}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{elif}\;B\_m \leq 7.7 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;B\_m \leq 1.5 \cdot 10^{+23}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;B\_m \leq 7.2 \cdot 10^{+112}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{B\_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.6499999999999999e-200 or 7.70000000000000044e-19 < B < 1.5e23Initial program 26.0%
Taylor expanded in A around -inf 20.9%
if 1.6499999999999999e-200 < B < 7.79999999999999985e-88Initial program 23.5%
Simplified32.3%
add-sqr-sqrt17.5%
sqrt-unprod18.2%
frac-times11.9%
Applied egg-rr11.9%
Taylor expanded in A around inf 30.1%
mul-1-neg30.1%
Simplified30.1%
if 7.79999999999999985e-88 < B < 7.70000000000000044e-19 or 1.5e23 < B < 7.20000000000000001e112Initial program 41.7%
Taylor expanded in A around 0 51.6%
mul-1-neg51.6%
distribute-rgt-neg-in51.6%
*-commutative51.6%
unpow251.6%
unpow251.6%
hypot-def55.1%
Simplified55.1%
if 7.20000000000000001e112 < B Initial program 10.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
distribute-rgt-neg-in16.6%
*-commutative16.6%
unpow216.6%
unpow216.6%
hypot-def47.0%
Simplified47.0%
sqrt-prod79.7%
Applied egg-rr79.7%
Taylor expanded in C around 0 76.8%
Final simplification34.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(let* ((t_0 (/ (sqrt 2.0) B_m)))
(if (<= B_m 2e-159)
(sqrt (- (/ F A)))
(if (<= B_m 1.05e-87)
(sqrt (/ (- F) C))
(if (<= B_m 6.5e+115)
(* t_0 (- (sqrt (* F (+ C (hypot B_m C))))))
(* t_0 (* (sqrt (+ B_m C)) (- (sqrt F)))))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double t_0 = sqrt(2.0) / B_m;
double tmp;
if (B_m <= 2e-159) {
tmp = sqrt(-(F / A));
} else if (B_m <= 1.05e-87) {
tmp = sqrt((-F / C));
} else if (B_m <= 6.5e+115) {
tmp = t_0 * -sqrt((F * (C + hypot(B_m, C))));
} else {
tmp = t_0 * (sqrt((B_m + C)) * -sqrt(F));
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double t_0 = Math.sqrt(2.0) / B_m;
double tmp;
if (B_m <= 2e-159) {
tmp = Math.sqrt(-(F / A));
} else if (B_m <= 1.05e-87) {
tmp = Math.sqrt((-F / C));
} else if (B_m <= 6.5e+115) {
tmp = t_0 * -Math.sqrt((F * (C + Math.hypot(B_m, C))));
} else {
tmp = t_0 * (Math.sqrt((B_m + C)) * -Math.sqrt(F));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): t_0 = math.sqrt(2.0) / B_m tmp = 0 if B_m <= 2e-159: tmp = math.sqrt(-(F / A)) elif B_m <= 1.05e-87: tmp = math.sqrt((-F / C)) elif B_m <= 6.5e+115: tmp = t_0 * -math.sqrt((F * (C + math.hypot(B_m, C)))) else: tmp = t_0 * (math.sqrt((B_m + C)) * -math.sqrt(F)) return tmp
B_m = abs(B) function code(A, B_m, C, F) t_0 = Float64(sqrt(2.0) / B_m) tmp = 0.0 if (B_m <= 2e-159) tmp = sqrt(Float64(-Float64(F / A))); elseif (B_m <= 1.05e-87) tmp = sqrt(Float64(Float64(-F) / C)); elseif (B_m <= 6.5e+115) tmp = Float64(t_0 * Float64(-sqrt(Float64(F * Float64(C + hypot(B_m, C)))))); else tmp = Float64(t_0 * Float64(sqrt(Float64(B_m + C)) * Float64(-sqrt(F)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) t_0 = sqrt(2.0) / B_m; tmp = 0.0; if (B_m <= 2e-159) tmp = sqrt(-(F / A)); elseif (B_m <= 1.05e-87) tmp = sqrt((-F / C)); elseif (B_m <= 6.5e+115) tmp = t_0 * -sqrt((F * (C + hypot(B_m, C)))); else tmp = t_0 * (sqrt((B_m + C)) * -sqrt(F)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision]
code[A_, B$95$m_, C_, F_] := Block[{t$95$0 = N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]}, If[LessEqual[B$95$m, 2e-159], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[B$95$m, 1.05e-87], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], If[LessEqual[B$95$m, 6.5e+115], N[(t$95$0 * (-N[Sqrt[N[(F * N[(C + N[Sqrt[B$95$m ^ 2 + C ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision])), $MachinePrecision], N[(t$95$0 * N[(N[Sqrt[N[(B$95$m + C), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[F], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
t_0 := \frac{\sqrt{2}}{B\_m}\\
\mathbf{if}\;B\_m \leq 2 \cdot 10^{-159}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;B\_m \leq 1.05 \cdot 10^{-87}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{+115}:\\
\;\;\;\;t\_0 \cdot \left(-\sqrt{F \cdot \left(C + \mathsf{hypot}\left(B\_m, C\right)\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(\sqrt{B\_m + C} \cdot \left(-\sqrt{F}\right)\right)\\
\end{array}
\end{array}
if B < 1.99999999999999998e-159Initial program 25.9%
Simplified28.2%
add-sqr-sqrt8.9%
sqrt-unprod8.8%
frac-times5.3%
Applied egg-rr5.3%
Taylor expanded in A around -inf 18.0%
mul-1-neg18.0%
Simplified18.0%
if 1.99999999999999998e-159 < B < 1.05000000000000004e-87Initial program 25.9%
Simplified36.1%
add-sqr-sqrt17.2%
sqrt-unprod18.0%
frac-times14.1%
Applied egg-rr14.1%
Taylor expanded in A around inf 25.8%
mul-1-neg25.8%
Simplified25.8%
if 1.05000000000000004e-87 < B < 6.49999999999999966e115Initial program 36.7%
Taylor expanded in A around 0 42.2%
mul-1-neg42.2%
distribute-rgt-neg-in42.2%
*-commutative42.2%
unpow242.2%
unpow242.2%
hypot-def45.3%
Simplified45.3%
if 6.49999999999999966e115 < B Initial program 10.8%
Taylor expanded in A around 0 16.6%
mul-1-neg16.6%
distribute-rgt-neg-in16.6%
*-commutative16.6%
unpow216.6%
unpow216.6%
hypot-def47.0%
Simplified47.0%
sqrt-prod79.7%
Applied egg-rr79.7%
Taylor expanded in C around 0 76.8%
Final simplification32.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 9.8e-160)
(sqrt (- (/ F A)))
(if (<= B_m 6.5e-88)
(sqrt (/ (- F) C))
(* (/ (sqrt 2.0) B_m) (* (sqrt F) (- (sqrt B_m)))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 9.8e-160) {
tmp = sqrt(-(F / A));
} else if (B_m <= 6.5e-88) {
tmp = sqrt((-F / C));
} else {
tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt(B_m));
}
return tmp;
}
B_m = abs(B)
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 <= 9.8d-160) then
tmp = sqrt(-(f / a))
else if (b_m <= 6.5d-88) then
tmp = sqrt((-f / c))
else
tmp = (sqrt(2.0d0) / b_m) * (sqrt(f) * -sqrt(b_m))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 9.8e-160) {
tmp = Math.sqrt(-(F / A));
} else if (B_m <= 6.5e-88) {
tmp = Math.sqrt((-F / C));
} else {
tmp = (Math.sqrt(2.0) / B_m) * (Math.sqrt(F) * -Math.sqrt(B_m));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 9.8e-160: tmp = math.sqrt(-(F / A)) elif B_m <= 6.5e-88: tmp = math.sqrt((-F / C)) else: tmp = (math.sqrt(2.0) / B_m) * (math.sqrt(F) * -math.sqrt(B_m)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 9.8e-160) tmp = sqrt(Float64(-Float64(F / A))); elseif (B_m <= 6.5e-88) tmp = sqrt(Float64(Float64(-F) / C)); else tmp = Float64(Float64(sqrt(2.0) / B_m) * Float64(sqrt(F) * Float64(-sqrt(B_m)))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 9.8e-160) tmp = sqrt(-(F / A)); elseif (B_m <= 6.5e-88) tmp = sqrt((-F / C)); else tmp = (sqrt(2.0) / B_m) * (sqrt(F) * -sqrt(B_m)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 9.8e-160], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[B$95$m, 6.5e-88], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[(N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision] * N[(N[Sqrt[F], $MachinePrecision] * (-N[Sqrt[B$95$m], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 9.8 \cdot 10^{-160}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;B\_m \leq 6.5 \cdot 10^{-88}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{2}}{B\_m} \cdot \left(\sqrt{F} \cdot \left(-\sqrt{B\_m}\right)\right)\\
\end{array}
\end{array}
if B < 9.7999999999999998e-160Initial program 25.9%
Simplified28.2%
add-sqr-sqrt8.9%
sqrt-unprod8.8%
frac-times5.3%
Applied egg-rr5.3%
Taylor expanded in A around -inf 18.0%
mul-1-neg18.0%
Simplified18.0%
if 9.7999999999999998e-160 < B < 6.50000000000000006e-88Initial program 25.9%
Simplified36.1%
add-sqr-sqrt17.2%
sqrt-unprod18.0%
frac-times14.1%
Applied egg-rr14.1%
Taylor expanded in A around inf 25.8%
mul-1-neg25.8%
Simplified25.8%
if 6.50000000000000006e-88 < B Initial program 24.4%
Taylor expanded in A around 0 30.0%
mul-1-neg30.0%
distribute-rgt-neg-in30.0%
*-commutative30.0%
unpow230.0%
unpow230.0%
hypot-def46.1%
Simplified46.1%
sqrt-prod61.7%
Applied egg-rr61.7%
Taylor expanded in C around 0 55.7%
Final simplification30.6%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -1e-309)
(/ (sqrt (- F)) (sqrt A))
(if (<= F 2.2e-45)
(/ (sqrt (* (* 2.0 F) (+ A (hypot B_m A)))) (- B_m))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1e-309) {
tmp = sqrt(-F) / sqrt(A);
} else if (F <= 2.2e-45) {
tmp = sqrt(((2.0 * F) * (A + hypot(B_m, A)))) / -B_m;
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1e-309) {
tmp = Math.sqrt(-F) / Math.sqrt(A);
} else if (F <= 2.2e-45) {
tmp = Math.sqrt(((2.0 * F) * (A + Math.hypot(B_m, A)))) / -B_m;
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -1e-309: tmp = math.sqrt(-F) / math.sqrt(A) elif F <= 2.2e-45: tmp = math.sqrt(((2.0 * F) * (A + math.hypot(B_m, A)))) / -B_m else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -1e-309) tmp = Float64(sqrt(Float64(-F)) / sqrt(A)); elseif (F <= 2.2e-45) tmp = Float64(sqrt(Float64(Float64(2.0 * F) * Float64(A + hypot(B_m, A)))) / Float64(-B_m)); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -1e-309) tmp = sqrt(-F) / sqrt(A); elseif (F <= 2.2e-45) tmp = sqrt(((2.0 * F) * (A + hypot(B_m, A)))) / -B_m; else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -1e-309], N[(N[Sqrt[(-F)], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 2.2e-45], N[(N[Sqrt[N[(N[(2.0 * F), $MachinePrecision] * N[(A + N[Sqrt[B$95$m ^ 2 + A ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / (-B$95$m)), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-F}}{\sqrt{A}}\\
\mathbf{elif}\;F \leq 2.2 \cdot 10^{-45}:\\
\;\;\;\;\frac{\sqrt{\left(2 \cdot F\right) \cdot \left(A + \mathsf{hypot}\left(B\_m, A\right)\right)}}{-B\_m}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -1.000000000000002e-309Initial program 44.3%
Simplified50.9%
add-sqr-sqrt50.4%
sqrt-unprod47.7%
frac-times28.1%
Applied egg-rr28.1%
Taylor expanded in A around -inf 55.9%
mul-1-neg55.9%
Simplified55.9%
Applied egg-rr56.1%
if -1.000000000000002e-309 < F < 2.19999999999999993e-45Initial program 22.4%
Simplified26.2%
add-sqr-sqrt2.1%
sqrt-unprod2.9%
frac-times2.8%
Applied egg-rr2.8%
Taylor expanded in C around 0 10.0%
+-commutative10.0%
unpow210.0%
unpow210.0%
hypot-def17.9%
Simplified17.9%
Applied egg-rr26.6%
*-commutative26.6%
*-commutative26.6%
associate-*l*26.6%
Simplified26.6%
if 2.19999999999999993e-45 < F Initial program 23.3%
Taylor expanded in C around 0 10.9%
mul-1-neg10.9%
*-commutative10.9%
distribute-rgt-neg-in10.9%
*-commutative10.9%
+-commutative10.9%
unpow210.9%
unpow210.9%
hypot-def12.1%
Simplified12.1%
Taylor expanded in A around 0 18.4%
mul-1-neg18.4%
Simplified18.4%
Final simplification26.0%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= F -1e-309)
(/ (sqrt (- F)) (sqrt A))
(if (<= F 4e-18)
(* (- (/ (sqrt 2.0) B_m)) (sqrt (* B_m F)))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1e-309) {
tmp = sqrt(-F) / sqrt(A);
} else if (F <= 4e-18) {
tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * F));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B)
real(8) function code(a, b_m, c, f)
real(8), intent (in) :: a
real(8), intent (in) :: b_m
real(8), intent (in) :: c
real(8), intent (in) :: f
real(8) :: tmp
if (f <= (-1d-309)) then
tmp = sqrt(-f) / sqrt(a)
else if (f <= 4d-18) then
tmp = -(sqrt(2.0d0) / b_m) * sqrt((b_m * f))
else
tmp = sqrt((f / b_m)) * -sqrt(2.0d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (F <= -1e-309) {
tmp = Math.sqrt(-F) / Math.sqrt(A);
} else if (F <= 4e-18) {
tmp = -(Math.sqrt(2.0) / B_m) * Math.sqrt((B_m * F));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if F <= -1e-309: tmp = math.sqrt(-F) / math.sqrt(A) elif F <= 4e-18: tmp = -(math.sqrt(2.0) / B_m) * math.sqrt((B_m * F)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (F <= -1e-309) tmp = Float64(sqrt(Float64(-F)) / sqrt(A)); elseif (F <= 4e-18) tmp = Float64(Float64(-Float64(sqrt(2.0) / B_m)) * sqrt(Float64(B_m * F))); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (F <= -1e-309) tmp = sqrt(-F) / sqrt(A); elseif (F <= 4e-18) tmp = -(sqrt(2.0) / B_m) * sqrt((B_m * F)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[F, -1e-309], N[(N[Sqrt[(-F)], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision], If[LessEqual[F, 4e-18], N[((-N[(N[Sqrt[2.0], $MachinePrecision] / B$95$m), $MachinePrecision]) * N[Sqrt[N[(B$95$m * F), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;F \leq -1 \cdot 10^{-309}:\\
\;\;\;\;\frac{\sqrt{-F}}{\sqrt{A}}\\
\mathbf{elif}\;F \leq 4 \cdot 10^{-18}:\\
\;\;\;\;\left(-\frac{\sqrt{2}}{B\_m}\right) \cdot \sqrt{B\_m \cdot F}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if F < -1.000000000000002e-309Initial program 44.3%
Simplified50.9%
add-sqr-sqrt50.4%
sqrt-unprod47.7%
frac-times28.1%
Applied egg-rr28.1%
Taylor expanded in A around -inf 55.9%
mul-1-neg55.9%
Simplified55.9%
Applied egg-rr56.1%
if -1.000000000000002e-309 < F < 4.0000000000000003e-18Initial program 21.6%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
*-commutative11.5%
distribute-rgt-neg-in11.5%
*-commutative11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def25.6%
Simplified25.6%
Taylor expanded in A around 0 22.2%
if 4.0000000000000003e-18 < F Initial program 24.1%
Taylor expanded in C around 0 11.5%
mul-1-neg11.5%
*-commutative11.5%
distribute-rgt-neg-in11.5%
*-commutative11.5%
+-commutative11.5%
unpow211.5%
unpow211.5%
hypot-def11.9%
Simplified11.9%
Taylor expanded in A around 0 18.5%
mul-1-neg18.5%
Simplified18.5%
Final simplification24.5%
B_m = (fabs.f64 B)
(FPCore (A B_m C F)
:precision binary64
(if (<= B_m 4.1e-160)
(sqrt (- (/ F A)))
(if (<= B_m 8.2e-84)
(sqrt (/ (- F) C))
(* (sqrt (/ F B_m)) (- (sqrt 2.0))))))B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.1e-160) {
tmp = sqrt(-(F / A));
} else if (B_m <= 8.2e-84) {
tmp = sqrt((-F / C));
} else {
tmp = sqrt((F / B_m)) * -sqrt(2.0);
}
return tmp;
}
B_m = abs(B)
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 <= 4.1d-160) then
tmp = sqrt(-(f / a))
else if (b_m <= 8.2d-84) then
tmp = sqrt((-f / c))
else
tmp = sqrt((f / b_m)) * -sqrt(2.0d0)
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if (B_m <= 4.1e-160) {
tmp = Math.sqrt(-(F / A));
} else if (B_m <= 8.2e-84) {
tmp = Math.sqrt((-F / C));
} else {
tmp = Math.sqrt((F / B_m)) * -Math.sqrt(2.0);
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if B_m <= 4.1e-160: tmp = math.sqrt(-(F / A)) elif B_m <= 8.2e-84: tmp = math.sqrt((-F / C)) else: tmp = math.sqrt((F / B_m)) * -math.sqrt(2.0) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if (B_m <= 4.1e-160) tmp = sqrt(Float64(-Float64(F / A))); elseif (B_m <= 8.2e-84) tmp = sqrt(Float64(Float64(-F) / C)); else tmp = Float64(sqrt(Float64(F / B_m)) * Float64(-sqrt(2.0))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if (B_m <= 4.1e-160) tmp = sqrt(-(F / A)); elseif (B_m <= 8.2e-84) tmp = sqrt((-F / C)); else tmp = sqrt((F / B_m)) * -sqrt(2.0); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[LessEqual[B$95$m, 4.1e-160], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision], If[LessEqual[B$95$m, 8.2e-84], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[(N[Sqrt[N[(F / B$95$m), $MachinePrecision]], $MachinePrecision] * (-N[Sqrt[2.0], $MachinePrecision])), $MachinePrecision]]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;B\_m \leq 4.1 \cdot 10^{-160}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\mathbf{elif}\;B\_m \leq 8.2 \cdot 10^{-84}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{\frac{F}{B\_m}} \cdot \left(-\sqrt{2}\right)\\
\end{array}
\end{array}
if B < 4.10000000000000002e-160Initial program 25.9%
Simplified28.2%
add-sqr-sqrt8.9%
sqrt-unprod8.8%
frac-times5.3%
Applied egg-rr5.3%
Taylor expanded in A around -inf 18.0%
mul-1-neg18.0%
Simplified18.0%
if 4.10000000000000002e-160 < B < 8.2000000000000001e-84Initial program 25.9%
Simplified36.1%
add-sqr-sqrt17.2%
sqrt-unprod18.0%
frac-times14.1%
Applied egg-rr14.1%
Taylor expanded in A around inf 25.8%
mul-1-neg25.8%
Simplified25.8%
if 8.2000000000000001e-84 < B Initial program 24.4%
Taylor expanded in C around 0 27.9%
mul-1-neg27.9%
*-commutative27.9%
distribute-rgt-neg-in27.9%
*-commutative27.9%
+-commutative27.9%
unpow227.9%
unpow227.9%
hypot-def45.0%
Simplified45.0%
Taylor expanded in A around 0 36.9%
mul-1-neg36.9%
Simplified36.9%
Final simplification24.7%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (if (or (<= C -6.5e-30) (and (not (<= C 2.5e-299)) (<= C 2.5e-82))) (sqrt (/ (- F) C)) (sqrt (- (/ F A)))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
double tmp;
if ((C <= -6.5e-30) || (!(C <= 2.5e-299) && (C <= 2.5e-82))) {
tmp = sqrt((-F / C));
} else {
tmp = sqrt(-(F / A));
}
return tmp;
}
B_m = abs(B)
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 <= (-6.5d-30)) .or. (.not. (c <= 2.5d-299)) .and. (c <= 2.5d-82)) then
tmp = sqrt((-f / c))
else
tmp = sqrt(-(f / a))
end if
code = tmp
end function
B_m = Math.abs(B);
public static double code(double A, double B_m, double C, double F) {
double tmp;
if ((C <= -6.5e-30) || (!(C <= 2.5e-299) && (C <= 2.5e-82))) {
tmp = Math.sqrt((-F / C));
} else {
tmp = Math.sqrt(-(F / A));
}
return tmp;
}
B_m = math.fabs(B) def code(A, B_m, C, F): tmp = 0 if (C <= -6.5e-30) or (not (C <= 2.5e-299) and (C <= 2.5e-82)): tmp = math.sqrt((-F / C)) else: tmp = math.sqrt(-(F / A)) return tmp
B_m = abs(B) function code(A, B_m, C, F) tmp = 0.0 if ((C <= -6.5e-30) || (!(C <= 2.5e-299) && (C <= 2.5e-82))) tmp = sqrt(Float64(Float64(-F) / C)); else tmp = sqrt(Float64(-Float64(F / A))); end return tmp end
B_m = abs(B); function tmp_2 = code(A, B_m, C, F) tmp = 0.0; if ((C <= -6.5e-30) || (~((C <= 2.5e-299)) && (C <= 2.5e-82))) tmp = sqrt((-F / C)); else tmp = sqrt(-(F / A)); end tmp_2 = tmp; end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := If[Or[LessEqual[C, -6.5e-30], And[N[Not[LessEqual[C, 2.5e-299]], $MachinePrecision], LessEqual[C, 2.5e-82]]], N[Sqrt[N[((-F) / C), $MachinePrecision]], $MachinePrecision], N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision]]
\begin{array}{l}
B_m = \left|B\right|
\\
\begin{array}{l}
\mathbf{if}\;C \leq -6.5 \cdot 10^{-30} \lor \neg \left(C \leq 2.5 \cdot 10^{-299}\right) \land C \leq 2.5 \cdot 10^{-82}:\\
\;\;\;\;\sqrt{\frac{-F}{C}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{-\frac{F}{A}}\\
\end{array}
\end{array}
if C < -6.5000000000000005e-30 or 2.49999999999999978e-299 < C < 2.4999999999999999e-82Initial program 21.0%
Simplified24.0%
add-sqr-sqrt8.2%
sqrt-unprod7.9%
frac-times5.2%
Applied egg-rr5.2%
Taylor expanded in A around inf 18.4%
mul-1-neg18.4%
Simplified18.4%
if -6.5000000000000005e-30 < C < 2.49999999999999978e-299 or 2.4999999999999999e-82 < C Initial program 28.9%
Simplified32.5%
add-sqr-sqrt6.3%
sqrt-unprod6.9%
frac-times4.6%
Applied egg-rr4.6%
Taylor expanded in A around -inf 20.3%
mul-1-neg20.3%
Simplified20.3%
Final simplification19.5%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (sqrt (- (/ F A))))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt(-(F / A));
}
B_m = abs(B)
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);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt(-(F / A));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt(-(F / A))
B_m = abs(B) function code(A, B_m, C, F) return sqrt(Float64(-Float64(F / A))) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt(-(F / A)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[Sqrt[(-N[(F / A), $MachinePrecision])], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{-\frac{F}{A}}
\end{array}
Initial program 25.4%
Simplified28.7%
add-sqr-sqrt7.2%
sqrt-unprod7.4%
frac-times4.9%
Applied egg-rr4.9%
Taylor expanded in A around -inf 13.8%
mul-1-neg13.8%
Simplified13.8%
Final simplification13.8%
B_m = (fabs.f64 B) (FPCore (A B_m C F) :precision binary64 (sqrt (/ F A)))
B_m = fabs(B);
double code(double A, double B_m, double C, double F) {
return sqrt((F / A));
}
B_m = abs(B)
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);
public static double code(double A, double B_m, double C, double F) {
return Math.sqrt((F / A));
}
B_m = math.fabs(B) def code(A, B_m, C, F): return math.sqrt((F / A))
B_m = abs(B) function code(A, B_m, C, F) return sqrt(Float64(F / A)) end
B_m = abs(B); function tmp = code(A, B_m, C, F) tmp = sqrt((F / A)); end
B_m = N[Abs[B], $MachinePrecision] code[A_, B$95$m_, C_, F_] := N[Sqrt[N[(F / A), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
B_m = \left|B\right|
\\
\sqrt{\frac{F}{A}}
\end{array}
Initial program 25.4%
Simplified28.7%
add-sqr-sqrt7.2%
sqrt-unprod7.4%
frac-times4.9%
Applied egg-rr4.9%
Taylor expanded in A around -inf 13.8%
mul-1-neg13.8%
Simplified13.8%
Applied egg-rr1.3%
expm1-def1.1%
expm1-log1p1.1%
Simplified1.1%
Final simplification1.1%
herbie shell --seed 2024026
(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))))