
(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 22 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 (* (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}
Initial program 100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))) (t_1 (* (cos im) (+ re 1.0))))
(if (<= t_0 (- INFINITY))
(*
(* re re)
(* re (fma (* im im) -0.08333333333333333 0.16666666666666666)))
(if (<= t_0 -0.1)
t_1
(if (<= t_0 0.0) (exp re) (if (<= t_0 0.995) t_1 (exp re)))))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double t_1 = cos(im) * (re + 1.0);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (re * re) * (re * fma((im * im), -0.08333333333333333, 0.16666666666666666));
} else if (t_0 <= -0.1) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = exp(re);
} else if (t_0 <= 0.995) {
tmp = t_1;
} else {
tmp = exp(re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) t_1 = Float64(cos(im) * Float64(re + 1.0)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(re * re) * Float64(re * fma(Float64(im * im), -0.08333333333333333, 0.16666666666666666))); elseif (t_0 <= -0.1) tmp = t_1; elseif (t_0 <= 0.0) tmp = exp(re); elseif (t_0 <= 0.995) tmp = t_1; else tmp = exp(re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * re), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * -0.08333333333333333 + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.1], t$95$1, If[LessEqual[t$95$0, 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[t$95$0, 0.995], t$95$1, N[Exp[re], $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
t_1 := \cos im \cdot \left(re + 1\right)\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, -0.08333333333333333, 0.16666666666666666\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t\_0 \leq 0.995:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.9
Simplified88.9%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64100.0
Simplified100.0%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified100.0%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Simplified100.0%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001 or 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.994999999999999996Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6499.1
Simplified99.1%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0 or 0.994999999999999996 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Final simplification99.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 (- INFINITY))
(*
(* re re)
(* re (fma (* im im) -0.08333333333333333 0.16666666666666666)))
(if (<= t_0 -0.1)
(cos im)
(if (<= t_0 0.0) (exp re) (if (<= t_0 0.995) (cos im) (exp re)))))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = (re * re) * (re * fma((im * im), -0.08333333333333333, 0.16666666666666666));
} else if (t_0 <= -0.1) {
tmp = cos(im);
} else if (t_0 <= 0.0) {
tmp = exp(re);
} else if (t_0 <= 0.995) {
tmp = cos(im);
} else {
tmp = exp(re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(Float64(re * re) * Float64(re * fma(Float64(im * im), -0.08333333333333333, 0.16666666666666666))); elseif (t_0 <= -0.1) tmp = cos(im); elseif (t_0 <= 0.0) tmp = exp(re); elseif (t_0 <= 0.995) tmp = cos(im); else tmp = exp(re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * re), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * -0.08333333333333333 + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Cos[im], $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[t$95$0, 0.995], N[Cos[im], $MachinePrecision], N[Exp[re], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, -0.08333333333333333, 0.16666666666666666\right)\right)\\
\mathbf{elif}\;t\_0 \leq -0.1:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t\_0 \leq 0.995:\\
\;\;\;\;\cos im\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.9
Simplified88.9%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64100.0
Simplified100.0%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified100.0%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Simplified100.0%
if -inf.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001 or 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.994999999999999996Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6497.8
Simplified97.8%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0 or 0.994999999999999996 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im)))
(t_1
(*
(cos im)
(fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))
(if (<= t_0 -0.1)
t_1
(if (<= t_0 0.0) (exp re) (if (<= t_0 0.995) t_1 (exp re))))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double t_1 = cos(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
double tmp;
if (t_0 <= -0.1) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = exp(re);
} else if (t_0 <= 0.995) {
tmp = t_1;
} else {
tmp = exp(re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) t_1 = Float64(cos(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)) tmp = 0.0 if (t_0 <= -0.1) tmp = t_1; elseif (t_0 <= 0.0) tmp = exp(re); elseif (t_0 <= 0.995) tmp = t_1; else tmp = exp(re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], t$95$1, If[LessEqual[t$95$0, 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[t$95$0, 0.995], t$95$1, N[Exp[re], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
t_1 := \cos im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t\_0 \leq 0.995:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001 or 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.994999999999999996Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6497.6
Simplified97.6%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0 or 0.994999999999999996 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Final simplification99.2%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im)))
(t_1 (* (cos im) (fma re (fma re 0.5 1.0) 1.0))))
(if (<= t_0 -0.1)
t_1
(if (<= t_0 0.0) (exp re) (if (<= t_0 0.995) t_1 (exp re))))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double t_1 = cos(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
double tmp;
if (t_0 <= -0.1) {
tmp = t_1;
} else if (t_0 <= 0.0) {
tmp = exp(re);
} else if (t_0 <= 0.995) {
tmp = t_1;
} else {
tmp = exp(re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) t_1 = Float64(cos(im) * fma(re, fma(re, 0.5, 1.0), 1.0)) tmp = 0.0 if (t_0 <= -0.1) tmp = t_1; elseif (t_0 <= 0.0) tmp = exp(re); elseif (t_0 <= 0.995) tmp = t_1; else tmp = exp(re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], t$95$1, If[LessEqual[t$95$0, 0.0], N[Exp[re], $MachinePrecision], If[LessEqual[t$95$0, 0.995], t$95$1, N[Exp[re], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
t_1 := \cos im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;e^{re}\\
\mathbf{elif}\;t\_0 \leq 0.995:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;e^{re}\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001 or 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.994999999999999996Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6495.1
Simplified95.1%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0 or 0.994999999999999996 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Final simplification98.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(*
(fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0)
(fma im (* im -0.5) 1.0))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) * fma(im, (im * -0.5), 1.0);
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) * fma(im, Float64(im * -0.5), 1.0)); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6496.8
Simplified96.8%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6431.7
Simplified31.7%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(*
(fma im (* im -0.5) 1.0)
(* re (* re (fma re 0.16666666666666666 0.5))))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = fma(im, (im * -0.5), 1.0) * (re * (re * fma(re, 0.16666666666666666, 0.5)));
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(fma(im, Float64(im * -0.5), 1.0) * Float64(re * Float64(re * fma(re, 0.16666666666666666, 0.5)))); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.5, 1\right) \cdot \left(re \cdot \left(re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6496.8
Simplified96.8%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6431.7
Simplified31.7%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
unpow2N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
associate-*r*N/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6431.4
Simplified31.4%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
Final simplification56.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(* im (* im (* -0.5 (fma re (* re (fma re 0.16666666666666666 0.5)) re))))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = im * (im * (-0.5 * fma(re, (re * fma(re, 0.16666666666666666, 0.5)), re)));
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(im * Float64(im * Float64(-0.5 * fma(re, Float64(re * fma(re, 0.16666666666666666, 0.5)), re)))); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(im * N[(im * N[(-0.5 * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;im \cdot \left(im \cdot \left(-0.5 \cdot \mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re\right)\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6496.8
Simplified96.8%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6431.7
Simplified31.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified31.2%
Taylor expanded in im around inf
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6431.3
Simplified31.3%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(*
(* re re)
(* re (fma (* im im) -0.08333333333333333 0.16666666666666666)))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = (re * re) * (re * fma((im * im), -0.08333333333333333, 0.16666666666666666));
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(Float64(re * re) * Float64(re * fma(Float64(im * im), -0.08333333333333333, 0.16666666666666666))); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(re * re), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * -0.08333333333333333 + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, -0.08333333333333333, 0.16666666666666666\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6496.8
Simplified96.8%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6431.7
Simplified31.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified31.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Simplified30.8%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(* re (* re (fma (* im im) -0.25 0.5)))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = re * (re * fma((im * im), -0.25, 0.5));
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(re * Float64(re * fma(Float64(im * im), -0.25, 0.5))); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(re * N[(re * N[(N[(im * im), $MachinePrecision] * -0.25 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;re \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, -0.25, 0.5\right)\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6493.6
Simplified93.6%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6430.2
Simplified30.2%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
metadata-eval30.4
Simplified30.4%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 -0.1)
(* (+ re 1.0) (fma im (* im -0.5) 1.0))
(if (<= t_0 0.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= -0.1) {
tmp = (re + 1.0) * fma(im, (im * -0.5), 1.0);
} else if (t_0 <= 0.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= -0.1) tmp = Float64(Float64(re + 1.0) * fma(im, Float64(im * -0.5), 1.0)); elseif (t_0 <= 0.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(re + 1.0), $MachinePrecision] * N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq -0.1:\\
\;\;\;\;\left(re + 1\right) \cdot \mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < -0.10000000000000001Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6473.3
Simplified73.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6427.0
Simplified27.0%
if -0.10000000000000001 < (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6437.4
Simplified37.4%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 0.0)
(fma (* im im) (* re -0.5) re)
(if (<= t_0 2.0)
(fma re (fma 0.5 re 1.0) 1.0)
(fma re (* re (fma re 0.16666666666666666 0.5)) re)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= 0.0) {
tmp = fma((im * im), (re * -0.5), re);
} else if (t_0 <= 2.0) {
tmp = fma(re, fma(0.5, re, 1.0), 1.0);
} else {
tmp = fma(re, (re * fma(re, 0.16666666666666666, 0.5)), re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= 0.0) tmp = fma(Float64(im * im), Float64(re * -0.5), re); elseif (t_0 <= 2.0) tmp = fma(re, fma(0.5, re, 1.0), 1.0); else tmp = fma(re, Float64(re * fma(re, 0.16666666666666666, 0.5)), re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision] + re), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(re * N[(0.5 * re + 1.0), $MachinePrecision] + 1.0), $MachinePrecision], N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, re \cdot -0.5, re\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(0.5, re, 1\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6449.3
Simplified49.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6416.7
Simplified16.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified16.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6414.2
Simplified14.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 2Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6479.9
Simplified79.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6479.9
Simplified79.9%
if 2 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.7
Simplified62.7%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6443.5
Simplified43.5%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified43.5%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6462.7
Simplified62.7%
Final simplification46.8%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 0.0)
(fma im (* im -0.5) 1.0)
(if (<= t_0 2.0) (+ re 1.0) (fma re (* re 0.5) re)))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= 0.0) {
tmp = fma(im, (im * -0.5), 1.0);
} else if (t_0 <= 2.0) {
tmp = re + 1.0;
} else {
tmp = fma(re, (re * 0.5), re);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= 0.0) tmp = fma(im, Float64(im * -0.5), 1.0); elseif (t_0 <= 2.0) tmp = Float64(re + 1.0); else tmp = fma(re, Float64(re * 0.5), re); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision] + re), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, re \cdot 0.5, re\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6437.3
Simplified37.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.2
Simplified9.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 2Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6479.9
Simplified79.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6479.6
Simplified79.6%
if 2 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.6
Simplified42.6%
Taylor expanded in re around inf
distribute-lft-inN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
rgt-mult-inverseN/A
*-rgt-identityN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6442.6
Simplified42.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (cos im))))
(if (<= t_0 0.0)
(fma im (* im -0.5) 1.0)
(if (<= t_0 2.0) (+ re 1.0) (* re (* re 0.5))))))
double code(double re, double im) {
double t_0 = exp(re) * cos(im);
double tmp;
if (t_0 <= 0.0) {
tmp = fma(im, (im * -0.5), 1.0);
} else if (t_0 <= 2.0) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * cos(im)) tmp = 0.0 if (t_0 <= 0.0) tmp = fma(im, Float64(im * -0.5), 1.0); elseif (t_0 <= 2.0) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision], If[LessEqual[t$95$0, 2.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \cos im\\
\mathbf{if}\;t\_0 \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{elif}\;t\_0 \leq 2:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6437.3
Simplified37.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.2
Simplified9.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) < 2Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6479.9
Simplified79.9%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6479.6
Simplified79.6%
if 2 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.6
Simplified42.6%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.6
Simplified42.6%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) 0.0) (* (+ re 1.0) (fma im (* im -0.5) 1.0)) (fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= 0.0) {
tmp = (re + 1.0) * fma(im, (im * -0.5), 1.0);
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= 0.0) tmp = Float64(Float64(re + 1.0) * fma(im, Float64(im * -0.5), 1.0)); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(re + 1.0), $MachinePrecision] * N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq 0:\\
\;\;\;\;\left(re + 1\right) \cdot \mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6437.8
Simplified37.8%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6414.5
Simplified14.5%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) 0.0) (fma (* im im) (* re -0.5) re) (fma re (fma re (fma 0.16666666666666666 re 0.5) 1.0) 1.0)))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= 0.0) {
tmp = fma((im * im), (re * -0.5), re);
} else {
tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= 0.0) tmp = fma(Float64(im * im), Float64(re * -0.5), re); else tmp = fma(re, fma(re, fma(0.16666666666666666, re, 0.5), 1.0), 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(re * N[(0.16666666666666666 * re + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, re \cdot -0.5, re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(0.16666666666666666, re, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6449.3
Simplified49.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6416.7
Simplified16.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified16.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6414.2
Simplified14.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6488.3
Simplified88.3%
Taylor expanded in im around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6474.6
Simplified74.6%
Final simplification46.8%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) 0.0) (fma (* im im) (* re -0.5) re) (fma re (fma 0.5 re 1.0) 1.0)))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= 0.0) {
tmp = fma((im * im), (re * -0.5), re);
} else {
tmp = fma(re, fma(0.5, re, 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= 0.0) tmp = fma(Float64(im * im), Float64(re * -0.5), re); else tmp = fma(re, fma(0.5, re, 1.0), 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im * im), $MachinePrecision] * N[(re * -0.5), $MachinePrecision] + re), $MachinePrecision], N[(re * N[(0.5 * re + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im \cdot im, re \cdot -0.5, re\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(0.5, re, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f6449.3
Simplified49.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6416.7
Simplified16.7%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified16.5%
Taylor expanded in re around 0
+-commutativeN/A
distribute-rgt-inN/A
*-commutativeN/A
associate-*l*N/A
*-lft-identityN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f64N/A
lower-*.f6414.2
Simplified14.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6486.2
Simplified86.2%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6468.3
Simplified68.3%
Final simplification43.4%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) 0.0) (fma im (* im -0.5) 1.0) (fma re (fma 0.5 re 1.0) 1.0)))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= 0.0) {
tmp = fma(im, (im * -0.5), 1.0);
} else {
tmp = fma(re, fma(0.5, re, 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= 0.0) tmp = fma(im, Float64(im * -0.5), 1.0); else tmp = fma(re, fma(0.5, re, 1.0), 1.0); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(im * -0.5), $MachinePrecision] + 1.0), $MachinePrecision], N[(re * N[(0.5 * re + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq 0:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(0.5, re, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6437.3
Simplified37.3%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f649.2
Simplified9.2%
if 0.0 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6486.2
Simplified86.2%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6468.3
Simplified68.3%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (cos im)) 2.0) (+ re 1.0) (* re (* re 0.5))))
double code(double re, double im) {
double tmp;
if ((exp(re) * cos(im)) <= 2.0) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((exp(re) * cos(im)) <= 2.0d0) then
tmp = re + 1.0d0
else
tmp = re * (re * 0.5d0)
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) * Math.cos(im)) <= 2.0) {
tmp = re + 1.0;
} else {
tmp = re * (re * 0.5);
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) * math.cos(im)) <= 2.0: tmp = re + 1.0 else: tmp = re * (re * 0.5) return tmp
function code(re, im) tmp = 0.0 if (Float64(exp(re) * cos(im)) <= 2.0) tmp = Float64(re + 1.0); else tmp = Float64(re * Float64(re * 0.5)); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) * cos(im)) <= 2.0) tmp = re + 1.0; else tmp = re * (re * 0.5); end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Cos[im], $MachinePrecision]), $MachinePrecision], 2.0], N[(re + 1.0), $MachinePrecision], N[(re * N[(re * 0.5), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \cos im \leq 2:\\
\;\;\;\;re + 1\\
\mathbf{else}:\\
\;\;\;\;re \cdot \left(re \cdot 0.5\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (cos.f64 im)) < 2Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6463.6
Simplified63.6%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6436.5
Simplified36.5%
if 2 < (*.f64 (exp.f64 re) (cos.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f64100.0
Simplified100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f6442.6
Simplified42.6%
Taylor expanded in re around inf
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f6442.6
Simplified42.6%
(FPCore (re im)
:precision binary64
(let* ((t_0 (fma re (* re (fma re 0.16666666666666666 0.5)) re)))
(if (<= re -18500000000000.0)
(* 0.041666666666666664 (* (* im im) (* im im)))
(if (<= re 460000.0)
(cos im)
(if (<= re 1.05e+103)
(*
im
(*
im
(fma
-0.5
t_0
(fma
(fma re 0.16666666666666666 0.5)
(/ (* re re) (* im im))
(/ re (* im im))))))
(if (<= re 6.4e+122)
t_0
(*
(* re re)
(*
re
(fma (* im im) -0.08333333333333333 0.16666666666666666)))))))))
double code(double re, double im) {
double t_0 = fma(re, (re * fma(re, 0.16666666666666666, 0.5)), re);
double tmp;
if (re <= -18500000000000.0) {
tmp = 0.041666666666666664 * ((im * im) * (im * im));
} else if (re <= 460000.0) {
tmp = cos(im);
} else if (re <= 1.05e+103) {
tmp = im * (im * fma(-0.5, t_0, fma(fma(re, 0.16666666666666666, 0.5), ((re * re) / (im * im)), (re / (im * im)))));
} else if (re <= 6.4e+122) {
tmp = t_0;
} else {
tmp = (re * re) * (re * fma((im * im), -0.08333333333333333, 0.16666666666666666));
}
return tmp;
}
function code(re, im) t_0 = fma(re, Float64(re * fma(re, 0.16666666666666666, 0.5)), re) tmp = 0.0 if (re <= -18500000000000.0) tmp = Float64(0.041666666666666664 * Float64(Float64(im * im) * Float64(im * im))); elseif (re <= 460000.0) tmp = cos(im); elseif (re <= 1.05e+103) tmp = Float64(im * Float64(im * fma(-0.5, t_0, fma(fma(re, 0.16666666666666666, 0.5), Float64(Float64(re * re) / Float64(im * im)), Float64(re / Float64(im * im)))))); elseif (re <= 6.4e+122) tmp = t_0; else tmp = Float64(Float64(re * re) * Float64(re * fma(Float64(im * im), -0.08333333333333333, 0.16666666666666666))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision] + re), $MachinePrecision]}, If[LessEqual[re, -18500000000000.0], N[(0.041666666666666664 * N[(N[(im * im), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 460000.0], N[Cos[im], $MachinePrecision], If[LessEqual[re, 1.05e+103], N[(im * N[(im * N[(-0.5 * t$95$0 + N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] / N[(im * im), $MachinePrecision]), $MachinePrecision] + N[(re / N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 6.4e+122], t$95$0, N[(N[(re * re), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * -0.08333333333333333 + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re\right)\\
\mathbf{if}\;re \leq -18500000000000:\\
\;\;\;\;0.041666666666666664 \cdot \left(\left(im \cdot im\right) \cdot \left(im \cdot im\right)\right)\\
\mathbf{elif}\;re \leq 460000:\\
\;\;\;\;\cos im\\
\mathbf{elif}\;re \leq 1.05 \cdot 10^{+103}:\\
\;\;\;\;im \cdot \left(im \cdot \mathsf{fma}\left(-0.5, t\_0, \mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), \frac{re \cdot re}{im \cdot im}, \frac{re}{im \cdot im}\right)\right)\right)\\
\mathbf{elif}\;re \leq 6.4 \cdot 10^{+122}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\left(re \cdot re\right) \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, -0.08333333333333333, 0.16666666666666666\right)\right)\\
\end{array}
\end{array}
if re < -1.85e13Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f643.1
Simplified3.1%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*l*N/A
lower-fma.f64N/A
lower-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
lower-fma.f64N/A
unpow2N/A
lower-*.f642.5
Simplified2.5%
Taylor expanded in im around inf
lower-*.f64N/A
metadata-evalN/A
pow-sqrN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
unpow2N/A
lower-*.f6439.3
Simplified39.3%
if -1.85e13 < re < 4.6e5Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6494.6
Simplified94.6%
if 4.6e5 < re < 1.0500000000000001e103Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f646.0
Simplified6.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6415.6
Simplified15.6%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified15.6%
Taylor expanded in im around inf
unpow2N/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-fma.f64N/A
Simplified64.9%
if 1.0500000000000001e103 < re < 6.40000000000000024e122Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64100.0
Simplified100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6437.5
Simplified37.5%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified37.5%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
lower-fma.f64N/A
lower-*.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64100.0
Simplified100.0%
if 6.40000000000000024e122 < re Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64100.0
Simplified100.0%
Taylor expanded in im around 0
+-commutativeN/A
unpow2N/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.9
Simplified90.9%
Taylor expanded in re around inf
cube-multN/A
unpow2N/A
associate-*l*N/A
associate-+r+N/A
distribute-lft-inN/A
rgt-mult-inverseN/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
Simplified90.9%
Taylor expanded in re around inf
*-commutativeN/A
associate-*r*N/A
cube-multN/A
unpow2N/A
associate-*r*N/A
associate-*r*N/A
*-commutativeN/A
*-commutativeN/A
lower-*.f64N/A
unpow2N/A
lower-*.f64N/A
*-commutativeN/A
associate-*l*N/A
*-commutativeN/A
lower-*.f64N/A
distribute-rgt-inN/A
metadata-evalN/A
+-commutativeN/A
*-commutativeN/A
associate-*r*N/A
*-commutativeN/A
lower-fma.f64N/A
Simplified90.9%
(FPCore (re im) :precision binary64 (+ re 1.0))
double code(double re, double im) {
return re + 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = re + 1.0d0
end function
public static double code(double re, double im) {
return re + 1.0;
}
def code(re, im): return re + 1.0
function code(re, im) return Float64(re + 1.0) end
function tmp = code(re, im) tmp = re + 1.0; end
code[re_, im_] := N[(re + 1.0), $MachinePrecision]
\begin{array}{l}
\\
re + 1
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
lower-exp.f6469.8
Simplified69.8%
Taylor expanded in re around 0
+-commutativeN/A
lower-+.f6431.2
Simplified31.2%
(FPCore (re im) :precision binary64 1.0)
double code(double re, double im) {
return 1.0;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = 1.0d0
end function
public static double code(double re, double im) {
return 1.0;
}
def code(re, im): return 1.0
function code(re, im) return 1.0 end
function tmp = code(re, im) tmp = 1.0; end
code[re_, im_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 100.0%
Taylor expanded in re around 0
lower-cos.f6453.9
Simplified53.9%
Taylor expanded in im around 0
Simplified30.7%
herbie shell --seed 2024215
(FPCore (re im)
:name "math.exp on complex, real part"
:precision binary64
(* (exp re) (cos im)))