
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 21 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (cos im)))
double code(double re, double im) {
return exp(re) * cos(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * cos(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.cos(im);
}
def code(re, im): return math.exp(re) * math.cos(im)
function code(re, im) return Float64(exp(re) * cos(im)) end
function tmp = code(re, im) tmp = exp(re) * cos(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \cos im
\end{array}
(FPCore (re im) :precision binary64 (* (cos im) (exp re)))
double code(double re, double im) {
return cos(im) * exp(re);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = cos(im) * exp(re)
end function
public static double code(double re, double im) {
return Math.cos(im) * Math.exp(re);
}
def code(re, im): return math.cos(im) * math.exp(re)
function code(re, im) return Float64(cos(im) * exp(re)) end
function tmp = code(re, im) tmp = cos(im) * exp(re); end
code[re_, im_] := N[(N[Cos[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos im \cdot e^{re}
\end{array}
Initial program 100.0%
Final simplification100.0%
(FPCore (re im)
:precision binary64
(if (<= (exp re) 0.02)
(* 1.0 (* -0.5 (* im im)))
(if (<= (exp re) 1.0)
(* (+ 1.0 re) (cos im))
(*
(fma (* 0.041666666666666664 (* im im)) (* im im) 1.0)
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.02) {
tmp = 1.0 * (-0.5 * (im * im));
} else if (exp(re) <= 1.0) {
tmp = (1.0 + re) * cos(im);
} else {
tmp = fma((0.041666666666666664 * (im * im)), (im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 0.02) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); elseif (exp(re) <= 1.0) tmp = Float64(Float64(1.0 + re) * cos(im)); else tmp = Float64(fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.02], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[(N[(1.0 + re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.02:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\left(1 + re\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if 0.0200000000000000004 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6498.8
Applied rewrites98.8%
if 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.7
Applied rewrites87.7%
Taylor expanded in im around inf
Applied rewrites87.7%
Taylor expanded in re around 0
Applied rewrites67.1%
Final simplification72.7%
(FPCore (re im)
:precision binary64
(if (<= (exp re) 0.0)
(* 1.0 (* -0.5 (* im im)))
(if (<= (exp re) 1.0)
(cos im)
(*
(fma (* 0.041666666666666664 (* im im)) (* im im) 1.0)
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else if (exp(re) <= 1.0) {
tmp = cos(im);
} else {
tmp = fma((0.041666666666666664 * (im * im)), (im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 0.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); elseif (exp(re) <= 1.0) tmp = cos(im); else tmp = Float64(fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Exp[re], $MachinePrecision], 1.0], N[Cos[im], $MachinePrecision], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;e^{re} \leq 1:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in re around 0
Applied rewrites2.5%
Taylor expanded in im around inf
Applied rewrites34.8%
if 0.0 < (exp.f64 re) < 1Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6497.0
Applied rewrites97.0%
if 1 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6487.7
Applied rewrites87.7%
Taylor expanded in im around inf
Applied rewrites87.7%
Taylor expanded in re around 0
Applied rewrites67.1%
Final simplification72.6%
(FPCore (re im)
:precision binary64
(if (<= (* (cos im) (exp re)) 0.012)
(* 1.0 (* -0.5 (* im im)))
(*
(fma (* 0.041666666666666664 (* im im)) (* im im) 1.0)
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0))))
double code(double re, double im) {
double tmp;
if ((cos(im) * exp(re)) <= 0.012) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = fma((0.041666666666666664 * (im * im)), (im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(cos(im) * exp(re)) <= 0.012) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Cos[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.012], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos im \cdot e^{re} \leq 0.012:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.012Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.0
Applied rewrites63.0%
Taylor expanded in re around 0
Applied rewrites5.9%
Taylor expanded in im around inf
Applied rewrites28.6%
if 0.012 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.6
Applied rewrites78.6%
Taylor expanded in im around inf
Applied rewrites78.6%
Taylor expanded in re around 0
Applied rewrites70.4%
Final simplification53.6%
(FPCore (re im)
:precision binary64
(if (<= (* (cos im) (exp re)) 0.0)
(* 1.0 (* -0.5 (* im im)))
(*
(fma (fma 0.5 re 1.0) re 1.0)
(fma (* 0.041666666666666664 (* im im)) (* im im) 1.0))))
double code(double re, double im) {
double tmp;
if ((cos(im) * exp(re)) <= 0.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = fma(fma(0.5, re, 1.0), re, 1.0) * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(cos(im) * exp(re)) <= 0.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Cos[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos im \cdot e^{re} \leq 0:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
Taylor expanded in re around 0
Applied rewrites5.8%
Taylor expanded in im around inf
Applied rewrites29.1%
if -0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.9
Applied rewrites78.9%
Taylor expanded in im around inf
Applied rewrites78.8%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6467.1
Applied rewrites67.1%
Final simplification52.1%
(FPCore (re im) :precision binary64 (if (<= (* (cos im) (exp re)) 0.0) (* 1.0 (* -0.5 (* im im))) (* 1.0 (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0))))
double code(double re, double im) {
double tmp;
if ((cos(im) * exp(re)) <= 0.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = 1.0 * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(cos(im) * exp(re)) <= 0.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(1.0 * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Cos[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], 0.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\cos im \cdot e^{re} \leq 0:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.0Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6462.3
Applied rewrites62.3%
Taylor expanded in re around 0
Applied rewrites5.8%
Taylor expanded in im around inf
Applied rewrites29.1%
if -0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6478.9
Applied rewrites78.9%
Taylor expanded in im around inf
Applied rewrites78.8%
Taylor expanded in re around 0
Applied rewrites54.9%
Final simplification44.7%
(FPCore (re im)
:precision binary64
(if (<= re -0.102)
(* (fma (* im im) -0.5 1.0) (exp re))
(if (<= re 3e-25)
(* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) (cos im))
(if (<= re 8.4e+102)
(* (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0) (exp re))
(* (* (* (fma 0.16666666666666666 re 0.5) re) re) (cos im))))))
double code(double re, double im) {
double tmp;
if (re <= -0.102) {
tmp = fma((im * im), -0.5, 1.0) * exp(re);
} else if (re <= 3e-25) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * cos(im);
} else if (re <= 8.4e+102) {
tmp = fma((0.041666666666666664 * (im * im)), (im * im), 1.0) * exp(re);
} else {
tmp = ((fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (re <= -0.102) tmp = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)); elseif (re <= 3e-25) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * cos(im)); elseif (re <= 8.4e+102) tmp = Float64(fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0) * exp(re)); else tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im)); end return tmp end
code[re_, im_] := If[LessEqual[re, -0.102], N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3e-25], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 8.4e+102], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -0.102:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 8.4 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right) \cdot e^{re}\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot \cos im\\
\end{array}
\end{array}
if re < -0.101999999999999993Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.3
Applied rewrites76.3%
if -0.101999999999999993 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
if 2.9999999999999998e-25 < re < 8.40000000000000006e102Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6490.9
Applied rewrites90.9%
Taylor expanded in im around inf
Applied rewrites90.9%
if 8.40000000000000006e102 < re Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6497.9
Applied rewrites97.9%
Taylor expanded in re around inf
Applied rewrites97.9%
Final simplification91.7%
(FPCore (re im)
:precision binary64
(if (<= (exp re) 0.02)
(* 1.0 (* -0.5 (* im im)))
(*
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
(fma (* im im) -0.5 1.0))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.02) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 0.02) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.02], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.02:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if 0.0200000000000000004 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6459.8
Applied rewrites59.8%
Taylor expanded in re around 0
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
unpow2N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites52.8%
Final simplification47.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (* im im) -0.5 1.0) (exp re))))
(if (<= re -0.102)
t_0
(if (<= re 3e-25)
(* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) (cos im))
(if (<= re 1.02e+103)
t_0
(* (* (* (fma 0.16666666666666666 re 0.5) re) re) (cos im)))))))
double code(double re, double im) {
double t_0 = fma((im * im), -0.5, 1.0) * exp(re);
double tmp;
if (re <= -0.102) {
tmp = t_0;
} else if (re <= 3e-25) {
tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * cos(im);
} else if (re <= 1.02e+103) {
tmp = t_0;
} else {
tmp = ((fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im);
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)) tmp = 0.0 if (re <= -0.102) tmp = t_0; elseif (re <= 3e-25) tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * cos(im)); elseif (re <= 1.02e+103) tmp = t_0; else tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.102], t$95$0, If[LessEqual[re, 3e-25], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.02e+103], t$95$0, N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{if}\;re \leq -0.102:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot \cos im\\
\end{array}
\end{array}
if re < -0.101999999999999993 or 2.9999999999999998e-25 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.8
Applied rewrites77.8%
if -0.101999999999999993 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.7
Applied rewrites99.7%
if 1.01999999999999991e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in re around inf
Applied rewrites100.0%
Final simplification91.3%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (* im im) -0.5 1.0) (exp re))))
(if (<= re -0.008)
t_0
(if (<= re 3e-25)
(* (+ (* (fma 0.5 re 1.0) re) 1.0) (cos im))
(if (<= re 1.02e+103)
t_0
(* (* (* (fma 0.16666666666666666 re 0.5) re) re) (cos im)))))))
double code(double re, double im) {
double t_0 = fma((im * im), -0.5, 1.0) * exp(re);
double tmp;
if (re <= -0.008) {
tmp = t_0;
} else if (re <= 3e-25) {
tmp = ((fma(0.5, re, 1.0) * re) + 1.0) * cos(im);
} else if (re <= 1.02e+103) {
tmp = t_0;
} else {
tmp = ((fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im);
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)) tmp = 0.0 if (re <= -0.008) tmp = t_0; elseif (re <= 3e-25) tmp = Float64(Float64(Float64(fma(0.5, re, 1.0) * re) + 1.0) * cos(im)); elseif (re <= 1.02e+103) tmp = t_0; else tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * re) * re) * cos(im)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.008], t$95$0, If[LessEqual[re, 3e-25], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re), $MachinePrecision] + 1.0), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.02e+103], t$95$0, N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{if}\;re \leq -0.008:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot re + 1\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 1.02 \cdot 10^{+103}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot \cos im\\
\end{array}
\end{array}
if re < -0.0080000000000000002 or 2.9999999999999998e-25 < re < 1.01999999999999991e103Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6477.8
Applied rewrites77.8%
if -0.0080000000000000002 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
if 1.01999999999999991e103 < re Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64100.0
Applied rewrites100.0%
Taylor expanded in re around inf
Applied rewrites100.0%
Final simplification91.2%
(FPCore (re im)
:precision binary64
(if (<= (exp re) 0.02)
(* 1.0 (* -0.5 (* im im)))
(*
(fma (* (* re re) 0.16666666666666666) re 1.0)
(fma (* im im) -0.5 1.0))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.02) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = fma(((re * re) * 0.16666666666666666), re, 1.0) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 0.02) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(fma(Float64(Float64(re * re) * 0.16666666666666666), re, 1.0) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.02], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(re * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.02:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if 0.0200000000000000004 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6459.8
Applied rewrites59.8%
Taylor expanded in re around 0
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
unpow2N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites52.8%
Taylor expanded in re around inf
Applied rewrites52.6%
Final simplification47.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (* im im) -0.5 1.0) (exp re))))
(if (<= re -0.008)
t_0
(if (<= re 3e-25)
(* (+ (* (fma 0.5 re 1.0) re) 1.0) (cos im))
(if (<= re 1.4e+106)
t_0
(*
(fma (fma 0.041666666666666664 (* im im) -0.5) (* im im) 1.0)
(* (* re re) (fma 0.16666666666666666 re 0.5))))))))
double code(double re, double im) {
double t_0 = fma((im * im), -0.5, 1.0) * exp(re);
double tmp;
if (re <= -0.008) {
tmp = t_0;
} else if (re <= 3e-25) {
tmp = ((fma(0.5, re, 1.0) * re) + 1.0) * cos(im);
} else if (re <= 1.4e+106) {
tmp = t_0;
} else {
tmp = fma(fma(0.041666666666666664, (im * im), -0.5), (im * im), 1.0) * ((re * re) * fma(0.16666666666666666, re, 0.5));
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)) tmp = 0.0 if (re <= -0.008) tmp = t_0; elseif (re <= 3e-25) tmp = Float64(Float64(Float64(fma(0.5, re, 1.0) * re) + 1.0) * cos(im)); elseif (re <= 1.4e+106) tmp = t_0; else tmp = Float64(fma(fma(0.041666666666666664, Float64(im * im), -0.5), Float64(im * im), 1.0) * Float64(Float64(re * re) * fma(0.16666666666666666, re, 0.5))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.008], t$95$0, If[LessEqual[re, 3e-25], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re), $MachinePrecision] + 1.0), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.4e+106], t$95$0, N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision] + -0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * re + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{if}\;re \leq -0.008:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot re + 1\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 1.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, -0.5\right), im \cdot im, 1\right) \cdot \left(\left(re \cdot re\right) \cdot \mathsf{fma}\left(0.16666666666666666, re, 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.0080000000000000002 or 2.9999999999999998e-25 < re < 1.39999999999999996e106Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.0080000000000000002 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
Applied rewrites99.6%
if 1.39999999999999996e106 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.9
Applied rewrites91.9%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6491.9
Applied rewrites91.9%
Taylor expanded in re around inf
Applied rewrites91.9%
Final simplification90.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (* im im) -0.5 1.0) (exp re))))
(if (<= re -0.008)
t_0
(if (<= re 3e-25)
(* (fma (fma 0.5 re 1.0) re 1.0) (cos im))
(if (<= re 1.4e+106)
t_0
(*
(fma (fma 0.041666666666666664 (* im im) -0.5) (* im im) 1.0)
(* (* re re) (fma 0.16666666666666666 re 0.5))))))))
double code(double re, double im) {
double t_0 = fma((im * im), -0.5, 1.0) * exp(re);
double tmp;
if (re <= -0.008) {
tmp = t_0;
} else if (re <= 3e-25) {
tmp = fma(fma(0.5, re, 1.0), re, 1.0) * cos(im);
} else if (re <= 1.4e+106) {
tmp = t_0;
} else {
tmp = fma(fma(0.041666666666666664, (im * im), -0.5), (im * im), 1.0) * ((re * re) * fma(0.16666666666666666, re, 0.5));
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)) tmp = 0.0 if (re <= -0.008) tmp = t_0; elseif (re <= 3e-25) tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * cos(im)); elseif (re <= 1.4e+106) tmp = t_0; else tmp = Float64(fma(fma(0.041666666666666664, Float64(im * im), -0.5), Float64(im * im), 1.0) * Float64(Float64(re * re) * fma(0.16666666666666666, re, 0.5))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.008], t$95$0, If[LessEqual[re, 3e-25], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.4e+106], t$95$0, N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision] + -0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * re + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{if}\;re \leq -0.008:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 1.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, -0.5\right), im \cdot im, 1\right) \cdot \left(\left(re \cdot re\right) \cdot \mathsf{fma}\left(0.16666666666666666, re, 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.0080000000000000002 or 2.9999999999999998e-25 < re < 1.39999999999999996e106Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.0080000000000000002 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6499.6
Applied rewrites99.6%
if 1.39999999999999996e106 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.9
Applied rewrites91.9%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6491.9
Applied rewrites91.9%
Taylor expanded in re around inf
Applied rewrites91.9%
Final simplification90.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (fma (* im im) -0.5 1.0) (exp re))))
(if (<= re -0.007)
t_0
(if (<= re 3e-25)
(* (+ 1.0 re) (cos im))
(if (<= re 1.4e+106)
t_0
(*
(fma (fma 0.041666666666666664 (* im im) -0.5) (* im im) 1.0)
(* (* re re) (fma 0.16666666666666666 re 0.5))))))))
double code(double re, double im) {
double t_0 = fma((im * im), -0.5, 1.0) * exp(re);
double tmp;
if (re <= -0.007) {
tmp = t_0;
} else if (re <= 3e-25) {
tmp = (1.0 + re) * cos(im);
} else if (re <= 1.4e+106) {
tmp = t_0;
} else {
tmp = fma(fma(0.041666666666666664, (im * im), -0.5), (im * im), 1.0) * ((re * re) * fma(0.16666666666666666, re, 0.5));
}
return tmp;
}
function code(re, im) t_0 = Float64(fma(Float64(im * im), -0.5, 1.0) * exp(re)) tmp = 0.0 if (re <= -0.007) tmp = t_0; elseif (re <= 3e-25) tmp = Float64(Float64(1.0 + re) * cos(im)); elseif (re <= 1.4e+106) tmp = t_0; else tmp = Float64(fma(fma(0.041666666666666664, Float64(im * im), -0.5), Float64(im * im), 1.0) * Float64(Float64(re * re) * fma(0.16666666666666666, re, 0.5))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[re, -0.007], t$95$0, If[LessEqual[re, 3e-25], N[(N[(1.0 + re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.4e+106], t$95$0, N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision] + -0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * re + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(im \cdot im, -0.5, 1\right) \cdot e^{re}\\
\mathbf{if}\;re \leq -0.007:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\left(1 + re\right) \cdot \cos im\\
\mathbf{elif}\;re \leq 1.4 \cdot 10^{+106}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, -0.5\right), im \cdot im, 1\right) \cdot \left(\left(re \cdot re\right) \cdot \mathsf{fma}\left(0.16666666666666666, re, 0.5\right)\right)\\
\end{array}
\end{array}
if re < -0.00700000000000000015 or 2.9999999999999998e-25 < re < 1.39999999999999996e106Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6478.0
Applied rewrites78.0%
if -0.00700000000000000015 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6499.5
Applied rewrites99.5%
if 1.39999999999999996e106 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6491.9
Applied rewrites91.9%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6491.9
Applied rewrites91.9%
Taylor expanded in re around inf
Applied rewrites91.9%
Final simplification90.0%
(FPCore (re im) :precision binary64 (if (<= (exp re) 0.02) (* 1.0 (* -0.5 (* im im))) (* (+ 1.0 re) (fma (* im im) -0.5 1.0))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 0.02) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = (1.0 + re) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 0.02) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(Float64(1.0 + re) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 0.02], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 0.02:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 0.0200000000000000004Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if 0.0200000000000000004 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6459.8
Applied rewrites59.8%
Taylor expanded in re around 0
lower-+.f6441.8
Applied rewrites41.8%
Final simplification39.5%
(FPCore (re im) :precision binary64 (if (<= (exp re) 1.25e-175) (* 1.0 (* -0.5 (* im im))) (* 1.0 (fma (* im im) -0.5 1.0))))
double code(double re, double im) {
double tmp;
if (exp(re) <= 1.25e-175) {
tmp = 1.0 * (-0.5 * (im * im));
} else {
tmp = 1.0 * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (exp(re) <= 1.25e-175) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); else tmp = Float64(1.0 * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[Exp[re], $MachinePrecision], 1.25e-175], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \leq 1.25 \cdot 10^{-175}:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if (exp.f64 re) < 1.25e-175Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in re around 0
Applied rewrites2.5%
Taylor expanded in im around inf
Applied rewrites34.8%
if 1.25e-175 < (exp.f64 re) Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6460.2
Applied rewrites60.2%
Taylor expanded in re around 0
Applied rewrites40.4%
Final simplification38.8%
(FPCore (re im)
:precision binary64
(if (<= re -1.0)
(* (* -0.5 (* im im)) (exp re))
(if (<= re 3e-25)
(* (+ 1.0 re) (cos im))
(*
(fma (* 0.041666666666666664 (* im im)) (* im im) 1.0)
(fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -1.0) {
tmp = (-0.5 * (im * im)) * exp(re);
} else if (re <= 3e-25) {
tmp = (1.0 + re) * cos(im);
} else {
tmp = fma((0.041666666666666664 * (im * im)), (im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (re <= -1.0) tmp = Float64(Float64(-0.5 * Float64(im * im)) * exp(re)); elseif (re <= 3e-25) tmp = Float64(Float64(1.0 + re) * cos(im)); else tmp = Float64(fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0) * fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[re, -1.0], N[(N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 3e-25], N[(N[(1.0 + re), $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1:\\
\;\;\;\;\left(-0.5 \cdot \left(im \cdot im\right)\right) \cdot e^{re}\\
\mathbf{elif}\;re \leq 3 \cdot 10^{-25}:\\
\;\;\;\;\left(1 + re\right) \cdot \cos im\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right)\\
\end{array}
\end{array}
if re < -1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in im around inf
Applied rewrites73.4%
if -1 < re < 2.9999999999999998e-25Initial program 100.0%
Taylor expanded in re around 0
lower-+.f6498.8
Applied rewrites98.8%
if 2.9999999999999998e-25 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in im around inf
Applied rewrites88.5%
Taylor expanded in re around 0
Applied rewrites69.2%
Final simplification84.3%
(FPCore (re im)
:precision binary64
(if (<= re -1.0)
(* 1.0 (* -0.5 (* im im)))
(if (<= re 1.75e+78)
(* (+ 1.0 re) (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0))
(*
(* (* re re) (fma 0.16666666666666666 re 0.5))
(fma (* im im) -0.5 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -1.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else if (re <= 1.75e+78) {
tmp = (1.0 + re) * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
} else {
tmp = ((re * re) * fma(0.16666666666666666, re, 0.5)) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (re <= -1.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); elseif (re <= 1.75e+78) tmp = Float64(Float64(1.0 + re) * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0)); else tmp = Float64(Float64(Float64(re * re) * fma(0.16666666666666666, re, 0.5)) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[re, -1.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1.75e+78], N[(N[(1.0 + re), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * re + 0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 1.75 \cdot 10^{+78}:\\
\;\;\;\;\left(1 + re\right) \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(re \cdot re\right) \cdot \mathsf{fma}\left(0.16666666666666666, re, 0.5\right)\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if re < -1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if -1 < re < 1.7500000000000001e78Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6460.3
Applied rewrites60.3%
Taylor expanded in im around inf
Applied rewrites60.3%
Taylor expanded in re around 0
lower-+.f6452.4
Applied rewrites52.4%
if 1.7500000000000001e78 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6463.4
Applied rewrites63.4%
Taylor expanded in re around 0
+-commutativeN/A
+-commutativeN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
distribute-rgt-inN/A
+-commutativeN/A
associate-*l*N/A
unpow2N/A
rgt-mult-inverseN/A
distribute-lft-inN/A
associate-+r+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites59.0%
Taylor expanded in re around inf
Applied rewrites59.0%
Final simplification48.0%
(FPCore (re im)
:precision binary64
(if (<= re -1.0)
(* 1.0 (* -0.5 (* im im)))
(if (<= re 4.9e+173)
(* (+ 1.0 re) (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0))
(* (* (* re re) 0.5) (fma (* im im) -0.5 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -1.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else if (re <= 4.9e+173) {
tmp = (1.0 + re) * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
} else {
tmp = ((re * re) * 0.5) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (re <= -1.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); elseif (re <= 4.9e+173) tmp = Float64(Float64(1.0 + re) * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0)); else tmp = Float64(Float64(Float64(re * re) * 0.5) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[re, -1.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.9e+173], N[(N[(1.0 + re), $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -1:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 4.9 \cdot 10^{+173}:\\
\;\;\;\;\left(1 + re\right) \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if re < -1Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6476.0
Applied rewrites76.0%
Taylor expanded in re around 0
Applied rewrites2.8%
Taylor expanded in im around inf
Applied rewrites33.9%
if -1 < re < 4.9000000000000001e173Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6462.6
Applied rewrites62.6%
Taylor expanded in im around inf
Applied rewrites62.6%
Taylor expanded in re around 0
lower-+.f6451.1
Applied rewrites51.1%
if 4.9000000000000001e173 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6466.7
Applied rewrites66.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
rgt-mult-inverseN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
distribute-lft-inN/A
*-commutativeN/A
Applied rewrites66.7%
Taylor expanded in re around inf
Applied rewrites66.7%
Taylor expanded in re around inf
Applied rewrites66.7%
Final simplification47.7%
(FPCore (re im)
:precision binary64
(if (<= re -360.0)
(* 1.0 (* -0.5 (* im im)))
(if (<= re 4.9e+173)
(* 1.0 (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0))
(* (* (* re re) 0.5) (fma (* im im) -0.5 1.0)))))
double code(double re, double im) {
double tmp;
if (re <= -360.0) {
tmp = 1.0 * (-0.5 * (im * im));
} else if (re <= 4.9e+173) {
tmp = 1.0 * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
} else {
tmp = ((re * re) * 0.5) * fma((im * im), -0.5, 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (re <= -360.0) tmp = Float64(1.0 * Float64(-0.5 * Float64(im * im))); elseif (re <= 4.9e+173) tmp = Float64(1.0 * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0)); else tmp = Float64(Float64(Float64(re * re) * 0.5) * fma(Float64(im * im), -0.5, 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[re, -360.0], N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 4.9e+173], N[(1.0 * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;re \leq -360:\\
\;\;\;\;1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 4.9 \cdot 10^{+173}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot \mathsf{fma}\left(im \cdot im, -0.5, 1\right)\\
\end{array}
\end{array}
if re < -360Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6475.3
Applied rewrites75.3%
Taylor expanded in re around 0
Applied rewrites2.5%
Taylor expanded in im around inf
Applied rewrites34.8%
if -360 < re < 4.9000000000000001e173Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
sub-negN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6463.1
Applied rewrites63.1%
Taylor expanded in im around inf
Applied rewrites63.0%
Taylor expanded in re around 0
Applied rewrites50.4%
if 4.9000000000000001e173 < re Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6466.7
Applied rewrites66.7%
Taylor expanded in re around 0
+-commutativeN/A
distribute-lft-inN/A
metadata-evalN/A
lft-mult-inverseN/A
associate-*l*N/A
associate-*r*N/A
unpow2N/A
*-commutativeN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
rgt-mult-inverseN/A
associate-*l*N/A
unpow2N/A
cube-multN/A
distribute-lft-inN/A
*-commutativeN/A
Applied rewrites66.7%
Taylor expanded in re around inf
Applied rewrites66.7%
Taylor expanded in re around inf
Applied rewrites66.7%
Final simplification47.6%
(FPCore (re im) :precision binary64 (* 1.0 (* -0.5 (* im im))))
double code(double re, double im) {
return 1.0 * (-0.5 * (im * im));
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0 * ((-0.5d0) * (im * im))
end function
public static double code(double re, double im) {
return 1.0 * (-0.5 * (im * im));
}
def code(re, im): return 1.0 * (-0.5 * (im * im))
function code(re, im) return Float64(1.0 * Float64(-0.5 * Float64(im * im))) end
function tmp = code(re, im) tmp = 1.0 * (-0.5 * (im * im)); end
code[re_, im_] := N[(1.0 * N[(-0.5 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot \left(-0.5 \cdot \left(im \cdot im\right)\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f6464.5
Applied rewrites64.5%
Taylor expanded in re around 0
Applied rewrites29.6%
Taylor expanded in im around inf
Applied rewrites12.6%
Final simplification12.6%
herbie shell --seed 2024285
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))