
(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 6 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 (if (<= x.re_m 3.4e+145) (* x.im (- (* (* x.re_m x.re_m) 3.0) (* x.im x.im))) (* 3.0 (* x.re_m (* x.re_m 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 <= 3.4e+145) {
tmp = x_46_im * (((x_46_re_m * x_46_re_m) * 3.0) - (x_46_im * x_46_im));
} else {
tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 3.4d+145) then
tmp = x_46im * (((x_46re_m * x_46re_m) * 3.0d0) - (x_46im * x_46im))
else
tmp = 3.0d0 * (x_46re_m * (x_46re_m * 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 <= 3.4e+145) {
tmp = x_46_im * (((x_46_re_m * x_46_re_m) * 3.0) - (x_46_im * x_46_im));
} else {
tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 3.4e+145: tmp = x_46_im * (((x_46_re_m * x_46_re_m) * 3.0) - (x_46_im * x_46_im)) else: tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 3.4e+145) tmp = Float64(x_46_im * Float64(Float64(Float64(x_46_re_m * x_46_re_m) * 3.0) - Float64(x_46_im * x_46_im))); else tmp = Float64(3.0 * Float64(x_46_re_m * Float64(x_46_re_m * 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 <= 3.4e+145) tmp = x_46_im * (((x_46_re_m * x_46_re_m) * 3.0) - (x_46_im * x_46_im)); else tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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, 3.4e+145], N[(x$46$im * N[(N[(N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision] * 3.0), $MachinePrecision] - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$re$95$m * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 3.4 \cdot 10^{+145}:\\
\;\;\;\;x.im \cdot \left(\left(x.re\_m \cdot x.re\_m\right) \cdot 3 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.re\_m \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < 3.3999999999999999e145Initial program 82.6%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.3%
Simplified92.3%
if 3.3999999999999999e145 < x.re Initial program 51.9%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6451.9%
Simplified51.9%
Taylor expanded in x.im around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6469.4%
Simplified69.4%
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6492.3%
Applied egg-rr92.3%
Final simplification92.3%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (if (<= x.re_m 1.7e+67) (* x.im (- 0.0 (* x.im x.im))) (* x.re_m (* x.re_m (* x.im 3.0)))))
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 <= 1.7e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = x_46_re_m * (x_46_re_m * (x_46_im * 3.0));
}
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 <= 1.7d+67) then
tmp = x_46im * (0.0d0 - (x_46im * x_46im))
else
tmp = x_46re_m * (x_46re_m * (x_46im * 3.0d0))
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 <= 1.7e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = x_46_re_m * (x_46_re_m * (x_46_im * 3.0));
}
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 <= 1.7e+67: tmp = x_46_im * (0.0 - (x_46_im * x_46_im)) else: tmp = x_46_re_m * (x_46_re_m * (x_46_im * 3.0)) 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 <= 1.7e+67) tmp = Float64(x_46_im * Float64(0.0 - Float64(x_46_im * x_46_im))); else tmp = Float64(x_46_re_m * Float64(x_46_re_m * Float64(x_46_im * 3.0))); 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 <= 1.7e+67) tmp = x_46_im * (0.0 - (x_46_im * x_46_im)); else tmp = x_46_re_m * (x_46_re_m * (x_46_im * 3.0)); 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, 1.7e+67], N[(x$46$im * N[(0.0 - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * N[(x$46$re$95$m * N[(x$46$im * 3.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 1.7 \cdot 10^{+67}:\\
\;\;\;\;x.im \cdot \left(0 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot \left(x.re\_m \cdot \left(x.im \cdot 3\right)\right)\\
\end{array}
\end{array}
if x.re < 1.7000000000000001e67Initial program 85.2%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6491.4%
Simplified91.4%
Taylor expanded in x.im around inf
mul-1-negN/A
unpow3N/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6469.7%
Simplified69.7%
sub0-negN/A
neg-lowering-neg.f6469.7%
Applied egg-rr69.7%
if 1.7000000000000001e67 < x.re Initial program 55.0%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6469.4%
Simplified69.4%
Taylor expanded in x.im around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.6%
Simplified65.6%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f6480.3%
Applied egg-rr80.3%
Final simplification72.3%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (if (<= x.re_m 1.22e+67) (* x.im (- 0.0 (* x.im x.im))) (* x.re_m (* 3.0 (* x.re_m 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 <= 1.22e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = x_46_re_m * (3.0 * (x_46_re_m * 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 <= 1.22d+67) then
tmp = x_46im * (0.0d0 - (x_46im * x_46im))
else
tmp = x_46re_m * (3.0d0 * (x_46re_m * 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 <= 1.22e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = x_46_re_m * (3.0 * (x_46_re_m * 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 <= 1.22e+67: tmp = x_46_im * (0.0 - (x_46_im * x_46_im)) else: tmp = x_46_re_m * (3.0 * (x_46_re_m * 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 <= 1.22e+67) tmp = Float64(x_46_im * Float64(0.0 - Float64(x_46_im * x_46_im))); else tmp = Float64(x_46_re_m * Float64(3.0 * Float64(x_46_re_m * 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 <= 1.22e+67) tmp = x_46_im * (0.0 - (x_46_im * x_46_im)); else tmp = x_46_re_m * (3.0 * (x_46_re_m * 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, 1.22e+67], N[(x$46$im * N[(0.0 - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x$46$re$95$m * N[(3.0 * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 1.22 \cdot 10^{+67}:\\
\;\;\;\;x.im \cdot \left(0 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;x.re\_m \cdot \left(3 \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < 1.22000000000000004e67Initial program 85.2%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6491.4%
Simplified91.4%
Taylor expanded in x.im around inf
mul-1-negN/A
unpow3N/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6469.7%
Simplified69.7%
sub0-negN/A
neg-lowering-neg.f6469.7%
Applied egg-rr69.7%
if 1.22000000000000004e67 < x.re Initial program 55.0%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6469.4%
Simplified69.4%
Taylor expanded in x.im around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.6%
Simplified65.6%
associate-*r*N/A
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6480.2%
Applied egg-rr80.2%
Final simplification72.3%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (if (<= x.re_m 1.24e+67) (* x.im (- 0.0 (* x.im x.im))) (* 3.0 (* x.re_m (* x.re_m 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 <= 1.24e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 1.24d+67) then
tmp = x_46im * (0.0d0 - (x_46im * x_46im))
else
tmp = 3.0d0 * (x_46re_m * (x_46re_m * 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 <= 1.24e+67) {
tmp = x_46_im * (0.0 - (x_46_im * x_46_im));
} else {
tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 1.24e+67: tmp = x_46_im * (0.0 - (x_46_im * x_46_im)) else: tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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 <= 1.24e+67) tmp = Float64(x_46_im * Float64(0.0 - Float64(x_46_im * x_46_im))); else tmp = Float64(3.0 * Float64(x_46_re_m * Float64(x_46_re_m * 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 <= 1.24e+67) tmp = x_46_im * (0.0 - (x_46_im * x_46_im)); else tmp = 3.0 * (x_46_re_m * (x_46_re_m * 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, 1.24e+67], N[(x$46$im * N[(0.0 - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$re$95$m * N[(x$46$re$95$m * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 1.24 \cdot 10^{+67}:\\
\;\;\;\;x.im \cdot \left(0 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.re\_m \cdot \left(x.re\_m \cdot x.im\right)\right)\\
\end{array}
\end{array}
if x.re < 1.24000000000000007e67Initial program 85.2%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6491.4%
Simplified91.4%
Taylor expanded in x.im around inf
mul-1-negN/A
unpow3N/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6469.7%
Simplified69.7%
sub0-negN/A
neg-lowering-neg.f6469.7%
Applied egg-rr69.7%
if 1.24000000000000007e67 < x.re Initial program 55.0%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6469.4%
Simplified69.4%
Taylor expanded in x.im around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.6%
Simplified65.6%
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f6480.2%
Applied egg-rr80.2%
Final simplification72.3%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (if (<= x.re_m 1.85e+67) (* x.im (- 0.0 (* 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 tmp;
if (x_46_re_m <= 1.85e+67) {
tmp = x_46_im * (0.0 - (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_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 <= 1.85d+67) then
tmp = x_46im * (0.0d0 - (x_46im * x_46im))
else
tmp = 3.0d0 * (x_46im * (x_46re_m * x_46re_m))
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 <= 1.85e+67) {
tmp = x_46_im * (0.0 - (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): tmp = 0 if x_46_re_m <= 1.85e+67: tmp = x_46_im * (0.0 - (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) tmp = 0.0 if (x_46_re_m <= 1.85e+67) tmp = Float64(x_46_im * Float64(0.0 - Float64(x_46_im * x_46_im))); else tmp = Float64(3.0 * Float64(x_46_im * Float64(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) tmp = 0.0; if (x_46_re_m <= 1.85e+67) tmp = x_46_im * (0.0 - (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_] := If[LessEqual[x$46$re$95$m, 1.85e+67], N[(x$46$im * N[(0.0 - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(3.0 * N[(x$46$im * N[(x$46$re$95$m * x$46$re$95$m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
\begin{array}{l}
\mathbf{if}\;x.re\_m \leq 1.85 \cdot 10^{+67}:\\
\;\;\;\;x.im \cdot \left(0 - x.im \cdot x.im\right)\\
\mathbf{else}:\\
\;\;\;\;3 \cdot \left(x.im \cdot \left(x.re\_m \cdot x.re\_m\right)\right)\\
\end{array}
\end{array}
if x.re < 1.8499999999999999e67Initial program 85.2%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6491.4%
Simplified91.4%
Taylor expanded in x.im around inf
mul-1-negN/A
unpow3N/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6469.7%
Simplified69.7%
sub0-negN/A
neg-lowering-neg.f6469.7%
Applied egg-rr69.7%
if 1.8499999999999999e67 < x.re Initial program 55.0%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6469.4%
Simplified69.4%
Taylor expanded in x.im around 0
*-lowering-*.f64N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6465.6%
Simplified65.6%
Final simplification68.7%
x.re_m = (fabs.f64 x.re) (FPCore (x.re_m x.im) :precision binary64 (* x.im (- 0.0 (* 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 * (0.0 - (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 * (0.0d0 - (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 * (0.0 - (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 * (0.0 - (x_46_im * x_46_im))
x.re_m = abs(x_46_re) function code(x_46_re_m, x_46_im) return Float64(x_46_im * Float64(0.0 - Float64(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 * (0.0 - (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[(x$46$im * N[(0.0 - N[(x$46$im * x$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
x.re_m = \left|x.re\right|
\\
x.im \cdot \left(0 - x.im \cdot x.im\right)
\end{array}
Initial program 77.8%
+-commutativeN/A
*-commutativeN/A
distribute-lft-outN/A
associate-*l*N/A
*-commutativeN/A
distribute-lft-outN/A
*-lowering-*.f64N/A
associate-+r-N/A
--lowering--.f64N/A
count-2N/A
associate-*l*N/A
distribute-lft1-inN/A
metadata-evalN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6486.0%
Simplified86.0%
Taylor expanded in x.im around inf
mul-1-negN/A
unpow3N/A
unpow2N/A
distribute-rgt-neg-inN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
neg-sub0N/A
--lowering--.f6457.5%
Simplified57.5%
sub0-negN/A
neg-lowering-neg.f6457.5%
Applied egg-rr57.5%
Final simplification57.5%
(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 2024145
(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)))