
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
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_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
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_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) 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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); 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$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x.re x.im) :precision binary64 (+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
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_46im) + (((x_46re * x_46im) + (x_46im * x_46re)) * x_46re)
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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re);
}
def code(x_46_re, x_46_im): return (((x_46_re * x_46_re) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re)
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_im) + Float64(Float64(Float64(x_46_re * x_46_im) + Float64(x_46_im * x_46_re)) * x_46_re)) 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_im) + (((x_46_re * x_46_im) + (x_46_im * x_46_re)) * x_46_re); 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$im), $MachinePrecision] + N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.re - x.im \cdot x.im\right) \cdot x.im + \left(x.re \cdot x.im + x.im \cdot x.re\right) \cdot x.re
\end{array}
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 1.2e+98)
(- (* (* x.re (* x.im_m x.re)) 3.0) (pow x.im_m 3.0))
(+ (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) -3.0))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e+98) {
tmp = ((x_46_re * (x_46_im_m * x_46_re)) * 3.0) - pow(x_46_im_m, 3.0);
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 1.2d+98) then
tmp = ((x_46re * (x_46im_m * x_46re)) * 3.0d0) - (x_46im_m ** 3.0d0)
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) + (-3.0d0)
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e+98) {
tmp = ((x_46_re * (x_46_im_m * x_46_re)) * 3.0) - Math.pow(x_46_im_m, 3.0);
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 1.2e+98: tmp = ((x_46_re * (x_46_im_m * x_46_re)) * 3.0) - math.pow(x_46_im_m, 3.0) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0 return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 1.2e+98) tmp = Float64(Float64(Float64(x_46_re * Float64(x_46_im_m * x_46_re)) * 3.0) - (x_46_im_m ^ 3.0)); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) + -3.0); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 1.2e+98) tmp = ((x_46_re * (x_46_im_m * x_46_re)) * 3.0) - (x_46_im_m ^ 3.0); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 1.2e+98], N[(N[(N[(x$46$re * N[(x$46$im$95$m * x$46$re), $MachinePrecision]), $MachinePrecision] * 3.0), $MachinePrecision] - N[Power[x$46$im$95$m, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -3.0), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 1.2 \cdot 10^{+98}:\\
\;\;\;\;\left(x.re \cdot \left(x.im\_m \cdot x.re\right)\right) \cdot 3 - {x.im\_m}^{3}\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) + -3\\
\end{array}
\end{array}
if x.im < 1.1999999999999999e98Initial program 82.1%
Simplified89.5%
if 1.1999999999999999e98 < x.im Initial program 62.8%
Taylor expanded in x.re around 0 62.8%
Simplified79.1%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification91.3%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 1.2e+98)
(- (* x.re (* 3.0 (* x.im_m x.re))) (pow x.im_m 3.0))
(+ (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) -3.0))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e+98) {
tmp = (x_46_re * (3.0 * (x_46_im_m * x_46_re))) - pow(x_46_im_m, 3.0);
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 1.2d+98) then
tmp = (x_46re * (3.0d0 * (x_46im_m * x_46re))) - (x_46im_m ** 3.0d0)
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) + (-3.0d0)
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e+98) {
tmp = (x_46_re * (3.0 * (x_46_im_m * x_46_re))) - Math.pow(x_46_im_m, 3.0);
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 1.2e+98: tmp = (x_46_re * (3.0 * (x_46_im_m * x_46_re))) - math.pow(x_46_im_m, 3.0) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0 return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 1.2e+98) tmp = Float64(Float64(x_46_re * Float64(3.0 * Float64(x_46_im_m * x_46_re))) - (x_46_im_m ^ 3.0)); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) + -3.0); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 1.2e+98) tmp = (x_46_re * (3.0 * (x_46_im_m * x_46_re))) - (x_46_im_m ^ 3.0); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 1.2e+98], N[(N[(x$46$re * N[(3.0 * N[(x$46$im$95$m * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[x$46$im$95$m, 3.0], $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -3.0), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 1.2 \cdot 10^{+98}:\\
\;\;\;\;x.re \cdot \left(3 \cdot \left(x.im\_m \cdot x.re\right)\right) - {x.im\_m}^{3}\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) + -3\\
\end{array}
\end{array}
if x.im < 1.1999999999999999e98Initial program 82.1%
Simplified89.5%
Taylor expanded in x.re around 0 89.5%
if 1.1999999999999999e98 < x.im Initial program 62.8%
Taylor expanded in x.re around 0 62.8%
Simplified79.1%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification91.3%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(let* ((t_0 (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))))
(t_1
(+
(* x.im_m (- (* x.re x.re) (* x.im_m x.im_m)))
(* x.re (+ (* x.im_m x.re) (* x.im_m x.re)))))
(t_2 (* x.re (* (* x.im_m x.re) 2.0))))
(*
x.im_s
(if (<= t_1 5e+305)
(+ t_0 t_2)
(if (<= t_1 INFINITY)
(+ t_2 (* (+ x.im_m x.re) (* x.im_m x.re)))
(+ t_0 -3.0))))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double t_0 = x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re));
double t_1 = (x_46_im_m * ((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m))) + (x_46_re * ((x_46_im_m * x_46_re) + (x_46_im_m * x_46_re)));
double t_2 = x_46_re * ((x_46_im_m * x_46_re) * 2.0);
double tmp;
if (t_1 <= 5e+305) {
tmp = t_0 + t_2;
} else if (t_1 <= ((double) INFINITY)) {
tmp = t_2 + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re));
} else {
tmp = t_0 + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double t_0 = x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re));
double t_1 = (x_46_im_m * ((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m))) + (x_46_re * ((x_46_im_m * x_46_re) + (x_46_im_m * x_46_re)));
double t_2 = x_46_re * ((x_46_im_m * x_46_re) * 2.0);
double tmp;
if (t_1 <= 5e+305) {
tmp = t_0 + t_2;
} else if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_2 + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re));
} else {
tmp = t_0 + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): t_0 = x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re)) t_1 = (x_46_im_m * ((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m))) + (x_46_re * ((x_46_im_m * x_46_re) + (x_46_im_m * x_46_re))) t_2 = x_46_re * ((x_46_im_m * x_46_re) * 2.0) tmp = 0 if t_1 <= 5e+305: tmp = t_0 + t_2 elif t_1 <= math.inf: tmp = t_2 + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re)) else: tmp = t_0 + -3.0 return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) t_0 = Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) t_1 = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m))) + Float64(x_46_re * Float64(Float64(x_46_im_m * x_46_re) + Float64(x_46_im_m * x_46_re)))) t_2 = Float64(x_46_re * Float64(Float64(x_46_im_m * x_46_re) * 2.0)) tmp = 0.0 if (t_1 <= 5e+305) tmp = Float64(t_0 + t_2); elseif (t_1 <= Inf) tmp = Float64(t_2 + Float64(Float64(x_46_im_m + x_46_re) * Float64(x_46_im_m * x_46_re))); else tmp = Float64(t_0 + -3.0); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) t_0 = x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re)); t_1 = (x_46_im_m * ((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m))) + (x_46_re * ((x_46_im_m * x_46_re) + (x_46_im_m * x_46_re))); t_2 = x_46_re * ((x_46_im_m * x_46_re) * 2.0); tmp = 0.0; if (t_1 <= 5e+305) tmp = t_0 + t_2; elseif (t_1 <= Inf) tmp = t_2 + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re)); else tmp = t_0 + -3.0; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := Block[{t$95$0 = N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(x$46$im$95$m * N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x$46$re * N[(N[(x$46$im$95$m * x$46$re), $MachinePrecision] + N[(x$46$im$95$m * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x$46$re * N[(N[(x$46$im$95$m * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision]}, N[(x$46$im$95$s * If[LessEqual[t$95$1, 5e+305], N[(t$95$0 + t$95$2), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$2 + N[(N[(x$46$im$95$m + x$46$re), $MachinePrecision] * N[(x$46$im$95$m * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 + -3.0), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
\begin{array}{l}
t_0 := x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right)\\
t_1 := x.im\_m \cdot \left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) + x.re \cdot \left(x.im\_m \cdot x.re + x.im\_m \cdot x.re\right)\\
t_2 := x.re \cdot \left(\left(x.im\_m \cdot x.re\right) \cdot 2\right)\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{+305}:\\
\;\;\;\;t\_0 + t\_2\\
\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;t\_2 + \left(x.im\_m + x.re\right) \cdot \left(x.im\_m \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 + -3\\
\end{array}
\end{array}
\end{array}
if (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) < 5.00000000000000009e305Initial program 95.0%
difference-of-squares37.2%
*-commutative37.2%
Applied egg-rr95.0%
*-commutative95.0%
count-295.0%
*-commutative95.0%
Applied egg-rr95.0%
if 5.00000000000000009e305 < (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) < +inf.0Initial program 77.3%
difference-of-squares77.3%
Applied egg-rr77.3%
Simplified38.3%
pow138.3%
associate-*l*60.8%
*-commutative60.8%
Applied egg-rr60.8%
Simplified60.8%
Taylor expanded in x.re around inf 66.5%
*-commutative77.3%
count-277.3%
*-commutative77.3%
Applied egg-rr66.5%
if +inf.0 < (+.f64 (*.f64 (-.f64 (*.f64 x.re x.re) (*.f64 x.im x.im)) x.im) (*.f64 (+.f64 (*.f64 x.re x.im) (*.f64 x.im x.re)) x.re)) Initial program 0.0%
Taylor expanded in x.re around 0 0.0%
Simplified50.0%
difference-of-squares100.0%
*-commutative100.0%
Applied egg-rr100.0%
Final simplification91.2%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 1.2e-62)
(+ (* x.re (* (* x.im_m x.re) 2.0)) (* (+ x.im_m x.re) (* x.im_m x.re)))
(- (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) x.re))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e-62) {
tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 1.2d-62) then
tmp = (x_46re * ((x_46im_m * x_46re) * 2.0d0)) + ((x_46im_m + x_46re) * (x_46im_m * x_46re))
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) - x_46re
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.2e-62) {
tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 1.2e-62: tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re)) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 1.2e-62) tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_im_m * x_46_re) * 2.0)) + Float64(Float64(x_46_im_m + x_46_re) * Float64(x_46_im_m * x_46_re))); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) - x_46_re); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 1.2e-62) tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + ((x_46_im_m + x_46_re) * (x_46_im_m * x_46_re)); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 1.2e-62], N[(N[(x$46$re * N[(N[(x$46$im$95$m * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$im$95$m + x$46$re), $MachinePrecision] * N[(x$46$im$95$m * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 1.2 \cdot 10^{-62}:\\
\;\;\;\;x.re \cdot \left(\left(x.im\_m \cdot x.re\right) \cdot 2\right) + \left(x.im\_m + x.re\right) \cdot \left(x.im\_m \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) - x.re\\
\end{array}
\end{array}
if x.im < 1.19999999999999992e-62Initial program 79.0%
difference-of-squares80.1%
Applied egg-rr80.1%
Simplified41.0%
pow141.0%
associate-*l*50.7%
*-commutative50.7%
Applied egg-rr50.7%
Simplified50.7%
Taylor expanded in x.re around inf 70.0%
*-commutative80.1%
count-280.1%
*-commutative80.1%
Applied egg-rr70.0%
if 1.19999999999999992e-62 < x.im Initial program 78.4%
difference-of-squares86.0%
*-commutative86.0%
Applied egg-rr83.8%
*-commutative83.8%
count-283.8%
*-commutative83.8%
Applied egg-rr83.8%
pow183.8%
*-commutative83.8%
*-commutative83.8%
count-283.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified92.7%
Final simplification76.6%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 3.3e-63)
(+ (* x.re (* (* x.im_m x.re) 2.0)) (* x.im_m (* x.re (+ x.im_m x.re))))
(- (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) x.re))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.3e-63) {
tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + (x_46_im_m * (x_46_re * (x_46_im_m + x_46_re)));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 3.3d-63) then
tmp = (x_46re * ((x_46im_m * x_46re) * 2.0d0)) + (x_46im_m * (x_46re * (x_46im_m + x_46re)))
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) - x_46re
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.3e-63) {
tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + (x_46_im_m * (x_46_re * (x_46_im_m + x_46_re)));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 3.3e-63: tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + (x_46_im_m * (x_46_re * (x_46_im_m + x_46_re))) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 3.3e-63) tmp = Float64(Float64(x_46_re * Float64(Float64(x_46_im_m * x_46_re) * 2.0)) + Float64(x_46_im_m * Float64(x_46_re * Float64(x_46_im_m + x_46_re)))); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) - x_46_re); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 3.3e-63) tmp = (x_46_re * ((x_46_im_m * x_46_re) * 2.0)) + (x_46_im_m * (x_46_re * (x_46_im_m + x_46_re))); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 3.3e-63], N[(N[(x$46$re * N[(N[(x$46$im$95$m * x$46$re), $MachinePrecision] * 2.0), $MachinePrecision]), $MachinePrecision] + N[(x$46$im$95$m * N[(x$46$re * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 3.3 \cdot 10^{-63}:\\
\;\;\;\;x.re \cdot \left(\left(x.im\_m \cdot x.re\right) \cdot 2\right) + x.im\_m \cdot \left(x.re \cdot \left(x.im\_m + x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) - x.re\\
\end{array}
\end{array}
if x.im < 3.29999999999999994e-63Initial program 79.4%
difference-of-squares38.7%
*-commutative38.7%
Applied egg-rr80.5%
*-commutative80.5%
count-280.5%
*-commutative80.5%
Applied egg-rr80.5%
Taylor expanded in x.re around inf 60.5%
if 3.29999999999999994e-63 < x.im Initial program 77.5%
difference-of-squares85.0%
*-commutative85.0%
Applied egg-rr82.8%
*-commutative82.8%
count-282.8%
*-commutative82.8%
Applied egg-rr82.8%
pow182.8%
*-commutative82.8%
*-commutative82.8%
count-282.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified91.6%
Final simplification69.8%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 4.3e-63)
(* 3.0 (* x.im_m (* x.re x.re)))
(- (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) x.re))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 4.3e-63) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 4.3d-63) then
tmp = 3.0d0 * (x_46im_m * (x_46re * x_46re))
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) - x_46re
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 4.3e-63) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 4.3e-63: tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 4.3e-63) tmp = Float64(3.0 * Float64(x_46_im_m * Float64(x_46_re * x_46_re))); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) - x_46_re); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 4.3e-63) tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) - x_46_re; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 4.3e-63], N[(3.0 * N[(x$46$im$95$m * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - x$46$re), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 4.3 \cdot 10^{-63}:\\
\;\;\;\;3 \cdot \left(x.im\_m \cdot \left(x.re \cdot x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) - x.re\\
\end{array}
\end{array}
if x.im < 4.2999999999999999e-63Initial program 79.4%
Simplified87.6%
Taylor expanded in x.re around inf 58.6%
unpow258.6%
Applied egg-rr58.6%
if 4.2999999999999999e-63 < x.im Initial program 77.5%
difference-of-squares85.0%
*-commutative85.0%
Applied egg-rr82.8%
*-commutative82.8%
count-282.8%
*-commutative82.8%
Applied egg-rr82.8%
pow182.8%
*-commutative82.8%
*-commutative82.8%
count-282.8%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
Applied egg-rr0.0%
Simplified91.6%
Final simplification68.4%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 2.75e-15)
(* 3.0 (* x.im_m (* x.re x.re)))
(+ (* x.im_m (* (- x.re x.im_m) (+ x.im_m x.re))) -3.0))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 2.75e-15) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 2.75d-15) then
tmp = 3.0d0 * (x_46im_m * (x_46re * x_46re))
else
tmp = (x_46im_m * ((x_46re - x_46im_m) * (x_46im_m + x_46re))) + (-3.0d0)
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 2.75e-15) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0;
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 2.75e-15: tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)) else: tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0 return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 2.75e-15) tmp = Float64(3.0 * Float64(x_46_im_m * Float64(x_46_re * x_46_re))); else tmp = Float64(Float64(x_46_im_m * Float64(Float64(x_46_re - x_46_im_m) * Float64(x_46_im_m + x_46_re))) + -3.0); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 2.75e-15) tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)); else tmp = (x_46_im_m * ((x_46_re - x_46_im_m) * (x_46_im_m + x_46_re))) + -3.0; end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 2.75e-15], N[(3.0 * N[(x$46$im$95$m * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im$95$m * N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(x$46$im$95$m + x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -3.0), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 2.75 \cdot 10^{-15}:\\
\;\;\;\;3 \cdot \left(x.im\_m \cdot \left(x.re \cdot x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.im\_m \cdot \left(\left(x.re - x.im\_m\right) \cdot \left(x.im\_m + x.re\right)\right) + -3\\
\end{array}
\end{array}
if x.im < 2.7500000000000001e-15Initial program 79.9%
Simplified88.2%
Taylor expanded in x.re around inf 58.2%
unpow258.2%
Applied egg-rr58.2%
if 2.7500000000000001e-15 < x.im Initial program 75.6%
Taylor expanded in x.re around 0 75.6%
Simplified79.2%
difference-of-squares92.9%
*-commutative92.9%
Applied egg-rr92.9%
Final simplification67.1%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 3.5e+131)
(* 3.0 (* x.im_m (* x.re x.re)))
(+ -3.0 (* x.im_m (* x.im_m -3.0))))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.5e+131) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = -3.0 + (x_46_im_m * (x_46_im_m * -3.0));
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 3.5d+131) then
tmp = 3.0d0 * (x_46im_m * (x_46re * x_46re))
else
tmp = (-3.0d0) + (x_46im_m * (x_46im_m * (-3.0d0)))
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.5e+131) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = -3.0 + (x_46_im_m * (x_46_im_m * -3.0));
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 3.5e+131: tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)) else: tmp = -3.0 + (x_46_im_m * (x_46_im_m * -3.0)) return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 3.5e+131) tmp = Float64(3.0 * Float64(x_46_im_m * Float64(x_46_re * x_46_re))); else tmp = Float64(-3.0 + Float64(x_46_im_m * Float64(x_46_im_m * -3.0))); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 3.5e+131) tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)); else tmp = -3.0 + (x_46_im_m * (x_46_im_m * -3.0)); end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 3.5e+131], N[(3.0 * N[(x$46$im$95$m * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-3.0 + N[(x$46$im$95$m * N[(x$46$im$95$m * -3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 3.5 \cdot 10^{+131}:\\
\;\;\;\;3 \cdot \left(x.im\_m \cdot \left(x.re \cdot x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-3 + x.im\_m \cdot \left(x.im\_m \cdot -3\right)\\
\end{array}
\end{array}
if x.im < 3.4999999999999999e131Initial program 82.8%
Simplified89.0%
Taylor expanded in x.re around inf 54.3%
unpow254.3%
Applied egg-rr54.3%
if 3.4999999999999999e131 < x.im Initial program 52.9%
difference-of-squares64.7%
Applied egg-rr64.7%
Simplified48.3%
Taylor expanded in x.re around 0 39.5%
Simplified39.5%
Taylor expanded in x.re around 0 39.5%
Simplified72.1%
Final simplification56.7%
x.im\_m = (fabs.f64 x.im)
x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im)
(FPCore (x.im_s x.re x.im_m)
:precision binary64
(*
x.im_s
(if (<= x.im_m 3.5e+131)
(* 3.0 (* x.im_m (* x.re x.re)))
(- x.re (* x.im_m x.im_m)))))x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.5e+131) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = x_46_re - (x_46_im_m * x_46_im_m);
}
return x_46_im_s * tmp;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (x_46im_m <= 3.5d+131) then
tmp = 3.0d0 * (x_46im_m * (x_46re * x_46re))
else
tmp = x_46re - (x_46im_m * x_46im_m)
end if
code = x_46im_s * tmp
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 3.5e+131) {
tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re));
} else {
tmp = x_46_re - (x_46_im_m * x_46_im_m);
}
return x_46_im_s * tmp;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): tmp = 0 if x_46_im_m <= 3.5e+131: tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)) else: tmp = x_46_re - (x_46_im_m * x_46_im_m) return x_46_im_s * tmp
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 3.5e+131) tmp = Float64(3.0 * Float64(x_46_im_m * Float64(x_46_re * x_46_re))); else tmp = Float64(x_46_re - Float64(x_46_im_m * x_46_im_m)); end return Float64(x_46_im_s * tmp) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp_2 = code(x_46_im_s, x_46_re, x_46_im_m) tmp = 0.0; if (x_46_im_m <= 3.5e+131) tmp = 3.0 * (x_46_im_m * (x_46_re * x_46_re)); else tmp = x_46_re - (x_46_im_m * x_46_im_m); end tmp_2 = x_46_im_s * tmp; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * If[LessEqual[x$46$im$95$m, 3.5e+131], N[(3.0 * N[(x$46$im$95$m * N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \begin{array}{l}
\mathbf{if}\;x.im\_m \leq 3.5 \cdot 10^{+131}:\\
\;\;\;\;3 \cdot \left(x.im\_m \cdot \left(x.re \cdot x.re\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x.re - x.im\_m \cdot x.im\_m\\
\end{array}
\end{array}
if x.im < 3.4999999999999999e131Initial program 82.8%
Simplified89.0%
Taylor expanded in x.re around inf 54.3%
unpow254.3%
Applied egg-rr54.3%
if 3.4999999999999999e131 < x.im Initial program 52.9%
difference-of-squares64.7%
Applied egg-rr64.7%
Simplified48.3%
pow148.3%
associate-*l*48.3%
*-commutative48.3%
Applied egg-rr48.3%
Simplified48.3%
+-commutative48.3%
*-commutative48.3%
fma-define51.2%
*-commutative51.2%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-commutative0.0%
Applied egg-rr0.0%
Simplified57.1%
Taylor expanded in x.re around 0 72.1%
Simplified72.1%
Final simplification56.7%
x.im\_m = (fabs.f64 x.im) x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im) (FPCore (x.im_s x.re x.im_m) :precision binary64 (* x.im_s (- x.re (* x.im_m x.im_m))))
x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
return x_46_im_s * (x_46_re - (x_46_im_m * x_46_im_m));
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
code = x_46im_s * (x_46re - (x_46im_m * x_46im_m))
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
return x_46_im_s * (x_46_re - (x_46_im_m * x_46_im_m));
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): return x_46_im_s * (x_46_re - (x_46_im_m * x_46_im_m))
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) return Float64(x_46_im_s * Float64(x_46_re - Float64(x_46_im_m * x_46_im_m))) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp = code(x_46_im_s, x_46_re, x_46_im_m) tmp = x_46_im_s * (x_46_re - (x_46_im_m * x_46_im_m)); end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * N[(x$46$re - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot \left(x.re - x.im\_m \cdot x.im\_m\right)
\end{array}
Initial program 78.8%
difference-of-squares81.2%
Applied egg-rr81.2%
Simplified41.2%
pow141.2%
associate-*l*48.0%
*-commutative48.0%
Applied egg-rr48.0%
Simplified48.0%
+-commutative48.0%
*-commutative48.0%
fma-define48.4%
*-commutative48.4%
flip-+0.0%
+-inverses0.0%
+-inverses0.0%
+-commutative0.0%
Applied egg-rr0.0%
Simplified26.7%
Taylor expanded in x.re around 0 13.7%
Simplified13.7%
Final simplification13.7%
x.im\_m = (fabs.f64 x.im) x.im\_s = (copysign.f64 #s(literal 1 binary64) x.im) (FPCore (x.im_s x.re x.im_m) :precision binary64 (* x.im_s -27.0))
x.im\_m = fabs(x_46_im);
x.im\_s = copysign(1.0, x_46_im);
double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
return x_46_im_s * -27.0;
}
x.im\_m = abs(x_46im)
x.im\_s = copysign(1.0d0, x_46im)
real(8) function code(x_46im_s, x_46re, x_46im_m)
real(8), intent (in) :: x_46im_s
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
code = x_46im_s * (-27.0d0)
end function
x.im\_m = Math.abs(x_46_im);
x.im\_s = Math.copySign(1.0, x_46_im);
public static double code(double x_46_im_s, double x_46_re, double x_46_im_m) {
return x_46_im_s * -27.0;
}
x.im\_m = math.fabs(x_46_im) x.im\_s = math.copysign(1.0, x_46_im) def code(x_46_im_s, x_46_re, x_46_im_m): return x_46_im_s * -27.0
x.im\_m = abs(x_46_im) x.im\_s = copysign(1.0, x_46_im) function code(x_46_im_s, x_46_re, x_46_im_m) return Float64(x_46_im_s * -27.0) end
x.im\_m = abs(x_46_im); x.im\_s = sign(x_46_im) * abs(1.0); function tmp = code(x_46_im_s, x_46_re, x_46_im_m) tmp = x_46_im_s * -27.0; end
x.im\_m = N[Abs[x$46$im], $MachinePrecision]
x.im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[x$46$im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[x$46$im$95$s_, x$46$re_, x$46$im$95$m_] := N[(x$46$im$95$s * -27.0), $MachinePrecision]
\begin{array}{l}
x.im\_m = \left|x.im\right|
\\
x.im\_s = \mathsf{copysign}\left(1, x.im\right)
\\
x.im\_s \cdot -27
\end{array}
Initial program 78.8%
difference-of-squares81.2%
Applied egg-rr81.2%
Simplified41.2%
Taylor expanded in x.re around 0 34.6%
Simplified34.6%
Taylor expanded in x.re around 0 33.6%
Simplified12.9%
Taylor expanded in x.im around 0 2.8%
Simplified2.8%
(FPCore (x.re x.im) :precision binary64 (+ (* (* x.re x.im) (* 2.0 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im))))
double code(double x_46_re, double x_46_im) {
return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - 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_46im) * (2.0d0 * x_46re)) + ((x_46im * (x_46re - 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_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im));
}
def code(x_46_re, x_46_im): return ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im))
function code(x_46_re, x_46_im) return Float64(Float64(Float64(x_46_re * x_46_im) * Float64(2.0 * x_46_re)) + Float64(Float64(x_46_im * Float64(x_46_re - x_46_im)) * Float64(x_46_re + x_46_im))) end
function tmp = code(x_46_re, x_46_im) tmp = ((x_46_re * x_46_im) * (2.0 * x_46_re)) + ((x_46_im * (x_46_re - x_46_im)) * (x_46_re + x_46_im)); end
code[x$46$re_, x$46$im_] := N[(N[(N[(x$46$re * x$46$im), $MachinePrecision] * N[(2.0 * x$46$re), $MachinePrecision]), $MachinePrecision] + N[(N[(x$46$im * N[(x$46$re - x$46$im), $MachinePrecision]), $MachinePrecision] * N[(x$46$re + x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x.re \cdot x.im\right) \cdot \left(2 \cdot x.re\right) + \left(x.im \cdot \left(x.re - x.im\right)\right) \cdot \left(x.re + x.im\right)
\end{array}
herbie shell --seed 2024157
(FPCore (x.re x.im)
:name "math.cube on complex, imaginary part"
:precision binary64
:alt
(! :herbie-platform default (+ (* (* x.re x.im) (* 2 x.re)) (* (* x.im (- x.re x.im)) (+ x.re x.im))))
(+ (* (- (* x.re x.re) (* x.im x.im)) x.im) (* (+ (* x.re x.im) (* x.im x.re)) x.re)))