
(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 11 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.im_m = (fabs.f64 x.im) (FPCore (x.re x.im_m) :precision binary64 (if (<= x.im_m 2.2e-115) (pow x.re 3.0) (* (* (fma (/ x.re x.im_m) x.re (* -3.0 x.im_m)) x.re) x.im_m)))
x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 2.2e-115) {
tmp = pow(x_46_re, 3.0);
} else {
tmp = (fma((x_46_re / x_46_im_m), x_46_re, (-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m;
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 2.2e-115) tmp = x_46_re ^ 3.0; else tmp = Float64(Float64(fma(Float64(x_46_re / x_46_im_m), x_46_re, Float64(-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[x$46$im$95$m, 2.2e-115], N[Power[x$46$re, 3.0], $MachinePrecision], N[(N[(N[(N[(x$46$re / x$46$im$95$m), $MachinePrecision] * x$46$re + N[(-3.0 * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;x.im\_m \leq 2.2 \cdot 10^{-115}:\\
\;\;\;\;{x.re}^{3}\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{x.re}{x.im\_m}, x.re, -3 \cdot x.im\_m\right) \cdot x.re\right) \cdot x.im\_m\\
\end{array}
\end{array}
if x.im < 2.1999999999999999e-115Initial program 88.3%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6471.9
Applied rewrites71.9%
Applied rewrites72.1%
if 2.1999999999999999e-115 < x.im Initial program 66.7%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites12.0%
Taylor expanded in x.im around inf
Applied rewrites92.9%
Taylor expanded in x.im around 0
Applied rewrites33.1%
Taylor expanded in x.re around 0
Applied rewrites99.7%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(let* ((t_0
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))))
(if (<= t_0 (- INFINITY))
(* (* (* -3.0 x.im_m) x.re) x.im_m)
(if (<= t_0 5e+20)
(fma (* (* x.im_m x.im_m) -3.0) x.re (* (* x.re x.re) x.re))
(fma (- x.re x.im_m) (* (+ x.re x.im_m) x.re) (+ x.re x.re))))))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double t_0 = (((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((-3.0 * x_46_im_m) * x_46_re) * x_46_im_m;
} else if (t_0 <= 5e+20) {
tmp = fma(((x_46_im_m * x_46_im_m) * -3.0), x_46_re, ((x_46_re * x_46_re) * x_46_re));
} else {
tmp = fma((x_46_re - x_46_im_m), ((x_46_re + x_46_im_m) * x_46_re), (x_46_re + x_46_re));
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) t_0 = Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(-3.0 * x_46_im_m) * x_46_re) * x_46_im_m); elseif (t_0 <= 5e+20) tmp = fma(Float64(Float64(x_46_im_m * x_46_im_m) * -3.0), x_46_re, Float64(Float64(x_46_re * x_46_re) * x_46_re)); else tmp = fma(Float64(x_46_re - x_46_im_m), Float64(Float64(x_46_re + x_46_im_m) * x_46_re), Float64(x_46_re + x_46_re)); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision]
code[x$46$re_, x$46$im$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-3.0 * x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision], If[LessEqual[t$95$0, 5e+20], N[(N[(N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision] * -3.0), $MachinePrecision] * x$46$re + N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(N[(x$46$re + x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
t_0 := \left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(-3 \cdot x.im\_m\right) \cdot x.re\right) \cdot x.im\_m\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(\left(x.im\_m \cdot x.im\_m\right) \cdot -3, x.re, \left(x.re \cdot x.re\right) \cdot x.re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x.re - x.im\_m, \left(x.re + x.im\_m\right) \cdot x.re, x.re + x.re\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)) < -inf.0Initial program 83.4%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x.im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6445.9
Applied rewrites45.9%
Applied rewrites45.9%
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)) < 5e20Initial program 99.6%
Taylor expanded in x.im around 0
+-commutativeN/A
cube-multN/A
unpow2N/A
distribute-rgt-out--N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
distribute-lft-inN/A
associate--l+N/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
Applied rewrites99.6%
if 5e20 < (-.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 59.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6467.8
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.3%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites87.3%
Final simplification81.0%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(let* ((t_0
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))))
(if (<= t_0 (- INFINITY))
(* (* (* -3.0 x.im_m) x.re) x.im_m)
(if (<= t_0 5e+20)
(* (fma -3.0 (* x.im_m x.im_m) (* x.re x.re)) x.re)
(fma (- x.re x.im_m) (* (+ x.re x.im_m) x.re) (+ x.re x.re))))))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double t_0 = (((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = ((-3.0 * x_46_im_m) * x_46_re) * x_46_im_m;
} else if (t_0 <= 5e+20) {
tmp = fma(-3.0, (x_46_im_m * x_46_im_m), (x_46_re * x_46_re)) * x_46_re;
} else {
tmp = fma((x_46_re - x_46_im_m), ((x_46_re + x_46_im_m) * x_46_re), (x_46_re + x_46_re));
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) t_0 = Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(Float64(-3.0 * x_46_im_m) * x_46_re) * x_46_im_m); elseif (t_0 <= 5e+20) tmp = Float64(fma(-3.0, Float64(x_46_im_m * x_46_im_m), Float64(x_46_re * x_46_re)) * x_46_re); else tmp = fma(Float64(x_46_re - x_46_im_m), Float64(Float64(x_46_re + x_46_im_m) * x_46_re), Float64(x_46_re + x_46_re)); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision]
code[x$46$re_, x$46$im$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-3.0 * x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision], If[LessEqual[t$95$0, 5e+20], N[(N[(-3.0 * N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$re), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision], N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(N[(x$46$re + x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
t_0 := \left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(\left(-3 \cdot x.im\_m\right) \cdot x.re\right) \cdot x.im\_m\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(-3, x.im\_m \cdot x.im\_m, x.re \cdot x.re\right) \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x.re - x.im\_m, \left(x.re + x.im\_m\right) \cdot x.re, x.re + x.re\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)) < -inf.0Initial program 83.4%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x.im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6445.9
Applied rewrites45.9%
Applied rewrites45.9%
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)) < 5e20Initial program 99.6%
Taylor expanded in x.im around 0
+-commutativeN/A
cube-multN/A
unpow2N/A
distribute-rgt-out--N/A
associate-*r*N/A
*-commutativeN/A
associate-*r*N/A
distribute-rgt-out--N/A
distribute-lft-inN/A
associate--l+N/A
+-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.6%
if 5e20 < (-.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 59.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6467.8
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.3%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites87.3%
Final simplification81.0%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(let* ((t_0
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))))
(if (<= t_0 -4e-298)
(* (* (* x.re x.im_m) -3.0) x.im_m)
(if (<= t_0 5e+20)
(* (* x.re x.re) x.re)
(fma (- x.re x.im_m) (* (+ x.re x.im_m) x.re) (+ x.re x.re))))))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double t_0 = (((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m);
double tmp;
if (t_0 <= -4e-298) {
tmp = ((x_46_re * x_46_im_m) * -3.0) * x_46_im_m;
} else if (t_0 <= 5e+20) {
tmp = (x_46_re * x_46_re) * x_46_re;
} else {
tmp = fma((x_46_re - x_46_im_m), ((x_46_re + x_46_im_m) * x_46_re), (x_46_re + x_46_re));
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) t_0 = Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) tmp = 0.0 if (t_0 <= -4e-298) tmp = Float64(Float64(Float64(x_46_re * x_46_im_m) * -3.0) * x_46_im_m); elseif (t_0 <= 5e+20) tmp = Float64(Float64(x_46_re * x_46_re) * x_46_re); else tmp = fma(Float64(x_46_re - x_46_im_m), Float64(Float64(x_46_re + x_46_im_m) * x_46_re), Float64(x_46_re + x_46_re)); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision]
code[x$46$re_, x$46$im$95$m_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -4e-298], N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] * -3.0), $MachinePrecision] * x$46$im$95$m), $MachinePrecision], If[LessEqual[t$95$0, 5e+20], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision], N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(N[(x$46$re + x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
t_0 := \left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m\\
\mathbf{if}\;t\_0 \leq -4 \cdot 10^{-298}:\\
\;\;\;\;\left(\left(x.re \cdot x.im\_m\right) \cdot -3\right) \cdot x.im\_m\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{+20}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x.re - x.im\_m, \left(x.re + x.im\_m\right) \cdot x.re, x.re + x.re\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)) < -3.99999999999999965e-298Initial program 89.8%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites13.9%
Taylor expanded in x.im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
if -3.99999999999999965e-298 < (-.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)) < 5e20Initial program 99.8%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6474.2
Applied rewrites74.2%
if 5e20 < (-.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 59.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6467.8
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.3%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites87.3%
Final simplification68.5%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(if (<=
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))
5e+20)
(fma
(* (+ x.re x.re) x.im_m)
(- x.im_m)
(* (- x.re x.im_m) (* (fma x.re (/ x.re x.im_m) x.re) x.im_m)))
(fma (- x.re x.im_m) (* (+ x.re x.im_m) x.re) (+ x.re x.re))))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= 5e+20) {
tmp = fma(((x_46_re + x_46_re) * x_46_im_m), -x_46_im_m, ((x_46_re - x_46_im_m) * (fma(x_46_re, (x_46_re / x_46_im_m), x_46_re) * x_46_im_m)));
} else {
tmp = fma((x_46_re - x_46_im_m), ((x_46_re + x_46_im_m) * x_46_re), (x_46_re + x_46_re));
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) <= 5e+20) tmp = fma(Float64(Float64(x_46_re + x_46_re) * x_46_im_m), Float64(-x_46_im_m), Float64(Float64(x_46_re - x_46_im_m) * Float64(fma(x_46_re, Float64(x_46_re / x_46_im_m), x_46_re) * x_46_im_m))); else tmp = fma(Float64(x_46_re - x_46_im_m), Float64(Float64(x_46_re + x_46_im_m) * x_46_re), Float64(x_46_re + x_46_re)); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision], 5e+20], N[(N[(N[(x$46$re + x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision] * (-x$46$im$95$m) + N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(N[(x$46$re * N[(x$46$re / x$46$im$95$m), $MachinePrecision] + x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$re - x$46$im$95$m), $MachinePrecision] * N[(N[(x$46$re + x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] + N[(x$46$re + x$46$re), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m \leq 5 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(\left(x.re + x.re\right) \cdot x.im\_m, -x.im\_m, \left(x.re - x.im\_m\right) \cdot \left(\mathsf{fma}\left(x.re, \frac{x.re}{x.im\_m}, x.re\right) \cdot x.im\_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x.re - x.im\_m, \left(x.re + x.im\_m\right) \cdot x.re, x.re + x.re\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)) < 5e20Initial program 92.9%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6493.0
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.8%
Taylor expanded in x.im around inf
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f6497.5
Applied rewrites97.5%
if 5e20 < (-.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 59.0%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6467.8
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites82.3%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites87.3%
Final simplification93.9%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(if (<=
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))
-4e-298)
(* (* (* x.re x.im_m) -3.0) x.im_m)
(* (* x.re x.re) x.re)))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = ((x_46_re * x_46_im_m) * -3.0) * x_46_im_m;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = abs(x_46im)
real(8) function code(x_46re, x_46im_m)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (((((x_46re * x_46re) - (x_46im_m * x_46im_m)) * x_46re) - (((x_46re * x_46im_m) + (x_46re * x_46im_m)) * x_46im_m)) <= (-4d-298)) then
tmp = ((x_46re * x_46im_m) * (-3.0d0)) * x_46im_m
else
tmp = (x_46re * x_46re) * x_46re
end if
code = tmp
end function
x.im_m = Math.abs(x_46_im);
public static double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = ((x_46_re * x_46_im_m) * -3.0) * x_46_im_m;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = math.fabs(x_46_im) def code(x_46_re, x_46_im_m): tmp = 0 if ((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298: tmp = ((x_46_re * x_46_im_m) * -3.0) * x_46_im_m else: tmp = (x_46_re * x_46_re) * x_46_re return tmp
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = Float64(Float64(Float64(x_46_re * x_46_im_m) * -3.0) * x_46_im_m); else tmp = Float64(Float64(x_46_re * x_46_re) * x_46_re); end return tmp end
x.im_m = abs(x_46_im); function tmp_2 = code(x_46_re, x_46_im_m) tmp = 0.0; if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = ((x_46_re * x_46_im_m) * -3.0) * x_46_im_m; else tmp = (x_46_re * x_46_re) * x_46_re; end tmp_2 = tmp; end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision], -4e-298], N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] * -3.0), $MachinePrecision] * x$46$im$95$m), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m \leq -4 \cdot 10^{-298}:\\
\;\;\;\;\left(\left(x.re \cdot x.im\_m\right) \cdot -3\right) \cdot x.im\_m\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.re\\
\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)) < -3.99999999999999965e-298Initial program 89.8%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites13.9%
Taylor expanded in x.im around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt-out--N/A
metadata-evalN/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
if -3.99999999999999965e-298 < (-.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 73.8%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.1
Applied rewrites69.1%
Final simplification61.0%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(if (<=
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))
-4e-298)
(* (* (* x.re x.im_m) x.im_m) -3.0)
(* (* x.re x.re) x.re)))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = ((x_46_re * x_46_im_m) * x_46_im_m) * -3.0;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = abs(x_46im)
real(8) function code(x_46re, x_46im_m)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (((((x_46re * x_46re) - (x_46im_m * x_46im_m)) * x_46re) - (((x_46re * x_46im_m) + (x_46re * x_46im_m)) * x_46im_m)) <= (-4d-298)) then
tmp = ((x_46re * x_46im_m) * x_46im_m) * (-3.0d0)
else
tmp = (x_46re * x_46re) * x_46re
end if
code = tmp
end function
x.im_m = Math.abs(x_46_im);
public static double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = ((x_46_re * x_46_im_m) * x_46_im_m) * -3.0;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = math.fabs(x_46_im) def code(x_46_re, x_46_im_m): tmp = 0 if ((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298: tmp = ((x_46_re * x_46_im_m) * x_46_im_m) * -3.0 else: tmp = (x_46_re * x_46_re) * x_46_re return tmp
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = Float64(Float64(Float64(x_46_re * x_46_im_m) * x_46_im_m) * -3.0); else tmp = Float64(Float64(x_46_re * x_46_re) * x_46_re); end return tmp end
x.im_m = abs(x_46_im); function tmp_2 = code(x_46_re, x_46_im_m) tmp = 0.0; if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = ((x_46_re * x_46_im_m) * x_46_im_m) * -3.0; else tmp = (x_46_re * x_46_re) * x_46_re; end tmp_2 = tmp; end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision], -4e-298], N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] * x$46$im$95$m), $MachinePrecision] * -3.0), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m \leq -4 \cdot 10^{-298}:\\
\;\;\;\;\left(\left(x.re \cdot x.im\_m\right) \cdot x.im\_m\right) \cdot -3\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.re\\
\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)) < -3.99999999999999965e-298Initial program 89.8%
Taylor expanded in x.im around inf
distribute-rgt-out--N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6450.6
Applied rewrites50.6%
if -3.99999999999999965e-298 < (-.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 73.8%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.1
Applied rewrites69.1%
Final simplification61.0%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(if (<=
(-
(* (- (* x.re x.re) (* x.im_m x.im_m)) x.re)
(* (+ (* x.re x.im_m) (* x.re x.im_m)) x.im_m))
-4e-298)
(* (* (- x.im_m) x.im_m) x.re)
(* (* x.re x.re) x.re)))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = (-x_46_im_m * x_46_im_m) * x_46_re;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = abs(x_46im)
real(8) function code(x_46re, x_46im_m)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
real(8) :: tmp
if (((((x_46re * x_46re) - (x_46im_m * x_46im_m)) * x_46re) - (((x_46re * x_46im_m) + (x_46re * x_46im_m)) * x_46im_m)) <= (-4d-298)) then
tmp = (-x_46im_m * x_46im_m) * x_46re
else
tmp = (x_46re * x_46re) * x_46re
end if
code = tmp
end function
x.im_m = Math.abs(x_46_im);
public static double code(double x_46_re, double x_46_im_m) {
double tmp;
if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) {
tmp = (-x_46_im_m * x_46_im_m) * x_46_re;
} else {
tmp = (x_46_re * x_46_re) * x_46_re;
}
return tmp;
}
x.im_m = math.fabs(x_46_im) def code(x_46_re, x_46_im_m): tmp = 0 if ((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298: tmp = (-x_46_im_m * x_46_im_m) * x_46_re else: tmp = (x_46_re * x_46_re) * x_46_re return tmp
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re * x_46_re) - Float64(x_46_im_m * x_46_im_m)) * x_46_re) - Float64(Float64(Float64(x_46_re * x_46_im_m) + Float64(x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = Float64(Float64(Float64(-x_46_im_m) * x_46_im_m) * x_46_re); else tmp = Float64(Float64(x_46_re * x_46_re) * x_46_re); end return tmp end
x.im_m = abs(x_46_im); function tmp_2 = code(x_46_re, x_46_im_m) tmp = 0.0; if (((((x_46_re * x_46_re) - (x_46_im_m * x_46_im_m)) * x_46_re) - (((x_46_re * x_46_im_m) + (x_46_re * x_46_im_m)) * x_46_im_m)) <= -4e-298) tmp = (-x_46_im_m * x_46_im_m) * x_46_re; else tmp = (x_46_re * x_46_re) * x_46_re; end tmp_2 = tmp; end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[N[(N[(N[(N[(x$46$re * x$46$re), $MachinePrecision] - N[(x$46$im$95$m * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] - N[(N[(N[(x$46$re * x$46$im$95$m), $MachinePrecision] + N[(x$46$re * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]), $MachinePrecision], -4e-298], N[(N[((-x$46$im$95$m) * x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;\left(x.re \cdot x.re - x.im\_m \cdot x.im\_m\right) \cdot x.re - \left(x.re \cdot x.im\_m + x.re \cdot x.im\_m\right) \cdot x.im\_m \leq -4 \cdot 10^{-298}:\\
\;\;\;\;\left(\left(-x.im\_m\right) \cdot x.im\_m\right) \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.re\\
\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)) < -3.99999999999999965e-298Initial program 89.8%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6489.8
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites99.7%
lift-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lift-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lift-neg.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-lft-inN/A
*-commutativeN/A
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
distribute-rgt-neg-inN/A
*-commutativeN/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites66.0%
Taylor expanded in x.im around inf
associate-*r*N/A
lower-*.f64N/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f6422.2
Applied rewrites22.2%
if -3.99999999999999965e-298 < (-.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 73.8%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6469.1
Applied rewrites69.1%
Final simplification48.4%
x.im_m = (fabs.f64 x.im)
(FPCore (x.re x.im_m)
:precision binary64
(if (<= x.im_m 1.18e+85)
(fma
(* (+ x.re x.re) x.im_m)
(- x.im_m)
(* (* (+ x.re x.im_m) x.re) (- x.re x.im_m)))
(* (* (fma (/ x.re x.im_m) x.re (* -3.0 x.im_m)) x.re) x.im_m)))x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 1.18e+85) {
tmp = fma(((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_re - x_46_im_m)));
} else {
tmp = (fma((x_46_re / x_46_im_m), x_46_re, (-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m;
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 1.18e+85) tmp = fma(Float64(Float64(x_46_re + x_46_re) * x_46_im_m), Float64(-x_46_im_m), Float64(Float64(Float64(x_46_re + x_46_im_m) * x_46_re) * Float64(x_46_re - x_46_im_m))); else tmp = Float64(Float64(fma(Float64(x_46_re / x_46_im_m), x_46_re, Float64(-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[x$46$im$95$m, 1.18e+85], N[(N[(N[(x$46$re + x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision] * (-x$46$im$95$m) + N[(N[(N[(x$46$re + x$46$im$95$m), $MachinePrecision] * x$46$re), $MachinePrecision] * N[(x$46$re - x$46$im$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x$46$re / x$46$im$95$m), $MachinePrecision] * x$46$re + N[(-3.0 * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;x.im\_m \leq 1.18 \cdot 10^{+85}:\\
\;\;\;\;\mathsf{fma}\left(\left(x.re + x.re\right) \cdot x.im\_m, -x.im\_m, \left(\left(x.re + x.im\_m\right) \cdot x.re\right) \cdot \left(x.re - x.im\_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{x.re}{x.im\_m}, x.re, -3 \cdot x.im\_m\right) \cdot x.re\right) \cdot x.im\_m\\
\end{array}
\end{array}
if x.im < 1.17999999999999997e85Initial program 89.4%
lift--.f64N/A
sub-negN/A
+-commutativeN/A
lift-*.f64N/A
distribute-rgt-neg-inN/A
lower-fma.f64N/A
lift-+.f64N/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
distribute-lft-outN/A
lower-*.f64N/A
lower-+.f64N/A
lower-neg.f6492.4
lift-*.f64N/A
*-commutativeN/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*r*N/A
lower-*.f64N/A
Applied rewrites96.9%
if 1.17999999999999997e85 < x.im Initial program 45.6%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites0.0%
Taylor expanded in x.im around inf
Applied rewrites87.9%
Taylor expanded in x.im around 0
Applied rewrites13.5%
Taylor expanded in x.re around 0
Applied rewrites99.8%
Final simplification97.5%
x.im_m = (fabs.f64 x.im) (FPCore (x.re x.im_m) :precision binary64 (if (<= x.im_m 5e-143) (* (* x.re x.re) x.re) (* (* (fma (/ x.re x.im_m) x.re (* -3.0 x.im_m)) x.re) x.im_m)))
x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
double tmp;
if (x_46_im_m <= 5e-143) {
tmp = (x_46_re * x_46_re) * x_46_re;
} else {
tmp = (fma((x_46_re / x_46_im_m), x_46_re, (-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m;
}
return tmp;
}
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) tmp = 0.0 if (x_46_im_m <= 5e-143) tmp = Float64(Float64(x_46_re * x_46_re) * x_46_re); else tmp = Float64(Float64(fma(Float64(x_46_re / x_46_im_m), x_46_re, Float64(-3.0 * x_46_im_m)) * x_46_re) * x_46_im_m); end return tmp end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := If[LessEqual[x$46$im$95$m, 5e-143], N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision], N[(N[(N[(N[(x$46$re / x$46$im$95$m), $MachinePrecision] * x$46$re + N[(-3.0 * x$46$im$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re), $MachinePrecision] * x$46$im$95$m), $MachinePrecision]]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\begin{array}{l}
\mathbf{if}\;x.im\_m \leq 5 \cdot 10^{-143}:\\
\;\;\;\;\left(x.re \cdot x.re\right) \cdot x.re\\
\mathbf{else}:\\
\;\;\;\;\left(\mathsf{fma}\left(\frac{x.re}{x.im\_m}, x.re, -3 \cdot x.im\_m\right) \cdot x.re\right) \cdot x.im\_m\\
\end{array}
\end{array}
if x.im < 5.0000000000000002e-143Initial program 87.7%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6470.6
Applied rewrites70.6%
if 5.0000000000000002e-143 < x.im Initial program 69.5%
lift-*.f64N/A
lift--.f64N/A
flip3--N/A
associate-*l/N/A
lower-/.f64N/A
Applied rewrites14.1%
Taylor expanded in x.im around inf
Applied rewrites91.5%
Taylor expanded in x.im around 0
Applied rewrites36.7%
Taylor expanded in x.re around 0
Applied rewrites99.7%
x.im_m = (fabs.f64 x.im) (FPCore (x.re x.im_m) :precision binary64 (* (* x.re x.re) x.re))
x.im_m = fabs(x_46_im);
double code(double x_46_re, double x_46_im_m) {
return (x_46_re * x_46_re) * x_46_re;
}
x.im_m = abs(x_46im)
real(8) function code(x_46re, x_46im_m)
real(8), intent (in) :: x_46re
real(8), intent (in) :: x_46im_m
code = (x_46re * x_46re) * x_46re
end function
x.im_m = Math.abs(x_46_im);
public static double code(double x_46_re, double x_46_im_m) {
return (x_46_re * x_46_re) * x_46_re;
}
x.im_m = math.fabs(x_46_im) def code(x_46_re, x_46_im_m): return (x_46_re * x_46_re) * x_46_re
x.im_m = abs(x_46_im) function code(x_46_re, x_46_im_m) return Float64(Float64(x_46_re * x_46_re) * x_46_re) end
x.im_m = abs(x_46_im); function tmp = code(x_46_re, x_46_im_m) tmp = (x_46_re * x_46_re) * x_46_re; end
x.im_m = N[Abs[x$46$im], $MachinePrecision] code[x$46$re_, x$46$im$95$m_] := N[(N[(x$46$re * x$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]
\begin{array}{l}
x.im_m = \left|x.im\right|
\\
\left(x.re \cdot x.re\right) \cdot x.re
\end{array}
Initial program 80.9%
Taylor expanded in x.im around 0
unpow3N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.9
Applied rewrites60.9%
(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 2024235
(FPCore (x.re x.im)
:name "math.cube on complex, real part"
:precision binary64
:alt
(! :herbie-platform default (+ (* (* x.re x.re) (- x.re x.im)) (* (* x.re x.im) (- x.re (* 3 x.im)))))
(- (* (- (* x.re x.re) (* x.im x.im)) x.re) (* (+ (* x.re x.im) (* x.im x.re)) x.im)))