
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 18 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
(FPCore (re im) :precision binary64 (* (exp re) (sin im)))
double code(double re, double im) {
return exp(re) * sin(im);
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = exp(re) * sin(im)
end function
public static double code(double re, double im) {
return Math.exp(re) * Math.sin(im);
}
def code(re, im): return math.exp(re) * math.sin(im)
function code(re, im) return Float64(exp(re) * sin(im)) end
function tmp = code(re, im) tmp = exp(re) * sin(im); end
code[re_, im_] := N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{re} \cdot \sin im
\end{array}
Initial program 100.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) im))
(t_1 (* (exp re) (sin im)))
(t_2 (* (sin im) (fma re (fma re 0.5 1.0) 1.0))))
(if (<= t_1 (- INFINITY))
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_1 -0.05)
t_2
(if (<= t_1 2e-71) t_0 (if (<= t_1 1e+23) t_2 t_0))))))
double code(double re, double im) {
double t_0 = exp(re) * im;
double t_1 = exp(re) * sin(im);
double t_2 = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 2e-71) {
tmp = t_0;
} else if (t_1 <= 1e+23) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * im) t_1 = Float64(exp(re) * sin(im)) t_2 = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 2e-71) tmp = t_0; elseif (t_1 <= 1e+23) tmp = t_2; else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.05], t$95$2, If[LessEqual[t$95$1, 2e-71], t$95$0, If[LessEqual[t$95$1, 1e+23], t$95$2, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
t_1 := e^{re} \cdot \sin im\\
t_2 := \sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+23}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.5
Simplified87.5%
Taylor expanded in im around 0
Simplified29.3%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified28.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6421.4
Simplified21.4%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003 or 1.9999999999999998e-71 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 99.9%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6497.5
Simplified97.5%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999998e-71 or 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified95.5%
Final simplification87.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) im))
(t_1 (* (exp re) (sin im)))
(t_2 (* (sin im) (+ re 1.0))))
(if (<= t_1 (- INFINITY))
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_1 -0.05)
t_2
(if (<= t_1 2e-71) t_0 (if (<= t_1 1e+23) t_2 t_0))))))
double code(double re, double im) {
double t_0 = exp(re) * im;
double t_1 = exp(re) * sin(im);
double t_2 = sin(im) * (re + 1.0);
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_1 <= -0.05) {
tmp = t_2;
} else if (t_1 <= 2e-71) {
tmp = t_0;
} else if (t_1 <= 1e+23) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * im) t_1 = Float64(exp(re) * sin(im)) t_2 = Float64(sin(im) * Float64(re + 1.0)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_1 <= -0.05) tmp = t_2; elseif (t_1 <= 2e-71) tmp = t_0; elseif (t_1 <= 1e+23) tmp = t_2; else tmp = t_0; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, -0.05], t$95$2, If[LessEqual[t$95$1, 2e-71], t$95$0, If[LessEqual[t$95$1, 1e+23], t$95$2, t$95$0]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
t_1 := e^{re} \cdot \sin im\\
t_2 := \sin im \cdot \left(re + 1\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-71}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{+23}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.5
Simplified87.5%
Taylor expanded in im around 0
Simplified29.3%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified28.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6421.4
Simplified21.4%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003 or 1.9999999999999998e-71 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 99.9%
Taylor expanded in re around 0
+-commutativeN/A
+-lowering-+.f6497.2
Simplified97.2%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999998e-71 or 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified95.5%
Final simplification87.0%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))) (t_1 (* (exp re) im)))
(if (<= t_0 (- INFINITY))
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_0 -0.05)
(sin im)
(if (<= t_0 5e-19) t_1 (if (<= t_0 1e+23) (sin im) t_1))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double t_1 = exp(re) * im;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_0 <= -0.05) {
tmp = sin(im);
} else if (t_0 <= 5e-19) {
tmp = t_1;
} else if (t_0 <= 1e+23) {
tmp = sin(im);
} else {
tmp = t_1;
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) t_1 = Float64(exp(re) * im) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_0 <= -0.05) tmp = sin(im); elseif (t_0 <= 5e-19) tmp = t_1; elseif (t_0 <= 1e+23) tmp = sin(im); else tmp = t_1; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.05], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 5e-19], t$95$1, If[LessEqual[t$95$0, 1e+23], N[Sin[im], $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
t_1 := e^{re} \cdot im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_0 \leq -0.05:\\
\;\;\;\;\sin im\\
\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-19}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_0 \leq 10^{+23}:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.5
Simplified87.5%
Taylor expanded in im around 0
Simplified29.3%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified28.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6421.4
Simplified21.4%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003 or 5.0000000000000004e-19 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 99.9%
Taylor expanded in re around 0
sin-lowering-sin.f6494.8
Simplified94.8%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000004e-19 or 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified95.5%
(FPCore (re im)
:precision binary64
(let* ((t_0
(*
(sin im)
(fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0)))
(t_1 (* (exp re) (sin im)))
(t_2 (* (exp re) im)))
(if (<= t_1 -0.05)
t_0
(if (<= t_1 1e-100) t_2 (if (<= t_1 1e+23) t_0 t_2)))))
double code(double re, double im) {
double t_0 = sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
double t_1 = exp(re) * sin(im);
double t_2 = exp(re) * im;
double tmp;
if (t_1 <= -0.05) {
tmp = t_0;
} else if (t_1 <= 1e-100) {
tmp = t_2;
} else if (t_1 <= 1e+23) {
tmp = t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(re, im) t_0 = Float64(sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)) t_1 = Float64(exp(re) * sin(im)) t_2 = Float64(exp(re) * im) tmp = 0.0 if (t_1 <= -0.05) tmp = t_0; elseif (t_1 <= 1e-100) tmp = t_2; elseif (t_1 <= 1e+23) tmp = t_0; else tmp = t_2; end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$1, -0.05], t$95$0, If[LessEqual[t$95$1, 1e-100], t$95$2, If[LessEqual[t$95$1, 1e+23], t$95$0, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
t_1 := e^{re} \cdot \sin im\\
t_2 := e^{re} \cdot im\\
\mathbf{if}\;t\_1 \leq -0.05:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;t\_1 \leq 10^{-100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+23}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003 or 1e-100 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6494.6
Simplified94.6%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1e-100 or 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified95.4%
Final simplification95.1%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 (- INFINITY))
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_0 1e+23)
(sin im)
(*
im
(*
(* re re)
(*
re
(fma
(* im im)
(*
0.16666666666666666
(fma (* im im) 0.008333333333333333 -0.16666666666666666))
0.16666666666666666))))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_0 <= 1e+23) {
tmp = sin(im);
} else {
tmp = im * ((re * re) * (re * fma((im * im), (0.16666666666666666 * fma((im * im), 0.008333333333333333, -0.16666666666666666)), 0.16666666666666666)));
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) tmp = 0.0 if (t_0 <= Float64(-Inf)) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_0 <= 1e+23) tmp = sin(im); else tmp = Float64(im * Float64(Float64(re * re) * Float64(re * fma(Float64(im * im), Float64(0.16666666666666666 * fma(Float64(im * im), 0.008333333333333333, -0.16666666666666666)), 0.16666666666666666)))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+23], N[Sin[im], $MachinePrecision], N[(im * N[(N[(re * re), $MachinePrecision] * N[(re * N[(N[(im * im), $MachinePrecision] * N[(0.16666666666666666 * N[(N[(im * im), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_0 \leq 10^{+23}:\\
\;\;\;\;\sin im\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(\left(re \cdot re\right) \cdot \left(re \cdot \mathsf{fma}\left(im \cdot im, 0.16666666666666666 \cdot \mathsf{fma}\left(im \cdot im, 0.008333333333333333, -0.16666666666666666\right), 0.16666666666666666\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6487.5
Simplified87.5%
Taylor expanded in im around 0
Simplified29.3%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified28.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6421.4
Simplified21.4%
if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6468.1
Simplified68.1%
if 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6473.0
Simplified73.0%
Taylor expanded in im around 0
Simplified35.0%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6463.2
Simplified63.2%
Final simplification61.9%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 -0.05)
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_0 0.0)
(/ (- (* im im) (* re (* im (* re im)))) (- im (* re im)))
(*
(fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0)
(*
im
(fma
im
(* im (fma (* im im) 0.008333333333333333 -0.16666666666666666))
1.0)))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double tmp;
if (t_0 <= -0.05) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (re * (im * (re * im)))) / (im - (re * im));
} else {
tmp = fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) * (im * fma(im, (im * fma((im * im), 0.008333333333333333, -0.16666666666666666)), 1.0));
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) tmp = 0.0 if (t_0 <= -0.05) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(re * Float64(im * Float64(re * im)))) / Float64(im - Float64(re * im))); else tmp = Float64(fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0) * Float64(im * fma(im, Float64(im * fma(Float64(im * im), 0.008333333333333333, -0.16666666666666666)), 1.0))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(re * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * N[(N[(im * im), $MachinePrecision] * 0.008333333333333333 + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - re \cdot \left(im \cdot \left(re \cdot im\right)\right)}{im - re \cdot im}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right) \cdot \left(im \cdot \mathsf{fma}\left(im, im \cdot \mathsf{fma}\left(im \cdot im, 0.008333333333333333, -0.16666666666666666\right), 1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.3
Simplified92.3%
Taylor expanded in im around 0
Simplified16.7%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified16.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6412.4
Simplified12.4%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in im around 0
Simplified98.9%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6438.8
Simplified38.8%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6438.5
Simplified38.5%
+-commutativeN/A
flip-+N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6419.0
Applied egg-rr19.0%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6490.7
Simplified90.7%
Taylor expanded in im around 0
*-lowering-*.f64N/A
+-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
sub-negN/A
*-commutativeN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f6453.4
Simplified53.4%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) (sin im))))
(if (<= t_0 -0.05)
(* (fma im (* im -0.16666666666666666) 1.0) (fma re im im))
(if (<= t_0 0.0)
(/ (- (* im im) (* re (* im (* re im)))) (- im (* re im)))
(* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))))
double code(double re, double im) {
double t_0 = exp(re) * sin(im);
double tmp;
if (t_0 <= -0.05) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else if (t_0 <= 0.0) {
tmp = ((im * im) - (re * (im * (re * im)))) / (im - (re * im));
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * sin(im)) tmp = 0.0 if (t_0 <= -0.05) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); elseif (t_0 <= 0.0) tmp = Float64(Float64(Float64(im * im) - Float64(re * Float64(im * Float64(re * im)))) / Float64(im - Float64(re * im))); else tmp = Float64(im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, -0.05], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(N[(N[(im * im), $MachinePrecision] - N[(re * N[(im * N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(im - N[(re * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
\mathbf{if}\;t\_0 \leq -0.05:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{elif}\;t\_0 \leq 0:\\
\;\;\;\;\frac{im \cdot im - re \cdot \left(im \cdot \left(re \cdot im\right)\right)}{im - re \cdot im}\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.050000000000000003Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6492.3
Simplified92.3%
Taylor expanded in im around 0
Simplified16.7%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified16.0%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6412.4
Simplified12.4%
if -0.050000000000000003 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in im around 0
Simplified98.9%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6438.8
Simplified38.8%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6438.5
Simplified38.5%
+-commutativeN/A
flip-+N/A
/-lowering-/.f64N/A
--lowering--.f64N/A
*-lowering-*.f64N/A
associate-*l*N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
--lowering--.f64N/A
*-lowering-*.f6419.0
Applied egg-rr19.0%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6490.7
Simplified90.7%
Taylor expanded in im around 0
Simplified53.7%
Final simplification31.4%
(FPCore (re im)
:precision binary64
(if (<= (* (exp re) (sin im)) 0.0)
(*
im
(fma
(* im im)
(fma
(* im im)
(fma im (* im -0.0001984126984126984) 0.008333333333333333)
-0.16666666666666666)
1.0))
(* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = im * fma((im * im), fma((im * im), fma(im, (im * -0.0001984126984126984), 0.008333333333333333), -0.16666666666666666), 1.0);
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = Float64(im * fma(Float64(im * im), fma(Float64(im * im), fma(im, Float64(im * -0.0001984126984126984), 0.008333333333333333), -0.16666666666666666), 1.0)); else tmp = Float64(im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(N[(im * im), $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * N[(im * N[(im * -0.0001984126984126984), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] + -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;im \cdot \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im \cdot im, \mathsf{fma}\left(im, im \cdot -0.0001984126984126984, 0.008333333333333333\right), -0.16666666666666666\right), 1\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6441.6
Simplified41.6%
Taylor expanded in im around 0
*-lowering-*.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
sub-negN/A
metadata-evalN/A
accelerator-lowering-fma.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6427.8
Simplified27.8%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6490.7
Simplified90.7%
Taylor expanded in im around 0
Simplified53.7%
Final simplification38.2%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 5e-305) (* (fma im (* im -0.16666666666666666) 1.0) (fma re im im)) (* im (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 5e-305) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else {
tmp = im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 5e-305) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); else tmp = Float64(im * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 5e-305], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-305}:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 4.99999999999999985e-305Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6460.3
Simplified60.3%
Taylor expanded in im around 0
Simplified30.8%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified30.6%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6429.2
Simplified29.2%
if 4.99999999999999985e-305 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6490.5
Simplified90.5%
Taylor expanded in im around 0
Simplified52.8%
Final simplification38.5%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 2e-7) (* (fma im (* im -0.16666666666666666) 1.0) (fma re im im)) (* im (* (fma re 0.16666666666666666 0.5) (* re re)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 2e-7) {
tmp = fma(im, (im * -0.16666666666666666), 1.0) * fma(re, im, im);
} else {
tmp = im * (fma(re, 0.16666666666666666, 0.5) * (re * re));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 2e-7) tmp = Float64(fma(im, Float64(im * -0.16666666666666666), 1.0) * fma(re, im, im)); else tmp = Float64(im * Float64(fma(re, 0.16666666666666666, 0.5) * Float64(re * re))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision] * N[(re * im + im), $MachinePrecision]), $MachinePrecision], N[(im * N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 2 \cdot 10^{-7}:\\
\;\;\;\;\mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im, im\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-7Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6467.1
Simplified67.1%
Taylor expanded in im around 0
Simplified42.7%
Taylor expanded in re around 0
+-commutativeN/A
associate-*r*N/A
distribute-rgt-outN/A
*-lowering-*.f64N/A
Simplified42.3%
Taylor expanded in im around 0
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-commutativeN/A
*-lowering-*.f6441.2
Simplified41.2%
if 1.9999999999999999e-7 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 99.9%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6486.1
Simplified86.1%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6436.4
Simplified36.4%
Taylor expanded in im around 0
Simplified31.4%
Final simplification38.5%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 2e-7) (* im (fma im (* im -0.16666666666666666) 1.0)) (* im (* (fma re 0.16666666666666666 0.5) (* re re)))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 2e-7) {
tmp = im * fma(im, (im * -0.16666666666666666), 1.0);
} else {
tmp = im * (fma(re, 0.16666666666666666, 0.5) * (re * re));
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 2e-7) tmp = Float64(im * fma(im, Float64(im * -0.16666666666666666), 1.0)); else tmp = Float64(im * Float64(fma(re, 0.16666666666666666, 0.5) * Float64(re * re))); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 2e-7], N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(im * N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 2 \cdot 10^{-7}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right) \cdot \left(re \cdot re\right)\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-7Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6451.9
Simplified51.9%
Taylor expanded in im around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6440.1
Simplified40.1%
if 1.9999999999999999e-7 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 99.9%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6486.1
Simplified86.1%
Taylor expanded in re around inf
unpow3N/A
unpow2N/A
associate-*l*N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*l*N/A
lft-mult-inverseN/A
metadata-evalN/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6436.4
Simplified36.4%
Taylor expanded in im around 0
Simplified31.4%
Final simplification37.7%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (* im (fma im (* im -0.16666666666666666) 1.0)) (* im (fma re (fma re 0.5 1.0) 1.0))))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = im * fma(im, (im * -0.16666666666666666), 1.0);
} else {
tmp = im * fma(re, fma(re, 0.5, 1.0), 1.0);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = Float64(im * fma(im, Float64(im * -0.16666666666666666), 1.0)); else tmp = Float64(im * fma(re, fma(re, 0.5, 1.0), 1.0)); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(im * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;im \cdot \mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6441.6
Simplified41.6%
Taylor expanded in im around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6427.1
Simplified27.1%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6484.2
Simplified84.2%
Taylor expanded in im around 0
Simplified51.8%
Final simplification37.1%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 0.0) (* im (fma im (* im -0.16666666666666666) 1.0)) (fma im re im)))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 0.0) {
tmp = im * fma(im, (im * -0.16666666666666666), 1.0);
} else {
tmp = fma(im, re, im);
}
return tmp;
}
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 0.0) tmp = Float64(im * fma(im, Float64(im * -0.16666666666666666), 1.0)); else tmp = fma(im, re, im); end return tmp end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0], N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], N[(im * re + im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\
\;\;\;\;im \cdot \mathsf{fma}\left(im, im \cdot -0.16666666666666666, 1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(im, re, im\right)\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6441.6
Simplified41.6%
Taylor expanded in im around 0
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
unpow2N/A
associate-*l*N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6427.1
Simplified27.1%
if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified59.3%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f6442.3
Simplified42.3%
(FPCore (re im) :precision binary64 (if (<= (* (exp re) (sin im)) 1e+23) im (* re im)))
double code(double re, double im) {
double tmp;
if ((exp(re) * sin(im)) <= 1e+23) {
tmp = im;
} else {
tmp = re * im;
}
return tmp;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
real(8) :: tmp
if ((exp(re) * sin(im)) <= 1d+23) then
tmp = im
else
tmp = re * im
end if
code = tmp
end function
public static double code(double re, double im) {
double tmp;
if ((Math.exp(re) * Math.sin(im)) <= 1e+23) {
tmp = im;
} else {
tmp = re * im;
}
return tmp;
}
def code(re, im): tmp = 0 if (math.exp(re) * math.sin(im)) <= 1e+23: tmp = im else: tmp = re * im return tmp
function code(re, im) tmp = 0.0 if (Float64(exp(re) * sin(im)) <= 1e+23) tmp = im; else tmp = Float64(re * im); end return tmp end
function tmp_2 = code(re, im) tmp = 0.0; if ((exp(re) * sin(im)) <= 1e+23) tmp = im; else tmp = re * im; end tmp_2 = tmp; end
code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 1e+23], im, N[(re * im), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;e^{re} \cdot \sin im \leq 10^{+23}:\\
\;\;\;\;im\\
\mathbf{else}:\\
\;\;\;\;re \cdot im\\
\end{array}
\end{array}
if (*.f64 (exp.f64 re) (sin.f64 im)) < 9.9999999999999992e22Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6459.1
Simplified59.1%
Taylor expanded in im around 0
Simplified32.2%
if 9.9999999999999992e22 < (*.f64 (exp.f64 re) (sin.f64 im)) Initial program 100.0%
Taylor expanded in im around 0
Simplified81.3%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
distribute-rgt-inN/A
associate-*r*N/A
+-commutativeN/A
*-commutativeN/A
*-commutativeN/A
associate-*l*N/A
distribute-lft-outN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6454.3
Simplified54.3%
Taylor expanded in re around 0
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6427.2
Simplified27.2%
Taylor expanded in re around inf
*-lowering-*.f6427.2
Simplified27.2%
Final simplification31.5%
(FPCore (re im)
:precision binary64
(let* ((t_0 (* (exp re) im)))
(if (<= re -9.5e-6)
t_0
(if (<= re 3300000.0)
(* (sin im) (fma re (fma re 0.5 1.0) 1.0))
(if (<= re 5.6e+102)
t_0
(* (sin im) (* 0.16666666666666666 (* re (* re re)))))))))
double code(double re, double im) {
double t_0 = exp(re) * im;
double tmp;
if (re <= -9.5e-6) {
tmp = t_0;
} else if (re <= 3300000.0) {
tmp = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
} else if (re <= 5.6e+102) {
tmp = t_0;
} else {
tmp = sin(im) * (0.16666666666666666 * (re * (re * re)));
}
return tmp;
}
function code(re, im) t_0 = Float64(exp(re) * im) tmp = 0.0 if (re <= -9.5e-6) tmp = t_0; elseif (re <= 3300000.0) tmp = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0)); elseif (re <= 5.6e+102) tmp = t_0; else tmp = Float64(sin(im) * Float64(0.16666666666666666 * Float64(re * Float64(re * re)))); end return tmp end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[re, -9.5e-6], t$95$0, If[LessEqual[re, 3300000.0], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 5.6e+102], t$95$0, N[(N[Sin[im], $MachinePrecision] * N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{re} \cdot im\\
\mathbf{if}\;re \leq -9.5 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;re \leq 3300000:\\
\;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
\mathbf{elif}\;re \leq 5.6 \cdot 10^{+102}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\sin im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
\end{array}
\end{array}
if re < -9.5000000000000005e-6 or 3.3e6 < re < 5.60000000000000037e102Initial program 100.0%
Taylor expanded in im around 0
Simplified97.3%
if -9.5000000000000005e-6 < re < 3.3e6Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f6498.0
Simplified98.0%
if 5.60000000000000037e102 < re Initial program 100.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
accelerator-lowering-fma.f64100.0
Simplified100.0%
Taylor expanded in re around inf
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f64100.0
Simplified100.0%
Final simplification98.2%
(FPCore (re im) :precision binary64 (fma im re im))
double code(double re, double im) {
return fma(im, re, im);
}
function code(re, im) return fma(im, re, im) end
code[re_, im_] := N[(im * re + im), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(im, re, im\right)
\end{array}
Initial program 100.0%
Taylor expanded in im around 0
Simplified70.0%
Taylor expanded in re around 0
+-commutativeN/A
accelerator-lowering-fma.f6433.4
Simplified33.4%
(FPCore (re im) :precision binary64 im)
double code(double re, double im) {
return im;
}
real(8) function code(re, im)
real(8), intent (in) :: re
real(8), intent (in) :: im
code = im
end function
public static double code(double re, double im) {
return im;
}
def code(re, im): return im
function code(re, im) return im end
function tmp = code(re, im) tmp = im; end
code[re_, im_] := im
\begin{array}{l}
\\
im
\end{array}
Initial program 100.0%
Taylor expanded in re around 0
sin-lowering-sin.f6452.0
Simplified52.0%
Taylor expanded in im around 0
Simplified28.5%
herbie shell --seed 2024198
(FPCore (re im)
:name "math.exp on complex, imaginary part"
:precision binary64
(* (exp re) (sin im)))