
(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 8 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.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(let* ((t_0 (* (- x.re_m x.im) x.im)))
(if (<=
(+
(* (- (* x.re_m x.re_m) (* x.im x.im)) x.im)
(* (+ (* x.re_m x.im) (* x.im x.re_m)) x.re_m))
INFINITY)
(+
(* (fma (sqrt x.re_m) (sqrt x.re_m) x.im) t_0)
(* (* (* 2.0 x.re_m) x.im) x.re_m))
(/ (* t_0 (* (+ x.im x.re_m) (- x.im x.re_m))) (- x.im x.re_m)))))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m - x_46_im) * x_46_im;
double tmp;
if (((((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m)) <= ((double) INFINITY)) {
tmp = (fma(sqrt(x_46_re_m), sqrt(x_46_re_m), x_46_im) * t_0) + (((2.0 * x_46_re_m) * x_46_im) * x_46_re_m);
} else {
tmp = (t_0 * ((x_46_im + x_46_re_m) * (x_46_im - x_46_re_m))) / (x_46_im - x_46_re_m);
}
return tmp;
}
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m - x_46_im) * x_46_im) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_im * x_46_re_m)) * x_46_re_m)) <= Inf) tmp = Float64(Float64(fma(sqrt(x_46_re_m), sqrt(x_46_re_m), x_46_im) * t_0) + Float64(Float64(Float64(2.0 * x_46_re_m) * x_46_im) * x_46_re_m)); else tmp = Float64(Float64(t_0 * Float64(Float64(x_46_im + x_46_re_m) * Float64(x_46_im - x_46_re_m))) / Float64(x_46_im - x_46_re_m)); end return tmp end
x.re_m = N[Abs[x$46$re], $MachinePrecision]
code[x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision], Infinity], N[(N[(N[(N[Sqrt[x$46$re$95$m], $MachinePrecision] * N[Sqrt[x$46$re$95$m], $MachinePrecision] + x$46$im), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[(N[(2.0 * x$46$re$95$m), $MachinePrecision] * x$46$im), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(t$95$0 * N[(N[(x$46$im + x$46$re$95$m), $MachinePrecision] * N[(x$46$im - x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$46$im - x$46$re$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
t_0 := \left(x.re\_m - x.im\right) \cdot x.im\\
\mathbf{if}\;\left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) \cdot x.im + \left(x.re\_m \cdot x.im + x.im \cdot x.re\_m\right) \cdot x.re\_m \leq \infty:\\
\;\;\;\;\mathsf{fma}\left(\sqrt{x.re\_m}, \sqrt{x.re\_m}, x.im\right) \cdot t\_0 + \left(\left(2 \cdot x.re\_m\right) \cdot x.im\right) \cdot x.re\_m\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \left(\left(x.im + x.re\_m\right) \cdot \left(x.im - x.re\_m\right)\right)}{x.im - x.re\_m}\\
\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)) < +inf.0Initial program 94.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6499.7
Applied rewrites99.7%
lift-+.f64N/A
+-commutativeN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
rem-sqrt-square-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
sqrt-prodN/A
rem-sqrt-square-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
lower-fma.f64N/A
lower-sqrt.f64N/A
lower-sqrt.f6449.2
Applied rewrites49.2%
Taylor expanded in x.re around 0
*-commutativeN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f6449.2
Applied rewrites49.2%
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%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6421.2
Applied rewrites21.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lift-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6421.2
Applied rewrites21.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
rem-square-sqrtN/A
sqrt-prodN/A
sqr-neg-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
rem-sqrt-square-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
*-commutativeN/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites100.0%
Final simplification55.8%
x.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(let* ((t_0
(+
(* (- (* x.re_m x.re_m) (* x.im x.im)) x.im)
(* (+ (* x.re_m x.im) (* x.im x.re_m)) x.re_m))))
(if (or (<= t_0 -1e-304) (not (<= t_0 INFINITY)))
(* (* (- x.im) x.im) x.im)
(* (* x.im x.re_m) (* 3.0 x.re_m)))))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= ((double) INFINITY))) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = (x_46_im * x_46_re_m) * (3.0 * x_46_re_m);
}
return tmp;
}
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
double t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= Double.POSITIVE_INFINITY)) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = (x_46_im * x_46_re_m) * (3.0 * x_46_re_m);
}
return tmp;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m) tmp = 0 if (t_0 <= -1e-304) or not (t_0 <= math.inf): tmp = (-x_46_im * x_46_im) * x_46_im else: tmp = (x_46_im * x_46_re_m) * (3.0 * x_46_re_m) return tmp
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) t_0 = Float64(Float64(Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_im * x_46_re_m)) * x_46_re_m)) tmp = 0.0 if ((t_0 <= -1e-304) || !(t_0 <= Inf)) tmp = Float64(Float64(Float64(-x_46_im) * x_46_im) * x_46_im); else tmp = Float64(Float64(x_46_im * x_46_re_m) * Float64(3.0 * x_46_re_m)); end return tmp end
x.re_m = abs(x_46_re); function tmp_2 = code(x_46_re_m, x_46_im) t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m); tmp = 0.0; if ((t_0 <= -1e-304) || ~((t_0 <= Inf))) tmp = (-x_46_im * x_46_im) * x_46_im; else tmp = (x_46_im * x_46_re_m) * (3.0 * x_46_re_m); end tmp_2 = tmp; end
x.re_m = N[Abs[x$46$re], $MachinePrecision]
code[x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -1e-304], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(N[((-x$46$im) * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision], N[(N[(x$46$im * x$46$re$95$m), $MachinePrecision] * N[(3.0 * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) \cdot x.im + \left(x.re\_m \cdot x.im + x.im \cdot x.re\_m\right) \cdot x.re\_m\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304} \lor \neg \left(t\_0 \leq \infty\right):\\
\;\;\;\;\left(\left(-x.im\right) \cdot x.im\right) \cdot x.im\\
\mathbf{else}:\\
\;\;\;\;\left(x.im \cdot x.re\_m\right) \cdot \left(3 \cdot x.re\_m\right)\\
\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)) < -9.99999999999999971e-305 or +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 68.8%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f6454.0
Applied rewrites54.0%
Applied rewrites53.9%
if -9.99999999999999971e-305 < (+.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 96.7%
Taylor expanded in x.re around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.9
Applied rewrites66.9%
Applied rewrites66.9%
Final simplification60.1%
x.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(let* ((t_0
(+
(* (- (* x.re_m x.re_m) (* x.im x.im)) x.im)
(* (+ (* x.re_m x.im) (* x.im x.re_m)) x.re_m))))
(if (or (<= t_0 -1e-304) (not (<= t_0 INFINITY)))
(* (* (- x.im) x.im) x.im)
(* 3.0 (* (* x.im x.re_m) x.re_m)))))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= ((double) INFINITY))) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = 3.0 * ((x_46_im * x_46_re_m) * x_46_re_m);
}
return tmp;
}
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
double t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
double tmp;
if ((t_0 <= -1e-304) || !(t_0 <= Double.POSITIVE_INFINITY)) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = 3.0 * ((x_46_im * x_46_re_m) * x_46_re_m);
}
return tmp;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m) tmp = 0 if (t_0 <= -1e-304) or not (t_0 <= math.inf): tmp = (-x_46_im * x_46_im) * x_46_im else: tmp = 3.0 * ((x_46_im * x_46_re_m) * x_46_re_m) return tmp
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) t_0 = Float64(Float64(Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im)) * x_46_im) + Float64(Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_im * x_46_re_m)) * x_46_re_m)) tmp = 0.0 if ((t_0 <= -1e-304) || !(t_0 <= Inf)) tmp = Float64(Float64(Float64(-x_46_im) * x_46_im) * x_46_im); else tmp = Float64(3.0 * Float64(Float64(x_46_im * x_46_re_m) * x_46_re_m)); end return tmp end
x.re_m = abs(x_46_re); function tmp_2 = code(x_46_re_m, x_46_im) t_0 = (((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m); tmp = 0.0; if ((t_0 <= -1e-304) || ~((t_0 <= Inf))) tmp = (-x_46_im * x_46_im) * x_46_im; else tmp = 3.0 * ((x_46_im * x_46_re_m) * x_46_re_m); end tmp_2 = tmp; end
x.re_m = N[Abs[x$46$re], $MachinePrecision]
code[x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -1e-304], N[Not[LessEqual[t$95$0, Infinity]], $MachinePrecision]], N[(N[((-x$46$im) * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision], N[(3.0 * N[(N[(x$46$im * x$46$re$95$m), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
t_0 := \left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) \cdot x.im + \left(x.re\_m \cdot x.im + x.im \cdot x.re\_m\right) \cdot x.re\_m\\
\mathbf{if}\;t\_0 \leq -1 \cdot 10^{-304} \lor \neg \left(t\_0 \leq \infty\right):\\
\;\;\;\;\left(\left(-x.im\right) \cdot x.im\right) \cdot x.im\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(\left(x.im \cdot x.re\_m\right) \cdot x.re\_m\right)\\
\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)) < -9.99999999999999971e-305 or +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 68.8%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f6454.0
Applied rewrites54.0%
Applied rewrites53.9%
if -9.99999999999999971e-305 < (+.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 96.7%
Taylor expanded in x.re around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6466.9
Applied rewrites66.9%
Applied rewrites66.9%
Final simplification60.1%
x.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(let* ((t_0 (* (- x.re_m x.im) x.im))
(t_1 (* (+ (* x.re_m x.im) (* x.im x.re_m)) x.re_m)))
(if (<= (+ (* (- (* x.re_m x.re_m) (* x.im x.im)) x.im) t_1) INFINITY)
(+ (* (+ x.im x.re_m) t_0) t_1)
(/ (* t_0 (* (+ x.im x.re_m) (- x.im x.re_m))) (- x.im x.re_m)))))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m - x_46_im) * x_46_im;
double t_1 = ((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m;
double tmp;
if (((((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + t_1) <= ((double) INFINITY)) {
tmp = ((x_46_im + x_46_re_m) * t_0) + t_1;
} else {
tmp = (t_0 * ((x_46_im + x_46_re_m) * (x_46_im - x_46_re_m))) / (x_46_im - x_46_re_m);
}
return tmp;
}
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
double t_0 = (x_46_re_m - x_46_im) * x_46_im;
double t_1 = ((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m;
double tmp;
if (((((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + t_1) <= Double.POSITIVE_INFINITY) {
tmp = ((x_46_im + x_46_re_m) * t_0) + t_1;
} else {
tmp = (t_0 * ((x_46_im + x_46_re_m) * (x_46_im - x_46_re_m))) / (x_46_im - x_46_re_m);
}
return tmp;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): t_0 = (x_46_re_m - x_46_im) * x_46_im t_1 = ((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m tmp = 0 if ((((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + t_1) <= math.inf: tmp = ((x_46_im + x_46_re_m) * t_0) + t_1 else: tmp = (t_0 * ((x_46_im + x_46_re_m) * (x_46_im - x_46_re_m))) / (x_46_im - x_46_re_m) return tmp
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) t_0 = Float64(Float64(x_46_re_m - x_46_im) * x_46_im) t_1 = Float64(Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_im * x_46_re_m)) * x_46_re_m) tmp = 0.0 if (Float64(Float64(Float64(Float64(x_46_re_m * x_46_re_m) - Float64(x_46_im * x_46_im)) * x_46_im) + t_1) <= Inf) tmp = Float64(Float64(Float64(x_46_im + x_46_re_m) * t_0) + t_1); else tmp = Float64(Float64(t_0 * Float64(Float64(x_46_im + x_46_re_m) * Float64(x_46_im - x_46_re_m))) / Float64(x_46_im - x_46_re_m)); end return tmp end
x.re_m = abs(x_46_re); function tmp_2 = code(x_46_re_m, x_46_im) t_0 = (x_46_re_m - x_46_im) * x_46_im; t_1 = ((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m; tmp = 0.0; if (((((x_46_re_m * x_46_re_m) - (x_46_im * x_46_im)) * x_46_im) + t_1) <= Inf) tmp = ((x_46_im + x_46_re_m) * t_0) + t_1; else tmp = (t_0 * ((x_46_im + x_46_re_m) * (x_46_im - x_46_re_m))) / (x_46_im - x_46_re_m); end tmp_2 = tmp; end
x.re_m = N[Abs[x$46$re], $MachinePrecision]
code[x$46$re$95$m_, x$46$im_] := Block[{t$95$0 = N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]}, If[LessEqual[N[(N[(N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision] * x$46$im), $MachinePrecision] + t$95$1), $MachinePrecision], Infinity], N[(N[(N[(x$46$im + x$46$re$95$m), $MachinePrecision] * t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(t$95$0 * N[(N[(x$46$im + x$46$re$95$m), $MachinePrecision] * N[(x$46$im - x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x$46$im - x$46$re$95$m), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
t_0 := \left(x.re\_m - x.im\right) \cdot x.im\\
t_1 := \left(x.re\_m \cdot x.im + x.im \cdot x.re\_m\right) \cdot x.re\_m\\
\mathbf{if}\;\left(x.re\_m \cdot x.re\_m - x.im \cdot x.im\right) \cdot x.im + t\_1 \leq \infty:\\
\;\;\;\;\left(x.im + x.re\_m\right) \cdot t\_0 + t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{t\_0 \cdot \left(\left(x.im + x.re\_m\right) \cdot \left(x.im - x.re\_m\right)\right)}{x.im - x.re\_m}\\
\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)) < +inf.0Initial program 94.3%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6499.7
Applied rewrites99.7%
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%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6421.2
Applied rewrites21.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
flip-+N/A
associate-*r/N/A
lower-/.f64N/A
lower-*.f64N/A
difference-of-squaresN/A
lift-+.f64N/A
lower-*.f64N/A
lower--.f64N/A
lower--.f6421.2
Applied rewrites21.2%
lift-*.f64N/A
*-commutativeN/A
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
fp-cancel-sign-sub-invN/A
unpow1N/A
metadata-evalN/A
sqrt-pow1N/A
pow2N/A
rem-sqrt-square-revN/A
rem-square-sqrtN/A
sqrt-prodN/A
sqr-neg-revN/A
sqrt-unprodN/A
rem-square-sqrtN/A
rem-sqrt-square-revN/A
pow2N/A
sqrt-pow1N/A
metadata-evalN/A
unpow1N/A
*-commutativeN/A
lift-*.f64N/A
+-inversesN/A
+-inversesN/A
lift-*.f64N/A
*-commutativeN/A
lift-*.f64N/A
Applied rewrites100.0%
Final simplification99.8%
x.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(if (<= x.im 1.65e+199)
(+
(* (+ x.im x.re_m) (* (- x.re_m x.im) x.im))
(* (+ (* x.re_m x.im) (* x.im x.re_m)) x.re_m))
(* (* (- x.im) x.im) x.im)))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_im <= 1.65e+199) {
tmp = ((x_46_im + x_46_re_m) * ((x_46_re_m - x_46_im) * x_46_im)) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
} else {
tmp = (-x_46_im * x_46_im) * x_46_im;
}
return tmp;
}
x.re_m = abs(x_46re)
real(8) function code(x_46re_m, x_46im)
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46im <= 1.65d+199) then
tmp = ((x_46im + x_46re_m) * ((x_46re_m - x_46im) * x_46im)) + (((x_46re_m * x_46im) + (x_46im * x_46re_m)) * x_46re_m)
else
tmp = (-x_46im * x_46im) * x_46im
end if
code = tmp
end function
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_im <= 1.65e+199) {
tmp = ((x_46_im + x_46_re_m) * ((x_46_re_m - x_46_im) * x_46_im)) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m);
} else {
tmp = (-x_46_im * x_46_im) * x_46_im;
}
return tmp;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): tmp = 0 if x_46_im <= 1.65e+199: tmp = ((x_46_im + x_46_re_m) * ((x_46_re_m - x_46_im) * x_46_im)) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m) else: tmp = (-x_46_im * x_46_im) * x_46_im return tmp
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) tmp = 0.0 if (x_46_im <= 1.65e+199) tmp = Float64(Float64(Float64(x_46_im + x_46_re_m) * Float64(Float64(x_46_re_m - x_46_im) * x_46_im)) + Float64(Float64(Float64(x_46_re_m * x_46_im) + Float64(x_46_im * x_46_re_m)) * x_46_re_m)); else tmp = Float64(Float64(Float64(-x_46_im) * x_46_im) * x_46_im); end return tmp end
x.re_m = abs(x_46_re); function tmp_2 = code(x_46_re_m, x_46_im) tmp = 0.0; if (x_46_im <= 1.65e+199) tmp = ((x_46_im + x_46_re_m) * ((x_46_re_m - x_46_im) * x_46_im)) + (((x_46_re_m * x_46_im) + (x_46_im * x_46_re_m)) * x_46_re_m); else tmp = (-x_46_im * x_46_im) * x_46_im; end tmp_2 = tmp; end
x.re_m = N[Abs[x$46$re], $MachinePrecision] code[x$46$re$95$m_, x$46$im_] := If[LessEqual[x$46$im, 1.65e+199], N[(N[(N[(x$46$im + x$46$re$95$m), $MachinePrecision] * N[(N[(x$46$re$95$m - x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(x$46$re$95$m * x$46$im), $MachinePrecision] + N[(x$46$im * x$46$re$95$m), $MachinePrecision]), $MachinePrecision] * x$46$re$95$m), $MachinePrecision]), $MachinePrecision], N[(N[((-x$46$im) * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 1.65 \cdot 10^{+199}:\\
\;\;\;\;\left(x.im + x.re\_m\right) \cdot \left(\left(x.re\_m - x.im\right) \cdot x.im\right) + \left(x.re\_m \cdot x.im + x.im \cdot x.re\_m\right) \cdot x.re\_m\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-x.im\right) \cdot x.im\right) \cdot x.im\\
\end{array}
\end{array}
if x.im < 1.6499999999999999e199Initial program 86.4%
lift-*.f64N/A
lift--.f64N/A
lift-*.f64N/A
lift-*.f64N/A
difference-of-squaresN/A
associate-*l*N/A
lower-*.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-*.f64N/A
lower--.f6494.6
Applied rewrites94.6%
if 1.6499999999999999e199 < x.im Initial program 39.1%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
x.re_m = (fabs.f64 x.re)
(FPCore (x.re_m x.im)
:precision binary64
(if (<= x.im 6.6e-118)
(* (* x.im x.re_m) (* 3.0 x.re_m))
(if (<= x.im 5e+200)
(* (- x.im) (fma x.im x.im (* -3.0 (* x.re_m x.re_m))))
(* (* (- x.im) x.im) x.im))))x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_im <= 6.6e-118) {
tmp = (x_46_im * x_46_re_m) * (3.0 * x_46_re_m);
} else if (x_46_im <= 5e+200) {
tmp = -x_46_im * fma(x_46_im, x_46_im, (-3.0 * (x_46_re_m * x_46_re_m)));
} else {
tmp = (-x_46_im * x_46_im) * x_46_im;
}
return tmp;
}
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) tmp = 0.0 if (x_46_im <= 6.6e-118) tmp = Float64(Float64(x_46_im * x_46_re_m) * Float64(3.0 * x_46_re_m)); elseif (x_46_im <= 5e+200) tmp = Float64(Float64(-x_46_im) * fma(x_46_im, x_46_im, Float64(-3.0 * Float64(x_46_re_m * x_46_re_m)))); else tmp = Float64(Float64(Float64(-x_46_im) * x_46_im) * x_46_im); end return tmp end
x.re_m = N[Abs[x$46$re], $MachinePrecision] code[x$46$re$95$m_, x$46$im_] := If[LessEqual[x$46$im, 6.6e-118], N[(N[(x$46$im * x$46$re$95$m), $MachinePrecision] * N[(3.0 * x$46$re$95$m), $MachinePrecision]), $MachinePrecision], If[LessEqual[x$46$im, 5e+200], N[((-x$46$im) * N[(x$46$im * x$46$im + N[(-3.0 * N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-x$46$im) * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.im \leq 6.6 \cdot 10^{-118}:\\
\;\;\;\;\left(x.im \cdot x.re\_m\right) \cdot \left(3 \cdot x.re\_m\right)\\
\mathbf{elif}\;x.im \leq 5 \cdot 10^{+200}:\\
\;\;\;\;\left(-x.im\right) \cdot \mathsf{fma}\left(x.im, x.im, -3 \cdot \left(x.re\_m \cdot x.re\_m\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(-x.im\right) \cdot x.im\right) \cdot x.im\\
\end{array}
\end{array}
if x.im < 6.5999999999999999e-118Initial program 84.8%
Taylor expanded in x.re around inf
*-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-*.f64N/A
*-commutativeN/A
distribute-rgt1-inN/A
metadata-evalN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f6470.3
Applied rewrites70.3%
Applied rewrites70.3%
if 6.5999999999999999e-118 < x.im < 5.00000000000000019e200Initial program 90.4%
Taylor expanded in x.re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
distribute-lft-inN/A
fp-cancel-sign-sub-invN/A
mul-1-negN/A
cube-multN/A
unpow2N/A
distribute-lft-neg-inN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower-neg.f64N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
remove-double-negN/A
Applied rewrites98.1%
if 5.00000000000000019e200 < x.im Initial program 39.1%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f64100.0
Applied rewrites100.0%
Applied rewrites100.0%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (if (<= x.re_m 8.6e+200) (* (* (- x.im) x.im) x.im) (* (* x.im x.im) x.im)))
x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 8.6e+200) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = (x_46_im * x_46_im) * x_46_im;
}
return tmp;
}
x.re_m = abs(x_46re)
real(8) function code(x_46re_m, x_46im)
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
real(8) :: tmp
if (x_46re_m <= 8.6d+200) then
tmp = (-x_46im * x_46im) * x_46im
else
tmp = (x_46im * x_46im) * x_46im
end if
code = tmp
end function
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
double tmp;
if (x_46_re_m <= 8.6e+200) {
tmp = (-x_46_im * x_46_im) * x_46_im;
} else {
tmp = (x_46_im * x_46_im) * x_46_im;
}
return tmp;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): tmp = 0 if x_46_re_m <= 8.6e+200: tmp = (-x_46_im * x_46_im) * x_46_im else: tmp = (x_46_im * x_46_im) * x_46_im return tmp
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) tmp = 0.0 if (x_46_re_m <= 8.6e+200) tmp = Float64(Float64(Float64(-x_46_im) * x_46_im) * x_46_im); else tmp = Float64(Float64(x_46_im * x_46_im) * x_46_im); end return tmp end
x.re_m = abs(x_46_re); function tmp_2 = code(x_46_re_m, x_46_im) tmp = 0.0; if (x_46_re_m <= 8.6e+200) tmp = (-x_46_im * x_46_im) * x_46_im; else tmp = (x_46_im * x_46_im) * x_46_im; end tmp_2 = tmp; end
x.re_m = N[Abs[x$46$re], $MachinePrecision] code[x$46$re$95$m_, x$46$im_] := If[LessEqual[x$46$re$95$m, 8.6e+200], N[(N[((-x$46$im) * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision], N[(N[(x$46$im * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 8.6 \cdot 10^{+200}:\\
\;\;\;\;\left(\left(-x.im\right) \cdot x.im\right) \cdot x.im\\
\mathbf{else}:\\
\;\;\;\;\left(x.im \cdot x.im\right) \cdot x.im\\
\end{array}
\end{array}
if x.re < 8.60000000000000062e200Initial program 82.8%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f6459.5
Applied rewrites59.5%
Applied rewrites59.4%
if 8.60000000000000062e200 < x.re Initial program 72.9%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f6411.9
Applied rewrites11.9%
Applied rewrites18.6%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (* (* x.im x.im) x.im))
x.re_m = fabs(x_46_re);
double code(double x_46_re_m, double x_46_im) {
return (x_46_im * x_46_im) * x_46_im;
}
x.re_m = abs(x_46re)
real(8) function code(x_46re_m, x_46im)
real(8), intent (in) :: x_46re_m
real(8), intent (in) :: x_46im
code = (x_46im * x_46im) * x_46im
end function
x.re_m = Math.abs(x_46_re);
public static double code(double x_46_re_m, double x_46_im) {
return (x_46_im * x_46_im) * x_46_im;
}
x.re_m = math.fabs(x_46_re) def code(x_46_re_m, x_46_im): return (x_46_im * x_46_im) * x_46_im
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) return Float64(Float64(x_46_im * x_46_im) * x_46_im) end
x.re_m = abs(x_46_re); function tmp = code(x_46_re_m, x_46_im) tmp = (x_46_im * x_46_im) * x_46_im; end
x.re_m = N[Abs[x$46$re], $MachinePrecision] code[x$46$re$95$m_, x$46$im_] := N[(N[(x$46$im * x$46$im), $MachinePrecision] * x$46$im), $MachinePrecision]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\left(x.im \cdot x.im\right) \cdot x.im
\end{array}
Initial program 82.1%
Taylor expanded in x.re around 0
mul-1-negN/A
cube-neg-revN/A
lower-pow.f64N/A
lower-neg.f6456.2
Applied rewrites56.2%
Applied rewrites17.2%
(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 2024344
(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)))