
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im) :precision binary64 (- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))
double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = (((x_46re * x_46re) - (x_46im * x_46im)) * x_46re) - (((x_46re * x_46im) + (x_46im * x_46re)) * x_46im)
end function
public static double code(double x_46_re, double x_46_im) {
return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im)
function code(x_46_re, x_46_im) return Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im * x_46_im)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_im)) end
function tmp = code(x_46_re, x_46_im) tmp = (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_re) - (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_im); end
code[x$46$re_, x$46$im_] := N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.re - \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.im
\end{array}
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<=
(-
(* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))
(* x.im (+ (* x.re_m x.im) (* x.re_m x.im))))
0.0)
(* (* x.re_m x.im) (* x.im -3.0))
(*
(pow x.re_m 3.0)
(+ 1.0 (* -3.0 (* (/ x.im x.re_m) (/ x.im x.re_m))))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else {
tmp = pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))));
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (((x_46re_m * ((x_46re_m * x_46re_m) - (x_46im * x_46im))) - (x_46im * ((x_46re_m * x_46im) + (x_46re_m * x_46im)))) <= 0.0d0) then
tmp = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
else
tmp = (x_46re_m ** 3.0d0) * (1.0d0 + ((-3.0d0) * ((x_46im / x_46re_m) * (x_46im / x_46re_m))))
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else {
tmp = Math.pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m))));
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if ((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0: tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0) else: tmp = math.pow(x_46_re_m, 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m)))) return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im)))) <= 0.0) tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)); else tmp = Float64((x_46_re_m ^ 3.0) * Float64(1.0 + Float64(-3.0 * Float64(Float64(x_46_im / x_46_re_m) * Float64(x_46_im / x_46_re_m))))); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (((x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)))) <= 0.0) tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0); else tmp = (x_46_re_m ^ 3.0) * (1.0 + (-3.0 * ((x_46_im / x_46_re_m) * (x_46_im / x_46_re_m)))); end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[x$46$re$95$m, 3.0], $MachinePrecision] * N[(1.0 + N[(-3.0 * N[(N[(x$46$im / x$46$re$95$m), $MachinePrecision] * N[(x$46$im / x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right) \leq 0:\\
\;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
\mathbf{else}:\\
\;\;\;\;{x.re\_m}^{3} \cdot \left(1 + -3 \cdot \left(\frac{x.im}{x.re\_m} \cdot \frac{x.im}{x.re\_m}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < 0.0Initial program 90.6%
Simplified86.8%
Taylor expanded in x.re around 0 56.9%
add-sqr-sqrt44.0%
unpow244.0%
swap-sqr53.1%
unpow253.1%
Applied egg-rr53.1%
unpow253.1%
*-commutative53.1%
associate-*r*53.2%
associate-*r*53.2%
add-sqr-sqrt66.1%
*-commutative66.1%
Applied egg-rr66.1%
associate-*r*66.2%
*-commutative66.2%
add-log-exp41.7%
*-un-lft-identity41.7%
1-exp41.7%
mul0-lft41.7%
*-commutative41.7%
mul0-lft41.7%
metadata-eval41.7%
distribute-rgt1-in41.7%
exp-sum41.7%
+-commutative41.7%
add-log-exp66.2%
*-commutative66.2%
distribute-rgt-in66.2%
fma-define66.2%
Applied egg-rr66.1%
fma-undefine66.1%
mul0-rgt66.1%
+-rgt-identity66.1%
associate-*r*66.2%
associate-*l*66.2%
*-commutative66.2%
Applied egg-rr66.2%
if 0.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 63.5%
Simplified60.4%
Taylor expanded in x.re around inf 58.7%
unpow258.7%
unpow258.7%
times-frac79.5%
Applied egg-rr79.5%
Final simplification72.7%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 17.0)
(+ (pow x.re_m 3.0) (* -3.0 (* x.im (* x.re_m x.im))))
(* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 17.0) {
tmp = pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
} else {
tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 17.0d0) then
tmp = (x_46re_m ** 3.0d0) + ((-3.0d0) * (x_46im * (x_46re_m * x_46im)))
else
tmp = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m + x_46im))
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 17.0) {
tmp = Math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
} else {
tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 17.0: tmp = math.pow(x_46_re_m, 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im))) else: tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)) return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 17.0) tmp = Float64((x_46_re_m ^ 3.0) + Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im)))); else tmp = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im))); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 17.0) tmp = (x_46_re_m ^ 3.0) + (-3.0 * (x_46_im * (x_46_re_m * x_46_im))); else tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)); end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 17.0], N[(N[Power[x$46$re$95$m, 3.0], $MachinePrecision] + N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 17:\\
\;\;\;\;{x.re\_m}^{3} + -3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\
\end{array}
\end{array}
if x.re < 17Initial program 79.1%
Simplified76.9%
add-sqr-sqrt46.6%
pow246.6%
*-commutative46.6%
sqrt-prod24.5%
sqrt-prod16.5%
add-sqr-sqrt31.0%
Applied egg-rr31.0%
unpow229.4%
*-commutative29.4%
associate-*r*29.5%
associate-*r*29.5%
add-sqr-sqrt68.6%
*-commutative68.6%
Applied egg-rr88.0%
if 17 < x.re Initial program 72.7%
*-commutative72.7%
*-commutative72.7%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Simplified81.6%
difference-of-squares98.7%
*-commutative98.7%
Applied egg-rr98.7%
Final simplification90.9%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0
(-
(* x.re_m (- (* x.re_m x.re_m) (* x.im x.im)))
(* x.im (+ (* x.re_m x.im) (* x.re_m x.im)))))
(t_1 (* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im)))))
(*
x.re_s
(if (<= t_0 (- INFINITY))
(* (* x.re_m x.im) (* x.im -3.0))
(if (<= t_0 1e+72) (- t_1 (* x.im (* (* x.re_m x.im) 2.0))) t_1)))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)));
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else if (t_0 <= 1e+72) {
tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = t_1;
}
return x_46_re_s * tmp;
}
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im)));
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
double tmp;
if (t_0 <= -Double.POSITIVE_INFINITY) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else if (t_0 <= 1e+72) {
tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0));
} else {
tmp = t_1;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im))) t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)) tmp = 0 if t_0 <= -math.inf: tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0) elif t_0 <= 1e+72: tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)) else: tmp = t_1 return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m * Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im))) - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_re_m * x_46_im)))) t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im))) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)); elseif (t_0 <= 1e+72) tmp = Float64(t_1 - Float64(x_46_im * Float64(Float64(x_46_re_m * x_46_im) * 2.0))); else tmp = t_1; end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = (x_46_re_m * ((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im))) - (x_46_im * ((x_46_re_m * x_46_im) + (x_46_re_m * x_46_im))); t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)); tmp = 0.0; if (t_0 <= -Inf) tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0); elseif (t_0 <= 1e+72) tmp = t_1 - (x_46_im * ((x_46_re_m * x_46_im) * 2.0)); else tmp = t_1; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[t$95$0, (-Infinity)], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+72], N[(t$95$1 - N[(x$46$im * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := x.re\_m \cdot \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) - x.im \cdot \left(x.re\_m \cdot x.im + x.re\_m \cdot x.im\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+72}:\\
\;\;\;\;t\_1 - x.im \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
\end{array}
if (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < -inf.0Initial program 80.3%
Simplified72.3%
Taylor expanded in x.re around 0 40.4%
add-sqr-sqrt40.0%
unpow240.0%
swap-sqr59.5%
unpow259.5%
Applied egg-rr59.5%
unpow259.5%
*-commutative59.5%
associate-*r*59.5%
associate-*r*59.5%
add-sqr-sqrt60.0%
*-commutative60.0%
Applied egg-rr60.0%
associate-*r*59.9%
*-commutative59.9%
add-log-exp40.1%
*-un-lft-identity40.1%
1-exp40.1%
mul0-lft40.1%
*-commutative40.1%
mul0-lft40.1%
metadata-eval40.1%
distribute-rgt1-in40.1%
exp-sum40.1%
+-commutative40.1%
add-log-exp59.9%
*-commutative59.9%
distribute-rgt-in59.9%
fma-define59.9%
Applied egg-rr60.0%
fma-undefine60.0%
mul0-rgt60.0%
+-rgt-identity60.0%
associate-*r*59.9%
associate-*l*60.0%
*-commutative60.0%
Applied egg-rr60.0%
if -inf.0 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) < 9.99999999999999944e71Initial program 99.7%
difference-of-squares67.9%
*-commutative67.9%
Applied egg-rr99.7%
*-commutative99.7%
*-un-lft-identity99.7%
distribute-lft-in99.7%
distribute-rgt-out99.7%
metadata-eval99.7%
Applied egg-rr99.7%
if 9.99999999999999944e71 < (-.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.re) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.im)) Initial program 56.2%
*-commutative56.2%
*-commutative56.2%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Simplified59.7%
difference-of-squares84.7%
*-commutative84.7%
Applied egg-rr84.7%
Final simplification84.0%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(*
x.re_s
(if (<= x.re_m 2.05e-66)
(* (* x.re_m x.im) (* x.im -3.0))
(if (or (<= x.re_m 3.5e-30)
(not
(or (<= x.re_m 5.1e-30)
(and (not (<= x.re_m 6.4e-16))
(or (<= x.re_m 0.000245)
(and (not (<= x.re_m 8.8e+61))
(<= x.re_m 9e+61)))))))
(* x.re_m (* (- x.re_m x.im) (+ x.re_m x.im)))
(* -3.0 (* x.im (* x.re_m x.im)))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 2.05e-66) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else if ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61)))))) {
tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
} else {
tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im));
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 2.05d-66) then
tmp = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
else if ((x_46re_m <= 3.5d-30) .or. (.not. (x_46re_m <= 5.1d-30) .or. (.not. (x_46re_m <= 6.4d-16)) .and. (x_46re_m <= 0.000245d0) .or. (.not. (x_46re_m <= 8.8d+61)) .and. (x_46re_m <= 9d+61))) then
tmp = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m + x_46im))
else
tmp = (-3.0d0) * (x_46im * (x_46re_m * x_46im))
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 2.05e-66) {
tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
} else if ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61)))))) {
tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im));
} else {
tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im));
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 2.05e-66: tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0) elif (x_46_re_m <= 3.5e-30) or not ((x_46_re_m <= 5.1e-30) or (not (x_46_re_m <= 6.4e-16) and ((x_46_re_m <= 0.000245) or (not (x_46_re_m <= 8.8e+61) and (x_46_re_m <= 9e+61))))): tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)) else: tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im)) return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 2.05e-66) tmp = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)); elseif ((x_46_re_m <= 3.5e-30) || !((x_46_re_m <= 5.1e-30) || (!(x_46_re_m <= 6.4e-16) && ((x_46_re_m <= 0.000245) || (!(x_46_re_m <= 8.8e+61) && (x_46_re_m <= 9e+61)))))) tmp = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m + x_46_im))); else tmp = Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im))); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 2.05e-66) tmp = (x_46_re_m * x_46_im) * (x_46_im * -3.0); elseif ((x_46_re_m <= 3.5e-30) || ~(((x_46_re_m <= 5.1e-30) || (~((x_46_re_m <= 6.4e-16)) && ((x_46_re_m <= 0.000245) || (~((x_46_re_m <= 8.8e+61)) && (x_46_re_m <= 9e+61))))))) tmp = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m + x_46_im)); else tmp = -3.0 * (x_46_im * (x_46_re_m * x_46_im)); end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * If[LessEqual[x$46$re$95$m, 2.05e-66], N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$re$95$m, 3.5e-30], N[Not[Or[LessEqual[x$46$re$95$m, 5.1e-30], And[N[Not[LessEqual[x$46$re$95$m, 6.4e-16]], $MachinePrecision], Or[LessEqual[x$46$re$95$m, 0.000245], And[N[Not[LessEqual[x$46$re$95$m, 8.8e+61]], $MachinePrecision], LessEqual[x$46$re$95$m, 9e+61]]]]]], $MachinePrecision]], N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.re\_m \leq 2.05 \cdot 10^{-66}:\\
\;\;\;\;\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
\mathbf{elif}\;x.re\_m \leq 3.5 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 5.1 \cdot 10^{-30} \lor \neg \left(x.re\_m \leq 6.4 \cdot 10^{-16}\right) \land \left(x.re\_m \leq 0.000245 \lor \neg \left(x.re\_m \leq 8.8 \cdot 10^{+61}\right) \land x.re\_m \leq 9 \cdot 10^{+61}\right)\right):\\
\;\;\;\;x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m + x.im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < 2.04999999999999999e-66Initial program 78.6%
Simplified76.3%
Taylor expanded in x.re around 0 57.6%
add-sqr-sqrt21.2%
unpow221.2%
swap-sqr27.5%
unpow227.5%
Applied egg-rr27.5%
unpow227.5%
*-commutative27.5%
associate-*r*27.5%
associate-*r*27.5%
add-sqr-sqrt68.6%
*-commutative68.6%
Applied egg-rr68.6%
associate-*r*68.6%
*-commutative68.6%
add-log-exp36.6%
*-un-lft-identity36.6%
1-exp36.6%
mul0-lft36.6%
*-commutative36.6%
mul0-lft36.6%
metadata-eval36.6%
distribute-rgt1-in36.6%
exp-sum36.6%
+-commutative36.6%
add-log-exp68.6%
*-commutative68.6%
distribute-rgt-in68.6%
fma-define68.6%
Applied egg-rr68.6%
fma-undefine68.6%
mul0-rgt68.6%
+-rgt-identity68.6%
associate-*r*68.6%
associate-*l*68.7%
*-commutative68.7%
Applied egg-rr68.7%
if 2.04999999999999999e-66 < x.re < 3.5000000000000003e-30 or 5.09999999999999972e-30 < x.re < 6.40000000000000046e-16 or 2.4499999999999999e-4 < x.re < 8.8000000000000001e61 or 9e61 < x.re Initial program 75.2%
*-commutative75.2%
*-commutative75.2%
flip-+0.0%
+-inverses0.0%
metadata-eval0.0%
+-inverses0.0%
metadata-eval0.0%
associate-*r/0.0%
metadata-eval0.0%
metadata-eval0.0%
Applied egg-rr0.0%
Simplified81.7%
difference-of-squares97.3%
*-commutative97.3%
Applied egg-rr97.3%
if 3.5000000000000003e-30 < x.re < 5.09999999999999972e-30 or 6.40000000000000046e-16 < x.re < 2.4499999999999999e-4 or 8.8000000000000001e61 < x.re < 9e61Initial program 54.3%
Simplified53.5%
Taylor expanded in x.re around 0 54.3%
add-sqr-sqrt53.0%
unpow253.0%
swap-sqr100.0%
unpow2100.0%
Applied egg-rr100.0%
unpow2100.0%
*-commutative100.0%
associate-*r*100.0%
associate-*r*100.0%
add-sqr-sqrt100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification77.5%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
(t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
(*
x.re_s
(if (<= x.im 245000000000.0)
(* (- x.re_m x.im) (* x.re_m (- x.re_m x.im)))
(if (<= x.im 1.8e+82)
t_0
(if (<= x.im 1e+109)
t_1
(if (<= x.im 1.42e+147)
(* x.im (* x.re_m (* x.im -3.0)))
(if (or (<= x.im 1.05e+148)
(and (not (<= x.im 9e+181)) (<= x.im 9.5e+181)))
t_1
t_0))))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 245000000000.0) {
tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
} else if (x_46_im <= 1.8e+82) {
tmp = t_0;
} else if (x_46_im <= 1e+109) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
tmp = t_1;
} else {
tmp = t_0;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
if (x_46im <= 245000000000.0d0) then
tmp = (x_46re_m - x_46im) * (x_46re_m * (x_46re_m - x_46im))
else if (x_46im <= 1.8d+82) then
tmp = t_0
else if (x_46im <= 1d+109) then
tmp = t_1
else if (x_46im <= 1.42d+147) then
tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
else if ((x_46im <= 1.05d+148) .or. (.not. (x_46im <= 9d+181)) .and. (x_46im <= 9.5d+181)) then
tmp = t_1
else
tmp = t_0
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 245000000000.0) {
tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
} else if (x_46_im <= 1.8e+82) {
tmp = t_0;
} else if (x_46_im <= 1e+109) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
tmp = t_1;
} else {
tmp = t_0;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0) t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)) tmp = 0 if x_46_im <= 245000000000.0: tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im)) elif x_46_im <= 1.8e+82: tmp = t_0 elif x_46_im <= 1e+109: tmp = t_1 elif x_46_im <= 1.42e+147: tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)) elif (x_46_im <= 1.05e+148) or (not (x_46_im <= 9e+181) and (x_46_im <= 9.5e+181)): tmp = t_1 else: tmp = t_0 return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)) t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im))) tmp = 0.0 if (x_46_im <= 245000000000.0) tmp = Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m * Float64(x_46_re_m - x_46_im))); elseif (x_46_im <= 1.8e+82) tmp = t_0; elseif (x_46_im <= 1e+109) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0))); elseif ((x_46_im <= 1.05e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) tmp = t_1; else tmp = t_0; end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0); t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)); tmp = 0.0; if (x_46_im <= 245000000000.0) tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im)); elseif (x_46_im <= 1.8e+82) tmp = t_0; elseif (x_46_im <= 1e+109) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)); elseif ((x_46_im <= 1.05e+148) || (~((x_46_im <= 9e+181)) && (x_46_im <= 9.5e+181))) tmp = t_1; else tmp = t_0; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 245000000000.0], N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.8e+82], t$95$0, If[LessEqual[x$46$im, 1e+109], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 1.05e+148], And[N[Not[LessEqual[x$46$im, 9e+181]], $MachinePrecision], LessEqual[x$46$im, 9.5e+181]]], t$95$1, t$95$0]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 245000000000:\\
\;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\
\mathbf{elif}\;x.im \leq 1.8 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\
\;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if x.im < 2.45e11Initial program 83.2%
difference-of-squares82.3%
*-commutative82.3%
Applied egg-rr86.9%
*-commutative86.9%
*-un-lft-identity86.9%
distribute-lft-in86.9%
distribute-rgt-out86.9%
metadata-eval86.9%
Applied egg-rr86.9%
cancel-sign-sub-inv86.9%
associate-*l*92.1%
*-commutative92.1%
fma-define92.1%
+-commutative92.1%
associate-*l*92.1%
Applied egg-rr92.1%
fma-undefine92.1%
+-commutative92.1%
Applied egg-rr63.5%
mul0-rgt63.5%
mul0-rgt63.5%
+-lft-identity63.5%
*-commutative63.5%
associate-*l*63.5%
Simplified63.5%
associate-*r*63.5%
sub-neg63.5%
distribute-lft-in52.2%
Applied egg-rr52.2%
distribute-lft-out63.5%
sub-neg63.5%
Simplified63.5%
if 2.45e11 < x.im < 1.80000000000000007e82 or 1.04999999999999999e148 < x.im < 9e181 or 9.50000000000000032e181 < x.im Initial program 57.2%
Simplified49.2%
Taylor expanded in x.re around 0 59.1%
add-sqr-sqrt40.7%
unpow240.7%
swap-sqr55.7%
unpow255.7%
Applied egg-rr55.7%
unpow255.7%
*-commutative55.7%
associate-*r*55.8%
associate-*r*55.7%
add-sqr-sqrt79.8%
*-commutative79.8%
Applied egg-rr79.8%
associate-*r*79.8%
*-commutative79.8%
add-log-exp41.9%
*-un-lft-identity41.9%
1-exp41.9%
mul0-lft41.9%
*-commutative41.9%
mul0-lft41.9%
metadata-eval41.9%
distribute-rgt1-in41.9%
exp-sum41.9%
+-commutative41.9%
add-log-exp79.8%
*-commutative79.8%
distribute-rgt-in79.8%
fma-define79.8%
Applied egg-rr79.9%
fma-undefine79.9%
mul0-rgt79.9%
+-rgt-identity79.9%
associate-*r*79.8%
associate-*l*79.9%
*-commutative79.9%
Applied egg-rr79.9%
if 1.80000000000000007e82 < x.im < 9.99999999999999982e108 or 1.42e147 < x.im < 1.04999999999999999e148 or 9e181 < x.im < 9.50000000000000032e181Initial program 39.7%
difference-of-squares67.1%
*-commutative67.1%
Applied egg-rr39.7%
*-commutative39.7%
*-un-lft-identity39.7%
distribute-lft-in39.7%
distribute-rgt-out39.7%
metadata-eval39.7%
Applied egg-rr39.7%
cancel-sign-sub-inv39.7%
associate-*l*39.7%
*-commutative39.7%
fma-define39.7%
+-commutative39.7%
associate-*l*39.7%
Applied egg-rr39.7%
fma-undefine39.7%
+-commutative39.7%
Applied egg-rr60.6%
mul0-rgt60.6%
mul0-rgt60.6%
+-lft-identity60.6%
*-commutative60.6%
associate-*l*60.6%
Simplified60.6%
if 9.99999999999999982e108 < x.im < 1.42e147Initial program 85.7%
Simplified71.2%
Taylor expanded in x.re around 0 85.7%
add-sqr-sqrt28.6%
unpow228.6%
swap-sqr28.6%
unpow228.6%
Applied egg-rr28.6%
unpow228.6%
*-commutative28.6%
associate-*r*28.6%
associate-*r*28.6%
add-sqr-sqrt85.5%
*-commutative85.5%
Applied egg-rr85.5%
associate-*r*85.3%
*-commutative85.3%
add-log-exp31.0%
*-un-lft-identity31.0%
1-exp31.0%
mul0-lft31.0%
*-commutative31.0%
mul0-lft31.0%
metadata-eval31.0%
distribute-rgt1-in31.0%
exp-sum31.0%
+-commutative31.0%
add-log-exp85.3%
*-commutative85.3%
distribute-rgt-in85.3%
fma-define85.3%
Applied egg-rr85.5%
fma-undefine85.5%
mul0-rgt85.5%
+-rgt-identity85.5%
associate-*r*85.3%
*-commutative85.3%
associate-*l*85.5%
Applied egg-rr85.5%
Final simplification67.2%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
(t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
(*
x.re_s
(if (<= x.im 750000000.0)
t_1
(if (<= x.im 8.2e+81)
t_0
(if (<= x.im 5e+108)
t_1
(if (<= x.im 1.42e+147)
(* x.im (* x.re_m (* x.im -3.0)))
(if (or (<= x.im 1.1e+148)
(and (not (<= x.im 9e+181)) (<= x.im 9.5e+181)))
t_1
t_0))))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 750000000.0) {
tmp = t_1;
} else if (x_46_im <= 8.2e+81) {
tmp = t_0;
} else if (x_46_im <= 5e+108) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
tmp = t_1;
} else {
tmp = t_0;
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
if (x_46im <= 750000000.0d0) then
tmp = t_1
else if (x_46im <= 8.2d+81) then
tmp = t_0
else if (x_46im <= 5d+108) then
tmp = t_1
else if (x_46im <= 1.42d+147) then
tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
else if ((x_46im <= 1.1d+148) .or. (.not. (x_46im <= 9d+181)) .and. (x_46im <= 9.5d+181)) then
tmp = t_1
else
tmp = t_0
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 750000000.0) {
tmp = t_1;
} else if (x_46_im <= 8.2e+81) {
tmp = t_0;
} else if (x_46_im <= 5e+108) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) {
tmp = t_1;
} else {
tmp = t_0;
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0) t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)) tmp = 0 if x_46_im <= 750000000.0: tmp = t_1 elif x_46_im <= 8.2e+81: tmp = t_0 elif x_46_im <= 5e+108: tmp = t_1 elif x_46_im <= 1.42e+147: tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)) elif (x_46_im <= 1.1e+148) or (not (x_46_im <= 9e+181) and (x_46_im <= 9.5e+181)): tmp = t_1 else: tmp = t_0 return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)) t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im))) tmp = 0.0 if (x_46_im <= 750000000.0) tmp = t_1; elseif (x_46_im <= 8.2e+81) tmp = t_0; elseif (x_46_im <= 5e+108) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0))); elseif ((x_46_im <= 1.1e+148) || (!(x_46_im <= 9e+181) && (x_46_im <= 9.5e+181))) tmp = t_1; else tmp = t_0; end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0); t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)); tmp = 0.0; if (x_46_im <= 750000000.0) tmp = t_1; elseif (x_46_im <= 8.2e+81) tmp = t_0; elseif (x_46_im <= 5e+108) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)); elseif ((x_46_im <= 1.1e+148) || (~((x_46_im <= 9e+181)) && (x_46_im <= 9.5e+181))) tmp = t_1; else tmp = t_0; end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 750000000.0], t$95$1, If[LessEqual[x$46$im, 8.2e+81], t$95$0, If[LessEqual[x$46$im, 5e+108], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x$46$im, 1.1e+148], And[N[Not[LessEqual[x$46$im, 9e+181]], $MachinePrecision], LessEqual[x$46$im, 9.5e+181]]], t$95$1, t$95$0]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 750000000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq 8.2 \cdot 10^{+81}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\
\;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{elif}\;x.im \leq 1.1 \cdot 10^{+148} \lor \neg \left(x.im \leq 9 \cdot 10^{+181}\right) \land x.im \leq 9.5 \cdot 10^{+181}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
\end{array}
if x.im < 7.5e8 or 8.20000000000000024e81 < x.im < 4.99999999999999991e108 or 1.42e147 < x.im < 1.0999999999999999e148 or 9e181 < x.im < 9.50000000000000032e181Initial program 82.2%
difference-of-squares81.9%
*-commutative81.9%
Applied egg-rr85.7%
*-commutative85.7%
*-un-lft-identity85.7%
distribute-lft-in85.7%
distribute-rgt-out85.7%
metadata-eval85.7%
Applied egg-rr85.7%
cancel-sign-sub-inv85.7%
associate-*l*90.8%
*-commutative90.8%
fma-define90.8%
+-commutative90.8%
associate-*l*90.8%
Applied egg-rr90.8%
fma-undefine90.8%
+-commutative90.8%
Applied egg-rr63.4%
mul0-rgt63.4%
mul0-rgt63.4%
+-lft-identity63.4%
*-commutative63.4%
associate-*l*63.4%
Simplified63.4%
if 7.5e8 < x.im < 8.20000000000000024e81 or 1.0999999999999999e148 < x.im < 9e181 or 9.50000000000000032e181 < x.im Initial program 57.2%
Simplified49.2%
Taylor expanded in x.re around 0 59.1%
add-sqr-sqrt40.7%
unpow240.7%
swap-sqr55.7%
unpow255.7%
Applied egg-rr55.7%
unpow255.7%
*-commutative55.7%
associate-*r*55.8%
associate-*r*55.7%
add-sqr-sqrt79.8%
*-commutative79.8%
Applied egg-rr79.8%
associate-*r*79.8%
*-commutative79.8%
add-log-exp41.9%
*-un-lft-identity41.9%
1-exp41.9%
mul0-lft41.9%
*-commutative41.9%
mul0-lft41.9%
metadata-eval41.9%
distribute-rgt1-in41.9%
exp-sum41.9%
+-commutative41.9%
add-log-exp79.8%
*-commutative79.8%
distribute-rgt-in79.8%
fma-define79.8%
Applied egg-rr79.9%
fma-undefine79.9%
mul0-rgt79.9%
+-rgt-identity79.9%
associate-*r*79.8%
associate-*l*79.9%
*-commutative79.9%
Applied egg-rr79.9%
if 4.99999999999999991e108 < x.im < 1.42e147Initial program 85.7%
Simplified71.2%
Taylor expanded in x.re around 0 85.7%
add-sqr-sqrt28.6%
unpow228.6%
swap-sqr28.6%
unpow228.6%
Applied egg-rr28.6%
unpow228.6%
*-commutative28.6%
associate-*r*28.6%
associate-*r*28.6%
add-sqr-sqrt85.5%
*-commutative85.5%
Applied egg-rr85.5%
associate-*r*85.3%
*-commutative85.3%
add-log-exp31.0%
*-un-lft-identity31.0%
1-exp31.0%
mul0-lft31.0%
*-commutative31.0%
mul0-lft31.0%
metadata-eval31.0%
distribute-rgt1-in31.0%
exp-sum31.0%
+-commutative31.0%
add-log-exp85.3%
*-commutative85.3%
distribute-rgt-in85.3%
fma-define85.3%
Applied egg-rr85.5%
fma-undefine85.5%
mul0-rgt85.5%
+-rgt-identity85.5%
associate-*r*85.3%
*-commutative85.3%
associate-*l*85.5%
Applied egg-rr85.5%
Final simplification67.2%
x.re\_m = (fabs.f64 x.re)
x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re)
(FPCore (x.re_s x.re_m x.im)
:precision binary64
(let* ((t_0 (* (* x.re_m x.im) (* x.im -3.0)))
(t_1 (* x.re_m (* (- x.re_m x.im) (- x.re_m x.im)))))
(*
x.re_s
(if (<= x.im 5800000000.0)
(* (- x.re_m x.im) (* x.re_m (- x.re_m x.im)))
(if (<= x.im 2e+82)
t_0
(if (<= x.im 5.2e+108)
t_1
(if (<= x.im 1.42e+147)
(* x.im (* x.re_m (* x.im -3.0)))
(if (<= x.im 1.05e+148)
t_1
(if (<= x.im 9e+181)
t_0
(if (<= x.im 1.45e+182)
t_1
(* x.im (* x.im (* x.re_m -3.0)))))))))))))x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 5800000000.0) {
tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
} else if (x_46_im <= 2e+82) {
tmp = t_0;
} else if (x_46_im <= 5.2e+108) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if (x_46_im <= 1.05e+148) {
tmp = t_1;
} else if (x_46_im <= 9e+181) {
tmp = t_0;
} else if (x_46_im <= 1.45e+182) {
tmp = t_1;
} else {
tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0));
}
return x_46_re_s * tmp;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = (x_46re_m * x_46im) * (x_46im * (-3.0d0))
t_1 = x_46re_m * ((x_46re_m - x_46im) * (x_46re_m - x_46im))
if (x_46im <= 5800000000.0d0) then
tmp = (x_46re_m - x_46im) * (x_46re_m * (x_46re_m - x_46im))
else if (x_46im <= 2d+82) then
tmp = t_0
else if (x_46im <= 5.2d+108) then
tmp = t_1
else if (x_46im <= 1.42d+147) then
tmp = x_46im * (x_46re_m * (x_46im * (-3.0d0)))
else if (x_46im <= 1.05d+148) then
tmp = t_1
else if (x_46im <= 9d+181) then
tmp = t_0
else if (x_46im <= 1.45d+182) then
tmp = t_1
else
tmp = x_46im * (x_46im * (x_46re_m * (-3.0d0)))
end if
code = x_46re_s * tmp
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0);
double t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im));
double tmp;
if (x_46_im <= 5800000000.0) {
tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im));
} else if (x_46_im <= 2e+82) {
tmp = t_0;
} else if (x_46_im <= 5.2e+108) {
tmp = t_1;
} else if (x_46_im <= 1.42e+147) {
tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0));
} else if (x_46_im <= 1.05e+148) {
tmp = t_1;
} else if (x_46_im <= 9e+181) {
tmp = t_0;
} else if (x_46_im <= 1.45e+182) {
tmp = t_1;
} else {
tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0));
}
return x_46_re_s * tmp;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0) t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)) tmp = 0 if x_46_im <= 5800000000.0: tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im)) elif x_46_im <= 2e+82: tmp = t_0 elif x_46_im <= 5.2e+108: tmp = t_1 elif x_46_im <= 1.42e+147: tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)) elif x_46_im <= 1.05e+148: tmp = t_1 elif x_46_im <= 9e+181: tmp = t_0 elif x_46_im <= 1.45e+182: tmp = t_1 else: tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0)) return x_46_re_s * tmp
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0)) t_1 = Float64(x_46_re_m * Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m - x_46_im))) tmp = 0.0 if (x_46_im <= 5800000000.0) tmp = Float64(Float64(x_46_re_m - x_46_im) * Float64(x_46_re_m * Float64(x_46_re_m - x_46_im))); elseif (x_46_im <= 2e+82) tmp = t_0; elseif (x_46_im <= 5.2e+108) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = Float64(x_46_im * Float64(x_46_re_m * Float64(x_46_im * -3.0))); elseif (x_46_im <= 1.05e+148) tmp = t_1; elseif (x_46_im <= 9e+181) tmp = t_0; elseif (x_46_im <= 1.45e+182) tmp = t_1; else tmp = Float64(x_46_im * Float64(x_46_im * Float64(x_46_re_m * -3.0))); end return Float64(x_46_re_s * tmp) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp_2 = code(x_46_re_s, x_46_re_m, x_46_im) t_0 = (x_46_re_m * x_46_im) * (x_46_im * -3.0); t_1 = x_46_re_m * ((x_46_re_m - x_46_im) * (x_46_re_m - x_46_im)); tmp = 0.0; if (x_46_im <= 5800000000.0) tmp = (x_46_re_m - x_46_im) * (x_46_re_m * (x_46_re_m - x_46_im)); elseif (x_46_im <= 2e+82) tmp = t_0; elseif (x_46_im <= 5.2e+108) tmp = t_1; elseif (x_46_im <= 1.42e+147) tmp = x_46_im * (x_46_re_m * (x_46_im * -3.0)); elseif (x_46_im <= 1.05e+148) tmp = t_1; elseif (x_46_im <= 9e+181) tmp = t_0; elseif (x_46_im <= 1.45e+182) tmp = t_1; else tmp = x_46_im * (x_46_im * (x_46_re_m * -3.0)); end tmp_2 = x_46_re_s * tmp; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(x$46$re$95$m * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(x$46$re$95$s * If[LessEqual[x$46$im, 5800000000.0], N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * N[(x$46$re$95$m * N[(x$46$re$95$m - x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 2e+82], t$95$0, If[LessEqual[x$46$im, 5.2e+108], t$95$1, If[LessEqual[x$46$im, 1.42e+147], N[(x$46$im * N[(x$46$re$95$m * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 1.05e+148], t$95$1, If[LessEqual[x$46$im, 9e+181], t$95$0, If[LessEqual[x$46$im, 1.45e+182], t$95$1, N[(x$46$im * N[(x$46$im * N[(x$46$re$95$m * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]), $MachinePrecision]]]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\\
t_1 := x.re\_m \cdot \left(\left(x.re\_m - x.im\right) \cdot \left(x.re\_m - x.im\right)\right)\\
x.re\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im \leq 5800000000:\\
\;\;\;\;\left(x.re\_m - x.im\right) \cdot \left(x.re\_m \cdot \left(x.re\_m - x.im\right)\right)\\
\mathbf{elif}\;x.im \leq 2 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 5.2 \cdot 10^{+108}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq 1.42 \cdot 10^{+147}:\\
\;\;\;\;x.im \cdot \left(x.re\_m \cdot \left(x.im \cdot -3\right)\right)\\
\mathbf{elif}\;x.im \leq 1.05 \cdot 10^{+148}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x.im \leq 9 \cdot 10^{+181}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x.im \leq 1.45 \cdot 10^{+182}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x.im \cdot \left(x.im \cdot \left(x.re\_m \cdot -3\right)\right)\\
\end{array}
\end{array}
\end{array}
if x.im < 5.8e9Initial program 83.2%
difference-of-squares82.3%
*-commutative82.3%
Applied egg-rr86.9%
*-commutative86.9%
*-un-lft-identity86.9%
distribute-lft-in86.9%
distribute-rgt-out86.9%
metadata-eval86.9%
Applied egg-rr86.9%
cancel-sign-sub-inv86.9%
associate-*l*92.1%
*-commutative92.1%
fma-define92.1%
+-commutative92.1%
associate-*l*92.1%
Applied egg-rr92.1%
fma-undefine92.1%
+-commutative92.1%
Applied egg-rr63.5%
mul0-rgt63.5%
mul0-rgt63.5%
+-lft-identity63.5%
*-commutative63.5%
associate-*l*63.5%
Simplified63.5%
associate-*r*63.5%
sub-neg63.5%
distribute-lft-in52.2%
Applied egg-rr52.2%
distribute-lft-out63.5%
sub-neg63.5%
Simplified63.5%
if 5.8e9 < x.im < 1.9999999999999999e82 or 1.04999999999999999e148 < x.im < 9e181Initial program 80.1%
Simplified80.1%
Taylor expanded in x.re around 0 60.0%
add-sqr-sqrt45.0%
unpow245.0%
swap-sqr54.5%
unpow254.5%
Applied egg-rr54.5%
unpow254.5%
*-commutative54.5%
associate-*r*54.6%
associate-*r*54.6%
add-sqr-sqrt69.7%
*-commutative69.7%
Applied egg-rr69.7%
associate-*r*69.7%
*-commutative69.7%
add-log-exp17.2%
*-un-lft-identity17.2%
1-exp17.2%
mul0-lft17.2%
*-commutative17.2%
mul0-lft17.2%
metadata-eval17.2%
distribute-rgt1-in17.2%
exp-sum17.2%
+-commutative17.2%
add-log-exp69.7%
*-commutative69.7%
distribute-rgt-in69.7%
fma-define69.7%
Applied egg-rr69.7%
fma-undefine69.7%
mul0-rgt69.7%
+-rgt-identity69.7%
associate-*r*69.7%
associate-*l*70.0%
*-commutative70.0%
Applied egg-rr70.0%
if 1.9999999999999999e82 < x.im < 5.2000000000000005e108 or 1.42e147 < x.im < 1.04999999999999999e148 or 9e181 < x.im < 1.4499999999999999e182Initial program 39.7%
difference-of-squares67.1%
*-commutative67.1%
Applied egg-rr39.7%
*-commutative39.7%
*-un-lft-identity39.7%
distribute-lft-in39.7%
distribute-rgt-out39.7%
metadata-eval39.7%
Applied egg-rr39.7%
cancel-sign-sub-inv39.7%
associate-*l*39.7%
*-commutative39.7%
fma-define39.7%
+-commutative39.7%
associate-*l*39.7%
Applied egg-rr39.7%
fma-undefine39.7%
+-commutative39.7%
Applied egg-rr60.6%
mul0-rgt60.6%
mul0-rgt60.6%
+-lft-identity60.6%
*-commutative60.6%
associate-*l*60.6%
Simplified60.6%
if 5.2000000000000005e108 < x.im < 1.42e147Initial program 85.7%
Simplified71.2%
Taylor expanded in x.re around 0 85.7%
add-sqr-sqrt28.6%
unpow228.6%
swap-sqr28.6%
unpow228.6%
Applied egg-rr28.6%
unpow228.6%
*-commutative28.6%
associate-*r*28.6%
associate-*r*28.6%
add-sqr-sqrt85.5%
*-commutative85.5%
Applied egg-rr85.5%
associate-*r*85.3%
*-commutative85.3%
add-log-exp31.0%
*-un-lft-identity31.0%
1-exp31.0%
mul0-lft31.0%
*-commutative31.0%
mul0-lft31.0%
metadata-eval31.0%
distribute-rgt1-in31.0%
exp-sum31.0%
+-commutative31.0%
add-log-exp85.3%
*-commutative85.3%
distribute-rgt-in85.3%
fma-define85.3%
Applied egg-rr85.5%
fma-undefine85.5%
mul0-rgt85.5%
+-rgt-identity85.5%
associate-*r*85.3%
*-commutative85.3%
associate-*l*85.5%
Applied egg-rr85.5%
if 1.4499999999999999e182 < x.im Initial program 41.9%
Simplified28.5%
Taylor expanded in x.re around 0 58.5%
add-sqr-sqrt37.8%
unpow237.8%
swap-sqr56.5%
unpow256.5%
Applied egg-rr56.5%
unpow256.5%
*-commutative56.5%
associate-*r*56.6%
associate-*r*56.5%
add-sqr-sqrt86.5%
*-commutative86.5%
Applied egg-rr86.5%
associate-*r*86.6%
*-commutative86.6%
add-log-exp58.4%
*-un-lft-identity58.4%
1-exp58.4%
mul0-lft58.4%
*-commutative58.4%
mul0-lft58.4%
metadata-eval58.4%
distribute-rgt1-in58.4%
exp-sum58.4%
+-commutative58.4%
add-log-exp86.6%
*-commutative86.6%
distribute-rgt-in86.6%
fma-define86.6%
Applied egg-rr86.6%
fma-undefine86.6%
mul0-rgt86.6%
+-rgt-identity86.6%
associate-*r*86.6%
*-commutative86.6%
associate-*l*86.6%
Applied egg-rr86.6%
add-log-exp58.4%
*-un-lft-identity58.4%
log-prod58.4%
metadata-eval58.4%
add-log-exp86.6%
associate-*r*86.6%
*-commutative86.6%
associate-*l*86.6%
Applied egg-rr86.6%
Final simplification67.3%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s (* (* x.re_m x.im) (* x.im -3.0))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0));
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * ((x_46re_m * x_46im) * (x_46im * (-3.0d0)))
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0));
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0))
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * Float64(Float64(x_46_re_m * x_46_im) * Float64(x_46_im * -3.0))) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * ((x_46_re_m * x_46_im) * (x_46_im * -3.0)); end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] * N[(x$46$im * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \left(\left(x.re\_m \cdot x.im\right) \cdot \left(x.im \cdot -3\right)\right)
\end{array}
Initial program 77.4%
Simplified73.9%
Taylor expanded in x.re around 0 49.8%
add-sqr-sqrt24.7%
unpow224.7%
swap-sqr29.4%
unpow229.4%
Applied egg-rr29.4%
unpow229.4%
*-commutative29.4%
associate-*r*29.4%
associate-*r*29.4%
add-sqr-sqrt57.8%
*-commutative57.8%
Applied egg-rr57.8%
associate-*r*57.8%
*-commutative57.8%
add-log-exp34.2%
*-un-lft-identity34.2%
1-exp34.2%
mul0-lft34.2%
*-commutative34.2%
mul0-lft34.2%
metadata-eval34.2%
distribute-rgt1-in34.2%
exp-sum34.2%
+-commutative34.2%
add-log-exp57.8%
*-commutative57.8%
distribute-rgt-in57.8%
fma-define57.8%
Applied egg-rr57.8%
fma-undefine57.8%
mul0-rgt57.8%
+-rgt-identity57.8%
associate-*r*57.8%
associate-*l*57.9%
*-commutative57.9%
Applied egg-rr57.9%
Final simplification57.9%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s (* -3.0 (* x.im (* x.re_m x.im)))))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * ((-3.0d0) * (x_46im * (x_46re_m * x_46im)))
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)));
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im)))
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * Float64(-3.0 * Float64(x_46_im * Float64(x_46_re_m * x_46_im)))) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * (-3.0 * (x_46_im * (x_46_re_m * x_46_im))); end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * N[(-3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot \left(-3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.im\right)\right)\right)
\end{array}
Initial program 77.4%
Simplified73.9%
Taylor expanded in x.re around 0 49.8%
add-sqr-sqrt24.7%
unpow224.7%
swap-sqr29.4%
unpow229.4%
Applied egg-rr29.4%
unpow229.4%
*-commutative29.4%
associate-*r*29.4%
associate-*r*29.4%
add-sqr-sqrt57.8%
*-commutative57.8%
Applied egg-rr57.8%
Final simplification57.8%
x.re\_m = (fabs.f64 x.re) x.re\_s = (copysign.f64 #s(literal 1 binary64) x.re) (FPCore (x.re_s x.re_m x.im) :precision binary64 (* x.re_s x.im))
x.re\_m = fabs(x_46_re);
x.re\_s = copysign(1.0, x_46_re);
double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * x_46_im;
}
x.re\_m = abs(x_46re)
x.re\_s = copysign(1.0d0, x_46re)
real(8) function code(x_46re_s, x_46re_m, x_46im)
real(8), intent (in) :: x_46re_s
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = x_46re_s * x_46im
end function
x.re\_m = Math.abs(x_46_re);
x.re\_s = Math.copySign(1.0, x_46_re);
public static double code(double x_46_re_s, double x_46_re_m, double x_46_im) {
return x_46_re_s * x_46_im;
}
x.re\_m = math.fabs(x_46_re) x.re\_s = math.copysign(1.0, x_46_re) def code(x_46_re_s, x_46_re_m, x_46_im): return x_46_re_s * x_46_im
x.re\_m = abs(x_46_re) x.re\_s = copysign(1.0, x_46_re) function code(x_46_re_s, x_46_re_m, x_46_im) return Float64(x_46_re_s * x_46_im) end
x.re\_m = abs(x_46_re); x.re\_s = sign(x_46_re) * abs(1.0); function tmp = code(x_46_re_s, x_46_re_m, x_46_im) tmp = x_46_re_s * x_46_im; end
x.re\_m = N[Abs[x$46$re], $MachinePrecision]
x.re\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$re$95$s_, x$46$re$95$m_, x$46$im_] := N[(x$46$re$95$s * x$46$im), $MachinePrecision]
\begin{array}{l}
x.re\_m = \left|x.re\right|
\\
x.re\_s = \mathsf{copysign}\left(1, x.re\right)
\\
x.re\_s \cdot x.im
\end{array}
Initial program 77.4%
difference-of-squares77.7%
*-commutative77.7%
Applied egg-rr82.1%
associate-*l*90.1%
fma-neg90.1%
*-commutative90.1%
distribute-rgt-neg-in90.1%
*-commutative90.1%
flip-+0.0%
*-commutative0.0%
+-inverses0.0%
+-inverses0.0%
*-commutative0.0%
distribute-neg-frac20.0%
Applied egg-rr0.0%
Simplified64.1%
Taylor expanded in x.re around 0 3.2%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im)))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
real(8) function code(x_46re, x_46im)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im
code = ((x_46re * x_46re) * (x_46re - x_46im)) + ((x_46re * x_46im) * (x_46re - (3.0d0 * x_46im)))
end function
public static double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im)))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_re) * Float64(x_46_re - x_46_im)) + Float64(Float64(x_46_re * x_46_im) * Float64(x_46_re - Float64(3.0 * x_46_im)))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_re) * (x_46_re - x_46_im)) + ((x_46_re * x_46_im) * (x_46_re - (3.0 * x_46_im))); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(x$46$re - N[(3.0 * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re\right) \cdot \left(x.re - x.im\right) + \left(x.re \cdot x.im\right) \cdot \left(x.re - 3 \cdot x.im\right)
\end{array}
herbie shell --seed 2024107
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:alt
(+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3.0 x.im))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))