math.exp on complex, imaginary part

Percentage Accurate: 100.0% → 100.0%
Time: 16.5s
Alternatives: 22
Speedup: 1.0×

Specification

?
\[\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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 22 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 100.0% accurate, 1.0× speedup?

\[\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}

Alternative 1: 100.0% accurate, 1.0× speedup?

\[\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}
Derivation
  1. Initial program 100.0%

    \[e^{re} \cdot \sin im \]
  2. Add Preprocessing
  3. Add Preprocessing

Alternative 2: 89.9% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\\ t_1 := e^{re} \cdot im\\ t_2 := \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ t_3 := \sin im \cdot t\_2\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;t\_2 \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq -0.01:\\ \;\;\;\;t\_3\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-106}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;t\_3\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (exp re) (sin im)))
        (t_1 (* (exp re) im))
        (t_2 (fma re (fma re 0.5 1.0) 1.0))
        (t_3 (* (sin im) t_2)))
   (if (<= t_0 (- INFINITY))
     (* t_2 (fma im (* im (* im -0.16666666666666666)) im))
     (if (<= t_0 -0.01)
       t_3
       (if (<= t_0 5e-106) t_1 (if (<= t_0 1.0) t_3 t_1))))))
double code(double re, double im) {
	double t_0 = exp(re) * sin(im);
	double t_1 = exp(re) * im;
	double t_2 = fma(re, fma(re, 0.5, 1.0), 1.0);
	double t_3 = sin(im) * t_2;
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = t_2 * fma(im, (im * (im * -0.16666666666666666)), im);
	} else if (t_0 <= -0.01) {
		tmp = t_3;
	} else if (t_0 <= 5e-106) {
		tmp = t_1;
	} else if (t_0 <= 1.0) {
		tmp = t_3;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(exp(re) * sin(im))
	t_1 = Float64(exp(re) * im)
	t_2 = fma(re, fma(re, 0.5, 1.0), 1.0)
	t_3 = Float64(sin(im) * t_2)
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(t_2 * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
	elseif (t_0 <= -0.01)
		tmp = t_3;
	elseif (t_0 <= 5e-106)
		tmp = t_1;
	elseif (t_0 <= 1.0)
		tmp = t_3;
	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]}, Block[{t$95$2 = N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[im], $MachinePrecision] * t$95$2), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(t$95$2 * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.01], t$95$3, If[LessEqual[t$95$0, 5e-106], t$95$1, If[LessEqual[t$95$0, 1.0], t$95$3, t$95$1]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{re} \cdot \sin im\\
t_1 := e^{re} \cdot im\\
t_2 := \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
t_3 := \sin im \cdot t\_2\\
\mathbf{if}\;t\_0 \leq -\infty:\\
\;\;\;\;t\_2 \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\

\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;t\_3\\

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-106}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;t\_3\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
      5. lower-fma.f6453.8

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
    5. Applied rewrites53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
      3. *-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
      10. lower-*.f6456.0

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
    8. Applied rewrites56.0%

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

    if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002 or 4.99999999999999983e-106 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
      5. lower-fma.f6498.7

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
    5. Applied rewrites98.7%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]

    if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 4.99999999999999983e-106 or 1 < (*.f64 (exp.f64 re) (sin.f64 im))

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{im \cdot e^{re}} \]
      2. lower-exp.f6496.1

        \[\leadsto im \cdot \color{blue}{e^{re}} \]
    5. Applied rewrites96.1%

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq -0.01:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 5 \cdot 10^{-106}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 1:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 89.7% accurate, 0.2× speedup?

\[\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(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq -0.01:\\ \;\;\;\;\sin im \cdot \left(re + 1\right)\\ \mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (exp re) (sin im))) (t_1 (* (exp re) im)))
   (if (<= t_0 (- INFINITY))
     (*
      (fma re (fma re 0.5 1.0) 1.0)
      (fma im (* im (* im -0.16666666666666666)) im))
     (if (<= t_0 -0.01)
       (* (sin im) (+ re 1.0))
       (if (<= t_0 1.4e-61) t_1 (if (<= t_0 1.0) (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(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
	} else if (t_0 <= -0.01) {
		tmp = sin(im) * (re + 1.0);
	} else if (t_0 <= 1.4e-61) {
		tmp = t_1;
	} else if (t_0 <= 1.0) {
		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(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
	elseif (t_0 <= -0.01)
		tmp = Float64(sin(im) * Float64(re + 1.0));
	elseif (t_0 <= 1.4e-61)
		tmp = t_1;
	elseif (t_0 <= 1.0)
		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[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[(N[Sin[im], $MachinePrecision] * N[(re + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.4e-61], t$95$1, If[LessEqual[t$95$0, 1.0], 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(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\

\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\sin im \cdot \left(re + 1\right)\\

\mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
      5. lower-fma.f6453.8

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
    5. Applied rewrites53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
      3. *-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
      10. lower-*.f6456.0

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
    8. Applied rewrites56.0%

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

    if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]
      2. lower-+.f64100.0

        \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]
    5. Applied rewrites100.0%

      \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]

    if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.4000000000000001e-61 or 1 < (*.f64 (exp.f64 re) (sin.f64 im))

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{im \cdot e^{re}} \]
      2. lower-exp.f6495.7

        \[\leadsto im \cdot \color{blue}{e^{re}} \]
    5. Applied rewrites95.7%

      \[\leadsto \color{blue}{im \cdot e^{re}} \]

    if 1.4000000000000001e-61 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\sin im} \]
    4. Step-by-step derivation
      1. lower-sin.f6499.8

        \[\leadsto \color{blue}{\sin im} \]
    5. Applied rewrites99.8%

      \[\leadsto \color{blue}{\sin im} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification92.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq -0.01:\\ \;\;\;\;\sin im \cdot \left(re + 1\right)\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 1.4 \cdot 10^{-61}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 89.6% accurate, 0.2× speedup?

\[\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(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq -0.01:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (exp re) (sin im))) (t_1 (* (exp re) im)))
   (if (<= t_0 (- INFINITY))
     (*
      (fma re (fma re 0.5 1.0) 1.0)
      (fma im (* im (* im -0.16666666666666666)) im))
     (if (<= t_0 -0.01)
       (sin im)
       (if (<= t_0 1.4e-61) t_1 (if (<= t_0 1.0) (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(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
	} else if (t_0 <= -0.01) {
		tmp = sin(im);
	} else if (t_0 <= 1.4e-61) {
		tmp = t_1;
	} else if (t_0 <= 1.0) {
		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(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
	elseif (t_0 <= -0.01)
		tmp = sin(im);
	elseif (t_0 <= 1.4e-61)
		tmp = t_1;
	elseif (t_0 <= 1.0)
		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[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 1.4e-61], t$95$1, If[LessEqual[t$95$0, 1.0], 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(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\

\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
      5. lower-fma.f6453.8

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
    5. Applied rewrites53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
      3. *-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
      10. lower-*.f6456.0

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
    8. Applied rewrites56.0%

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

    if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002 or 1.4000000000000001e-61 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\sin im} \]
    4. Step-by-step derivation
      1. lower-sin.f6499.5

        \[\leadsto \color{blue}{\sin im} \]
    5. Applied rewrites99.5%

      \[\leadsto \color{blue}{\sin im} \]

    if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.4000000000000001e-61 or 1 < (*.f64 (exp.f64 re) (sin.f64 im))

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{im \cdot e^{re}} \]
      2. lower-exp.f6495.7

        \[\leadsto im \cdot \color{blue}{e^{re}} \]
    5. Applied rewrites95.7%

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification92.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq -0.01:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 1.4 \cdot 10^{-61}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;e^{re} \cdot \sin im \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 81.0% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq -0.01:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \mathsf{fma}\left(re, 0.5, -1\right), \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{im}\right)}\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (exp re) (sin im))))
   (if (<= t_0 (- INFINITY))
     (*
      (fma re (fma re 0.5 1.0) 1.0)
      (fma im (* im (* im -0.16666666666666666)) im))
     (if (<= t_0 -0.01)
       (sin im)
       (if (<= t_0 1.4e-61)
         (/
          1.0
          (fma
           re
           (fma (/ 1.0 im) (fma re 0.5 -1.0) (/ (* re (* (* re re) -0.25)) im))
           (/ 1.0 im)))
         (if (<= t_0 1.0)
           (sin im)
           (* im (* 0.16666666666666666 (* re (* re re))))))))))
double code(double re, double im) {
	double t_0 = exp(re) * sin(im);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
	} else if (t_0 <= -0.01) {
		tmp = sin(im);
	} else if (t_0 <= 1.4e-61) {
		tmp = 1.0 / fma(re, fma((1.0 / im), fma(re, 0.5, -1.0), ((re * ((re * re) * -0.25)) / im)), (1.0 / im));
	} else if (t_0 <= 1.0) {
		tmp = sin(im);
	} else {
		tmp = im * (0.16666666666666666 * (re * (re * re)));
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(exp(re) * sin(im))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
	elseif (t_0 <= -0.01)
		tmp = sin(im);
	elseif (t_0 <= 1.4e-61)
		tmp = Float64(1.0 / fma(re, fma(Float64(1.0 / im), fma(re, 0.5, -1.0), Float64(Float64(re * Float64(Float64(re * re) * -0.25)) / im)), Float64(1.0 / im)));
	elseif (t_0 <= 1.0)
		tmp = sin(im);
	else
		tmp = Float64(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] * N[Sin[im], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, -0.01], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 1.4e-61], N[(1.0 / N[(re * N[(N[(1.0 / im), $MachinePrecision] * N[(re * 0.5 + -1.0), $MachinePrecision] + N[(N[(re * N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] / im), $MachinePrecision]), $MachinePrecision] + N[(1.0 / im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[im], $MachinePrecision], N[(im * N[(0.16666666666666666 * N[(re * N[(re * re), $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(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\

\mathbf{elif}\;t\_0 \leq -0.01:\\
\;\;\;\;\sin im\\

\mathbf{elif}\;t\_0 \leq 1.4 \cdot 10^{-61}:\\
\;\;\;\;\frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \mathsf{fma}\left(re, 0.5, -1\right), \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{im}\right)}\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin im\\

\mathbf{else}:\\
\;\;\;\;im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -inf.0

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
      5. lower-fma.f6453.8

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
    5. Applied rewrites53.8%

      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
    6. Taylor expanded in im around 0

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
    7. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
      2. distribute-lft-inN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
      3. *-rgt-identityN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
      4. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
      5. unpow2N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
      6. associate-*r*N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      8. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
      10. lower-*.f6456.0

        \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
    8. Applied rewrites56.0%

      \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

    if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002 or 1.4000000000000001e-61 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in re around 0

      \[\leadsto \color{blue}{\sin im} \]
    4. Step-by-step derivation
      1. lower-sin.f6499.5

        \[\leadsto \color{blue}{\sin im} \]
    5. Applied rewrites99.5%

      \[\leadsto \color{blue}{\sin im} \]

    if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.4000000000000001e-61

    1. Initial program 100.0%

      \[e^{re} \cdot \sin im \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto \color{blue}{im \cdot e^{re}} \]
      2. lower-exp.f6499.3

        \[\leadsto im \cdot \color{blue}{e^{re}} \]
    5. Applied rewrites99.3%

      \[\leadsto \color{blue}{im \cdot e^{re}} \]
    6. Taylor expanded in re around 0

      \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
    7. Step-by-step derivation
      1. Applied rewrites50.2%

        \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
      2. Step-by-step derivation
        1. Applied rewrites50.1%

          \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(re, im \cdot \mathsf{fma}\left(re, 0.5, 1\right), im\right)}}} \]
        2. Taylor expanded in re around 0

          \[\leadsto \frac{1}{re \cdot \left(re \cdot \left(\frac{-1}{4} \cdot \frac{{re}^{2}}{im} + \frac{1}{2} \cdot \frac{1}{im}\right) - \frac{1}{im}\right) + \frac{1}{\color{blue}{im}}} \]
        3. Step-by-step derivation
          1. Applied rewrites87.0%

            \[\leadsto \frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \color{blue}{\mathsf{fma}\left(re, 0.5, -1\right)}, \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{im}\right)} \]

          if 1 < (*.f64 (exp.f64 re) (sin.f64 im))

          1. Initial program 100.0%

            \[e^{re} \cdot \sin im \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

            \[\leadsto \color{blue}{im \cdot e^{re}} \]
          4. Step-by-step derivation
            1. lower-*.f64N/A

              \[\leadsto \color{blue}{im \cdot e^{re}} \]
            2. lower-exp.f6479.3

              \[\leadsto im \cdot \color{blue}{e^{re}} \]
          5. Applied rewrites79.3%

            \[\leadsto \color{blue}{im \cdot e^{re}} \]
          6. Taylor expanded in re around 0

            \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
          7. Step-by-step derivation
            1. Applied rewrites56.1%

              \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
            2. Taylor expanded in re around inf

              \[\leadsto im \cdot \left({re}^{3} \cdot \left(\frac{1}{6} + \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)}\right)\right) \]
            3. Step-by-step derivation
              1. Applied rewrites56.1%

                \[\leadsto im \cdot \mathsf{fma}\left(re \cdot re, \mathsf{fma}\left(re, \color{blue}{0.16666666666666666}, 0.5\right), re\right) \]
              2. Taylor expanded in re around inf

                \[\leadsto im \cdot \left(\frac{1}{6} \cdot {re}^{\color{blue}{3}}\right) \]
              3. Step-by-step derivation
                1. Applied rewrites56.1%

                  \[\leadsto im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
              4. Recombined 4 regimes into one program.
              5. Add Preprocessing

              Alternative 6: 58.1% accurate, 0.4× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\\ \mathbf{if}\;t\_0 \leq -0.01:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \mathsf{fma}\left(re, 0.5, -1\right), \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{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} \]
              (FPCore (re im)
               :precision binary64
               (let* ((t_0 (* (exp re) (sin im))))
                 (if (<= t_0 -0.01)
                   (*
                    (fma re (fma re 0.5 1.0) 1.0)
                    (fma im (* im (* im -0.16666666666666666)) im))
                   (if (<= t_0 0.0)
                     (/
                      1.0
                      (fma
                       re
                       (fma (/ 1.0 im) (fma re 0.5 -1.0) (/ (* re (* (* re re) -0.25)) im))
                       (/ 1.0 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.01) {
              		tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
              	} else if (t_0 <= 0.0) {
              		tmp = 1.0 / fma(re, fma((1.0 / im), fma(re, 0.5, -1.0), ((re * ((re * re) * -0.25)) / im)), (1.0 / 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.01)
              		tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
              	elseif (t_0 <= 0.0)
              		tmp = Float64(1.0 / fma(re, fma(Float64(1.0 / im), fma(re, 0.5, -1.0), Float64(Float64(re * Float64(Float64(re * re) * -0.25)) / im)), Float64(1.0 / 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.01], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(1.0 / N[(re * N[(N[(1.0 / im), $MachinePrecision] * N[(re * 0.5 + -1.0), $MachinePrecision] + N[(N[(re * N[(N[(re * re), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision] / im), $MachinePrecision]), $MachinePrecision] + N[(1.0 / 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.01:\\
              \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\
              
              \mathbf{elif}\;t\_0 \leq 0:\\
              \;\;\;\;\frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \mathsf{fma}\left(re, 0.5, -1\right), \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{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}
              
              Derivation
              1. Split input into 3 regimes
              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002

                1. Initial program 100.0%

                  \[e^{re} \cdot \sin im \]
                2. Add Preprocessing
                3. Taylor expanded in re around 0

                  \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
                4. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
                  2. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
                  3. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
                  4. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
                  5. lower-fma.f6480.3

                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
                5. Applied rewrites80.3%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
                6. Taylor expanded in im around 0

                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                7. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                  2. distribute-lft-inN/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                  3. *-rgt-identityN/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                  4. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                  5. unpow2N/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                  6. associate-*r*N/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
                  7. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                  8. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                  9. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
                  10. lower-*.f6425.3

                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
                8. Applied rewrites25.3%

                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

                if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                1. Initial program 100.0%

                  \[e^{re} \cdot \sin im \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                4. Step-by-step derivation
                  1. lower-*.f64N/A

                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                  2. lower-exp.f64100.0

                    \[\leadsto im \cdot \color{blue}{e^{re}} \]
                5. Applied rewrites100.0%

                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                6. Taylor expanded in re around 0

                  \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
                7. Step-by-step derivation
                  1. Applied rewrites34.1%

                    \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
                  2. Step-by-step derivation
                    1. Applied rewrites34.1%

                      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(re, im \cdot \mathsf{fma}\left(re, 0.5, 1\right), im\right)}}} \]
                    2. Taylor expanded in re around 0

                      \[\leadsto \frac{1}{re \cdot \left(re \cdot \left(\frac{-1}{4} \cdot \frac{{re}^{2}}{im} + \frac{1}{2} \cdot \frac{1}{im}\right) - \frac{1}{im}\right) + \frac{1}{\color{blue}{im}}} \]
                    3. Step-by-step derivation
                      1. Applied rewrites83.7%

                        \[\leadsto \frac{1}{\mathsf{fma}\left(re, \mathsf{fma}\left(\frac{1}{im}, \color{blue}{\mathsf{fma}\left(re, 0.5, -1\right)}, \frac{re \cdot \left(\left(re \cdot re\right) \cdot -0.25\right)}{im}\right), \frac{1}{im}\right)} \]

                      if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                      1. Initial program 100.0%

                        \[e^{re} \cdot \sin im \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                      4. Step-by-step derivation
                        1. lower-*.f64N/A

                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                        2. lower-exp.f6470.1

                          \[\leadsto im \cdot \color{blue}{e^{re}} \]
                      5. Applied rewrites70.1%

                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                      6. Taylor expanded in re around 0

                        \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                      7. Step-by-step derivation
                        1. Applied rewrites62.4%

                          \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                      8. Recombined 3 regimes into one program.
                      9. Add Preprocessing

                      Alternative 7: 51.6% accurate, 0.4× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\\ \mathbf{if}\;t\_0 \leq -0.01:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{\mathsf{fma}\left(re, \frac{1}{im} \cdot \mathsf{fma}\left(re, 0.5, -1\right), \frac{1}{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} \]
                      (FPCore (re im)
                       :precision binary64
                       (let* ((t_0 (* (exp re) (sin im))))
                         (if (<= t_0 -0.01)
                           (*
                            (fma re (fma re 0.5 1.0) 1.0)
                            (fma im (* im (* im -0.16666666666666666)) im))
                           (if (<= t_0 0.0)
                             (/ 1.0 (fma re (* (/ 1.0 im) (fma re 0.5 -1.0)) (/ 1.0 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.01) {
                      		tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
                      	} else if (t_0 <= 0.0) {
                      		tmp = 1.0 / fma(re, ((1.0 / im) * fma(re, 0.5, -1.0)), (1.0 / 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.01)
                      		tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
                      	elseif (t_0 <= 0.0)
                      		tmp = Float64(1.0 / fma(re, Float64(Float64(1.0 / im) * fma(re, 0.5, -1.0)), Float64(1.0 / 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.01], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(1.0 / N[(re * N[(N[(1.0 / im), $MachinePrecision] * N[(re * 0.5 + -1.0), $MachinePrecision]), $MachinePrecision] + N[(1.0 / 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.01:\\
                      \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\
                      
                      \mathbf{elif}\;t\_0 \leq 0:\\
                      \;\;\;\;\frac{1}{\mathsf{fma}\left(re, \frac{1}{im} \cdot \mathsf{fma}\left(re, 0.5, -1\right), \frac{1}{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}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002

                        1. Initial program 100.0%

                          \[e^{re} \cdot \sin im \]
                        2. Add Preprocessing
                        3. Taylor expanded in re around 0

                          \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
                        4. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
                          2. lower-fma.f64N/A

                            \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
                          3. +-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
                          4. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
                          5. lower-fma.f6480.3

                            \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
                        5. Applied rewrites80.3%

                          \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
                        6. Taylor expanded in im around 0

                          \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                        7. Step-by-step derivation
                          1. +-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                          2. distribute-lft-inN/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                          3. *-rgt-identityN/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                          4. lower-fma.f64N/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                          5. unpow2N/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                          6. associate-*r*N/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
                          7. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                          8. lower-*.f64N/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                          9. *-commutativeN/A

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
                          10. lower-*.f6425.3

                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
                        8. Applied rewrites25.3%

                          \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

                        if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                        1. Initial program 100.0%

                          \[e^{re} \cdot \sin im \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                        4. Step-by-step derivation
                          1. lower-*.f64N/A

                            \[\leadsto \color{blue}{im \cdot e^{re}} \]
                          2. lower-exp.f64100.0

                            \[\leadsto im \cdot \color{blue}{e^{re}} \]
                        5. Applied rewrites100.0%

                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                        6. Taylor expanded in re around 0

                          \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
                        7. Step-by-step derivation
                          1. Applied rewrites34.1%

                            \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
                          2. Step-by-step derivation
                            1. Applied rewrites34.1%

                              \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(re, im \cdot \mathsf{fma}\left(re, 0.5, 1\right), im\right)}}} \]
                            2. Taylor expanded in re around 0

                              \[\leadsto \frac{1}{re \cdot \left(\frac{1}{2} \cdot \frac{re}{im} - \frac{1}{im}\right) + \frac{1}{\color{blue}{im}}} \]
                            3. Step-by-step derivation
                              1. Applied rewrites65.6%

                                \[\leadsto \frac{1}{\mathsf{fma}\left(re, \frac{1}{im} \cdot \color{blue}{\mathsf{fma}\left(re, 0.5, -1\right)}, \frac{1}{im}\right)} \]

                              if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                              1. Initial program 100.0%

                                \[e^{re} \cdot \sin im \]
                              2. Add Preprocessing
                              3. Taylor expanded in im around 0

                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                              4. Step-by-step derivation
                                1. lower-*.f64N/A

                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                2. lower-exp.f6470.1

                                  \[\leadsto im \cdot \color{blue}{e^{re}} \]
                              5. Applied rewrites70.1%

                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                              6. Taylor expanded in re around 0

                                \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                              7. Step-by-step derivation
                                1. Applied rewrites62.4%

                                  \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                              8. Recombined 3 regimes into one program.
                              9. Add Preprocessing

                              Alternative 8: 45.7% accurate, 0.4× speedup?

                              \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\\ \mathbf{if}\;t\_0 \leq -0.01:\\ \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\frac{1}{\frac{1}{im} - \frac{re}{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} \]
                              (FPCore (re im)
                               :precision binary64
                               (let* ((t_0 (* (exp re) (sin im))))
                                 (if (<= t_0 -0.01)
                                   (*
                                    (fma re (fma re 0.5 1.0) 1.0)
                                    (fma im (* im (* im -0.16666666666666666)) im))
                                   (if (<= t_0 0.0)
                                     (/ 1.0 (- (/ 1.0 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.01) {
                              		tmp = fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, (im * (im * -0.16666666666666666)), im);
                              	} else if (t_0 <= 0.0) {
                              		tmp = 1.0 / ((1.0 / 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.01)
                              		tmp = Float64(fma(re, fma(re, 0.5, 1.0), 1.0) * fma(im, Float64(im * Float64(im * -0.16666666666666666)), im));
                              	elseif (t_0 <= 0.0)
                              		tmp = Float64(1.0 / Float64(Float64(1.0 / 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.01], N[(N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision] * N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[(1.0 / N[(N[(1.0 / im), $MachinePrecision] - 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.01:\\
                              \;\;\;\;\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)\\
                              
                              \mathbf{elif}\;t\_0 \leq 0:\\
                              \;\;\;\;\frac{1}{\frac{1}{im} - \frac{re}{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}
                              
                              Derivation
                              1. Split input into 3 regimes
                              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0100000000000000002

                                1. Initial program 100.0%

                                  \[e^{re} \cdot \sin im \]
                                2. Add Preprocessing
                                3. Taylor expanded in re around 0

                                  \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
                                4. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
                                  2. lower-fma.f64N/A

                                    \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
                                  3. +-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
                                  4. *-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
                                  5. lower-fma.f6480.3

                                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
                                5. Applied rewrites80.3%

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]
                                6. Taylor expanded in im around 0

                                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                                7. Step-by-step derivation
                                  1. +-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                                  2. distribute-lft-inN/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                                  3. *-rgt-identityN/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                                  4. lower-fma.f64N/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                                  5. unpow2N/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                  6. associate-*r*N/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
                                  7. *-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                                  8. lower-*.f64N/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                                  9. *-commutativeN/A

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \frac{1}{2}, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
                                  10. lower-*.f6425.3

                                    \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
                                8. Applied rewrites25.3%

                                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

                                if -0.0100000000000000002 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                                1. Initial program 100.0%

                                  \[e^{re} \cdot \sin im \]
                                2. Add Preprocessing
                                3. Taylor expanded in im around 0

                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                4. Step-by-step derivation
                                  1. lower-*.f64N/A

                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                  2. lower-exp.f64100.0

                                    \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                5. Applied rewrites100.0%

                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                6. Taylor expanded in re around 0

                                  \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
                                7. Step-by-step derivation
                                  1. Applied rewrites34.1%

                                    \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
                                  2. Step-by-step derivation
                                    1. Applied rewrites34.1%

                                      \[\leadsto \frac{1}{\frac{1}{\color{blue}{\mathsf{fma}\left(re, im \cdot \mathsf{fma}\left(re, 0.5, 1\right), im\right)}}} \]
                                    2. Taylor expanded in re around 0

                                      \[\leadsto \frac{1}{-1 \cdot \frac{re}{im} + \frac{1}{\color{blue}{im}}} \]
                                    3. Step-by-step derivation
                                      1. Applied rewrites53.7%

                                        \[\leadsto \frac{1}{\frac{1}{im} - \frac{re}{\color{blue}{im}}} \]

                                      if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                                      1. Initial program 100.0%

                                        \[e^{re} \cdot \sin im \]
                                      2. Add Preprocessing
                                      3. Taylor expanded in im around 0

                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                      4. Step-by-step derivation
                                        1. lower-*.f64N/A

                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                        2. lower-exp.f6470.1

                                          \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                      5. Applied rewrites70.1%

                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                      6. Taylor expanded in re around 0

                                        \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                                      7. Step-by-step derivation
                                        1. Applied rewrites62.4%

                                          \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                                      8. Recombined 3 regimes into one program.
                                      9. Add Preprocessing

                                      Alternative 9: 36.3% accurate, 0.9× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\ \;\;\;\;\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right) \cdot \left(re + 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} \]
                                      (FPCore (re im)
                                       :precision binary64
                                       (if (<= (* (exp re) (sin im)) 0.0)
                                         (* (fma im (* im (* im -0.16666666666666666)) im) (+ re 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 = fma(im, (im * (im * -0.16666666666666666)), im) * (re + 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(fma(im, Float64(im * Float64(im * -0.16666666666666666)), im) * Float64(re + 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[(N[(im * N[(im * N[(im * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision] * N[(re + 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:\\
                                      \;\;\;\;\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right) \cdot \left(re + 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}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                                        1. Initial program 100.0%

                                          \[e^{re} \cdot \sin im \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in re around 0

                                          \[\leadsto \color{blue}{\left(1 + re\right)} \cdot \sin im \]
                                        4. Step-by-step derivation
                                          1. +-commutativeN/A

                                            \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]
                                          2. lower-+.f6444.7

                                            \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]
                                        5. Applied rewrites44.7%

                                          \[\leadsto \color{blue}{\left(re + 1\right)} \cdot \sin im \]
                                        6. Taylor expanded in im around 0

                                          \[\leadsto \left(re + 1\right) \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                                        7. Step-by-step derivation
                                          1. +-commutativeN/A

                                            \[\leadsto \left(re + 1\right) \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                                          2. distribute-lft-inN/A

                                            \[\leadsto \left(re + 1\right) \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                                          3. *-rgt-identityN/A

                                            \[\leadsto \left(re + 1\right) \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                                          4. lower-fma.f64N/A

                                            \[\leadsto \left(re + 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                                          5. unpow2N/A

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                          6. associate-*r*N/A

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{\left(\frac{-1}{6} \cdot im\right) \cdot im}, im\right) \]
                                          7. *-commutativeN/A

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                                          8. lower-*.f64N/A

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, \color{blue}{im \cdot \left(\frac{-1}{6} \cdot im\right)}, im\right) \]
                                          9. *-commutativeN/A

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot \frac{-1}{6}\right)}, im\right) \]
                                          10. lower-*.f6427.8

                                            \[\leadsto \left(re + 1\right) \cdot \mathsf{fma}\left(im, im \cdot \color{blue}{\left(im \cdot -0.16666666666666666\right)}, im\right) \]
                                        8. Applied rewrites27.8%

                                          \[\leadsto \left(re + 1\right) \cdot \color{blue}{\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right)} \]

                                        if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                                        1. Initial program 100.0%

                                          \[e^{re} \cdot \sin im \]
                                        2. Add Preprocessing
                                        3. Taylor expanded in im around 0

                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                        4. Step-by-step derivation
                                          1. lower-*.f64N/A

                                            \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                          2. lower-exp.f6470.1

                                            \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                        5. Applied rewrites70.1%

                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                        6. Taylor expanded in re around 0

                                          \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites62.4%

                                            \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                                        8. Recombined 2 regimes into one program.
                                        9. Final simplification39.8%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\ \;\;\;\;\mathsf{fma}\left(im, im \cdot \left(im \cdot -0.16666666666666666\right), im\right) \cdot \left(re + 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} \]
                                        10. Add Preprocessing

                                        Alternative 10: 35.8% accurate, 0.9× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\ \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), 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} \]
                                        (FPCore (re im)
                                         :precision binary64
                                         (if (<= (* (exp re) (sin im)) 0.0)
                                           (fma im (* -0.16666666666666666 (* im 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)) <= 0.0) {
                                        		tmp = fma(im, (-0.16666666666666666 * (im * 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)) <= 0.0)
                                        		tmp = fma(im, Float64(-0.16666666666666666 * Float64(im * 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], 0.0], N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $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:\\
                                        \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), 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}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                                          1. Initial program 100.0%

                                            \[e^{re} \cdot \sin im \]
                                          2. Add Preprocessing
                                          3. Taylor expanded in re around 0

                                            \[\leadsto \color{blue}{\sin im} \]
                                          4. Step-by-step derivation
                                            1. lower-sin.f6444.7

                                              \[\leadsto \color{blue}{\sin im} \]
                                          5. Applied rewrites44.7%

                                            \[\leadsto \color{blue}{\sin im} \]
                                          6. Taylor expanded in im around 0

                                            \[\leadsto im \cdot \color{blue}{\left(1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right) - \frac{1}{6}\right)\right)} \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites28.6%

                                              \[\leadsto im \cdot \color{blue}{\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)} \]
                                            2. Taylor expanded in im around 0

                                              \[\leadsto im \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {im}^{2}\right)} \]
                                            3. Step-by-step derivation
                                              1. Applied rewrites27.0%

                                                \[\leadsto \mathsf{fma}\left(im, \color{blue}{-0.16666666666666666 \cdot \left(im \cdot im\right)}, im\right) \]

                                              if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                                              1. Initial program 100.0%

                                                \[e^{re} \cdot \sin im \]
                                              2. Add Preprocessing
                                              3. Taylor expanded in im around 0

                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                              4. Step-by-step derivation
                                                1. lower-*.f64N/A

                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                2. lower-exp.f6470.1

                                                  \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                              5. Applied rewrites70.1%

                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                              6. Taylor expanded in re around 0

                                                \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                                              7. Step-by-step derivation
                                                1. Applied rewrites62.4%

                                                  \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                                              8. Recombined 2 regimes into one program.
                                              9. Add Preprocessing

                                              Alternative 11: 35.7% accurate, 0.9× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\ \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(re \cdot \left(re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)\right)\right)\\ \end{array} \end{array} \]
                                              (FPCore (re im)
                                               :precision binary64
                                               (if (<= (* (exp re) (sin im)) 0.0005)
                                                 (fma im (* -0.16666666666666666 (* im im)) im)
                                                 (* im (* re (* re (fma re 0.16666666666666666 0.5))))))
                                              double code(double re, double im) {
                                              	double tmp;
                                              	if ((exp(re) * sin(im)) <= 0.0005) {
                                              		tmp = fma(im, (-0.16666666666666666 * (im * im)), im);
                                              	} else {
                                              		tmp = im * (re * (re * fma(re, 0.16666666666666666, 0.5)));
                                              	}
                                              	return tmp;
                                              }
                                              
                                              function code(re, im)
                                              	tmp = 0.0
                                              	if (Float64(exp(re) * sin(im)) <= 0.0005)
                                              		tmp = fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im);
                                              	else
                                              		tmp = Float64(im * Float64(re * Float64(re * fma(re, 0.16666666666666666, 0.5))));
                                              	end
                                              	return tmp
                                              end
                                              
                                              code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0005], N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                              
                                              \begin{array}{l}
                                              
                                              \\
                                              \begin{array}{l}
                                              \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\
                                              \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;im \cdot \left(re \cdot \left(re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)\right)\right)\\
                                              
                                              
                                              \end{array}
                                              \end{array}
                                              
                                              Derivation
                                              1. Split input into 2 regimes
                                              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-4

                                                1. Initial program 100.0%

                                                  \[e^{re} \cdot \sin im \]
                                                2. Add Preprocessing
                                                3. Taylor expanded in re around 0

                                                  \[\leadsto \color{blue}{\sin im} \]
                                                4. Step-by-step derivation
                                                  1. lower-sin.f6454.4

                                                    \[\leadsto \color{blue}{\sin im} \]
                                                5. Applied rewrites54.4%

                                                  \[\leadsto \color{blue}{\sin im} \]
                                                6. Taylor expanded in im around 0

                                                  \[\leadsto im \cdot \color{blue}{\left(1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right) - \frac{1}{6}\right)\right)} \]
                                                7. Step-by-step derivation
                                                  1. Applied rewrites41.4%

                                                    \[\leadsto im \cdot \color{blue}{\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)} \]
                                                  2. Taylor expanded in im around 0

                                                    \[\leadsto im \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {im}^{2}\right)} \]
                                                  3. Step-by-step derivation
                                                    1. Applied rewrites40.1%

                                                      \[\leadsto \mathsf{fma}\left(im, \color{blue}{-0.16666666666666666 \cdot \left(im \cdot im\right)}, im\right) \]

                                                    if 5.0000000000000001e-4 < (*.f64 (exp.f64 re) (sin.f64 im))

                                                    1. Initial program 100.0%

                                                      \[e^{re} \cdot \sin im \]
                                                    2. Add Preprocessing
                                                    3. Taylor expanded in im around 0

                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                    4. Step-by-step derivation
                                                      1. lower-*.f64N/A

                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                      2. lower-exp.f6448.4

                                                        \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                    5. Applied rewrites48.4%

                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                    6. Taylor expanded in re around 0

                                                      \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                                                    7. Step-by-step derivation
                                                      1. Applied rewrites34.6%

                                                        \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                                                      2. Taylor expanded in re around inf

                                                        \[\leadsto im \cdot \left({re}^{3} \cdot \left(\frac{1}{6} + \color{blue}{\frac{1}{2} \cdot \frac{1}{re}}\right)\right) \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites34.5%

                                                          \[\leadsto im \cdot \left(re \cdot \left(re \cdot \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}\right)\right) \]
                                                      4. Recombined 2 regimes into one program.
                                                      5. Add Preprocessing

                                                      Alternative 12: 35.7% accurate, 0.9× speedup?

                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\ \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\ \end{array} \end{array} \]
                                                      (FPCore (re im)
                                                       :precision binary64
                                                       (if (<= (* (exp re) (sin im)) 0.0005)
                                                         (fma im (* -0.16666666666666666 (* im im)) im)
                                                         (* im (* 0.16666666666666666 (* re (* re re))))))
                                                      double code(double re, double im) {
                                                      	double tmp;
                                                      	if ((exp(re) * sin(im)) <= 0.0005) {
                                                      		tmp = fma(im, (-0.16666666666666666 * (im * im)), im);
                                                      	} else {
                                                      		tmp = im * (0.16666666666666666 * (re * (re * re)));
                                                      	}
                                                      	return tmp;
                                                      }
                                                      
                                                      function code(re, im)
                                                      	tmp = 0.0
                                                      	if (Float64(exp(re) * sin(im)) <= 0.0005)
                                                      		tmp = fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im);
                                                      	else
                                                      		tmp = Float64(im * Float64(0.16666666666666666 * Float64(re * Float64(re * re))));
                                                      	end
                                                      	return tmp
                                                      end
                                                      
                                                      code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0005], N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(im * N[(0.16666666666666666 * N[(re * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                      
                                                      \begin{array}{l}
                                                      
                                                      \\
                                                      \begin{array}{l}
                                                      \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\
                                                      \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                      
                                                      \mathbf{else}:\\
                                                      \;\;\;\;im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \left(re \cdot re\right)\right)\right)\\
                                                      
                                                      
                                                      \end{array}
                                                      \end{array}
                                                      
                                                      Derivation
                                                      1. Split input into 2 regimes
                                                      2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-4

                                                        1. Initial program 100.0%

                                                          \[e^{re} \cdot \sin im \]
                                                        2. Add Preprocessing
                                                        3. Taylor expanded in re around 0

                                                          \[\leadsto \color{blue}{\sin im} \]
                                                        4. Step-by-step derivation
                                                          1. lower-sin.f6454.4

                                                            \[\leadsto \color{blue}{\sin im} \]
                                                        5. Applied rewrites54.4%

                                                          \[\leadsto \color{blue}{\sin im} \]
                                                        6. Taylor expanded in im around 0

                                                          \[\leadsto im \cdot \color{blue}{\left(1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right) - \frac{1}{6}\right)\right)} \]
                                                        7. Step-by-step derivation
                                                          1. Applied rewrites41.4%

                                                            \[\leadsto im \cdot \color{blue}{\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)} \]
                                                          2. Taylor expanded in im around 0

                                                            \[\leadsto im \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {im}^{2}\right)} \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites40.1%

                                                              \[\leadsto \mathsf{fma}\left(im, \color{blue}{-0.16666666666666666 \cdot \left(im \cdot im\right)}, im\right) \]

                                                            if 5.0000000000000001e-4 < (*.f64 (exp.f64 re) (sin.f64 im))

                                                            1. Initial program 100.0%

                                                              \[e^{re} \cdot \sin im \]
                                                            2. Add Preprocessing
                                                            3. Taylor expanded in im around 0

                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                            4. Step-by-step derivation
                                                              1. lower-*.f64N/A

                                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                              2. lower-exp.f6448.4

                                                                \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                            5. Applied rewrites48.4%

                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                            6. Taylor expanded in re around 0

                                                              \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)}\right) \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites34.6%

                                                                \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right)}, 1\right) \]
                                                              2. Taylor expanded in re around inf

                                                                \[\leadsto im \cdot \left({re}^{3} \cdot \left(\frac{1}{6} + \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{re} + \frac{1}{{re}^{2}}\right)}\right)\right) \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites34.7%

                                                                  \[\leadsto im \cdot \mathsf{fma}\left(re \cdot re, \mathsf{fma}\left(re, \color{blue}{0.16666666666666666}, 0.5\right), re\right) \]
                                                                2. Taylor expanded in re around inf

                                                                  \[\leadsto im \cdot \left(\frac{1}{6} \cdot {re}^{\color{blue}{3}}\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites34.7%

                                                                    \[\leadsto im \cdot \left(0.16666666666666666 \cdot \left(re \cdot \color{blue}{\left(re \cdot re\right)}\right)\right) \]
                                                                4. Recombined 2 regimes into one program.
                                                                5. Add Preprocessing

                                                                Alternative 13: 34.8% accurate, 0.9× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0:\\ \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \end{array} \end{array} \]
                                                                (FPCore (re im)
                                                                 :precision binary64
                                                                 (if (<= (* (exp re) (sin im)) 0.0)
                                                                   (fma im (* -0.16666666666666666 (* im im)) im)
                                                                   (* 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 = fma(im, (-0.16666666666666666 * (im * im)), im);
                                                                	} 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 = fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im);
                                                                	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[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $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:\\
                                                                \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                                                                  1. Initial program 100.0%

                                                                    \[e^{re} \cdot \sin im \]
                                                                  2. Add Preprocessing
                                                                  3. Taylor expanded in re around 0

                                                                    \[\leadsto \color{blue}{\sin im} \]
                                                                  4. Step-by-step derivation
                                                                    1. lower-sin.f6444.7

                                                                      \[\leadsto \color{blue}{\sin im} \]
                                                                  5. Applied rewrites44.7%

                                                                    \[\leadsto \color{blue}{\sin im} \]
                                                                  6. Taylor expanded in im around 0

                                                                    \[\leadsto im \cdot \color{blue}{\left(1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right) - \frac{1}{6}\right)\right)} \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites28.6%

                                                                      \[\leadsto im \cdot \color{blue}{\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)} \]
                                                                    2. Taylor expanded in im around 0

                                                                      \[\leadsto im \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {im}^{2}\right)} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites27.0%

                                                                        \[\leadsto \mathsf{fma}\left(im, \color{blue}{-0.16666666666666666 \cdot \left(im \cdot im\right)}, im\right) \]

                                                                      if 0.0 < (*.f64 (exp.f64 re) (sin.f64 im))

                                                                      1. Initial program 100.0%

                                                                        \[e^{re} \cdot \sin im \]
                                                                      2. Add Preprocessing
                                                                      3. Taylor expanded in im around 0

                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                      4. Step-by-step derivation
                                                                        1. lower-*.f64N/A

                                                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                        2. lower-exp.f6470.1

                                                                          \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                      5. Applied rewrites70.1%

                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                      6. Taylor expanded in re around 0

                                                                        \[\leadsto im \cdot \left(1 + \color{blue}{re \cdot \left(1 + \frac{1}{2} \cdot re\right)}\right) \]
                                                                      7. Step-by-step derivation
                                                                        1. Applied rewrites59.1%

                                                                          \[\leadsto im \cdot \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \]
                                                                      8. Recombined 2 regimes into one program.
                                                                      9. Add Preprocessing

                                                                      Alternative 14: 34.7% accurate, 0.9× speedup?

                                                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\ \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
                                                                      (FPCore (re im)
                                                                       :precision binary64
                                                                       (if (<= (* (exp re) (sin im)) 0.0005)
                                                                         (fma im (* -0.16666666666666666 (* im im)) im)
                                                                         (* 0.5 (* im (* re re)))))
                                                                      double code(double re, double im) {
                                                                      	double tmp;
                                                                      	if ((exp(re) * sin(im)) <= 0.0005) {
                                                                      		tmp = fma(im, (-0.16666666666666666 * (im * im)), im);
                                                                      	} else {
                                                                      		tmp = 0.5 * (im * (re * re));
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      function code(re, im)
                                                                      	tmp = 0.0
                                                                      	if (Float64(exp(re) * sin(im)) <= 0.0005)
                                                                      		tmp = fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im);
                                                                      	else
                                                                      		tmp = Float64(0.5 * Float64(im * Float64(re * re)));
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.0005], N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision], N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \begin{array}{l}
                                                                      \mathbf{if}\;e^{re} \cdot \sin im \leq 0.0005:\\
                                                                      \;\;\;\;\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\
                                                                      
                                                                      
                                                                      \end{array}
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Split input into 2 regimes
                                                                      2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 5.0000000000000001e-4

                                                                        1. Initial program 100.0%

                                                                          \[e^{re} \cdot \sin im \]
                                                                        2. Add Preprocessing
                                                                        3. Taylor expanded in re around 0

                                                                          \[\leadsto \color{blue}{\sin im} \]
                                                                        4. Step-by-step derivation
                                                                          1. lower-sin.f6454.4

                                                                            \[\leadsto \color{blue}{\sin im} \]
                                                                        5. Applied rewrites54.4%

                                                                          \[\leadsto \color{blue}{\sin im} \]
                                                                        6. Taylor expanded in im around 0

                                                                          \[\leadsto im \cdot \color{blue}{\left(1 + {im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {im}^{2}\right) - \frac{1}{6}\right)\right)} \]
                                                                        7. Step-by-step derivation
                                                                          1. Applied rewrites41.4%

                                                                            \[\leadsto im \cdot \color{blue}{\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)} \]
                                                                          2. Taylor expanded in im around 0

                                                                            \[\leadsto im \cdot \color{blue}{\left(1 + \frac{-1}{6} \cdot {im}^{2}\right)} \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites40.1%

                                                                              \[\leadsto \mathsf{fma}\left(im, \color{blue}{-0.16666666666666666 \cdot \left(im \cdot im\right)}, im\right) \]

                                                                            if 5.0000000000000001e-4 < (*.f64 (exp.f64 re) (sin.f64 im))

                                                                            1. Initial program 100.0%

                                                                              \[e^{re} \cdot \sin im \]
                                                                            2. Add Preprocessing
                                                                            3. Taylor expanded in im around 0

                                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                            4. Step-by-step derivation
                                                                              1. lower-*.f64N/A

                                                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                              2. lower-exp.f6448.4

                                                                                \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                            5. Applied rewrites48.4%

                                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                            6. Taylor expanded in re around 0

                                                                              \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
                                                                            7. Step-by-step derivation
                                                                              1. Applied rewrites24.9%

                                                                                \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
                                                                              2. Taylor expanded in re around inf

                                                                                \[\leadsto \frac{1}{2} \cdot \left(im \cdot \color{blue}{{re}^{2}}\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites28.5%

                                                                                  \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(re \cdot re\right)}\right) \]
                                                                              4. Recombined 2 regimes into one program.
                                                                              5. Add Preprocessing

                                                                              Alternative 15: 32.6% accurate, 0.9× speedup?

                                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im \leq 0.98:\\ \;\;\;\;im \cdot 1\\ \mathbf{else}:\\ \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\ \end{array} \end{array} \]
                                                                              (FPCore (re im)
                                                                               :precision binary64
                                                                               (if (<= (* (exp re) (sin im)) 0.98) (* im 1.0) (* 0.5 (* im (* re re)))))
                                                                              double code(double re, double im) {
                                                                              	double tmp;
                                                                              	if ((exp(re) * sin(im)) <= 0.98) {
                                                                              		tmp = im * 1.0;
                                                                              	} else {
                                                                              		tmp = 0.5 * (im * (re * re));
                                                                              	}
                                                                              	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)) <= 0.98d0) then
                                                                                      tmp = im * 1.0d0
                                                                                  else
                                                                                      tmp = 0.5d0 * (im * (re * re))
                                                                                  end if
                                                                                  code = tmp
                                                                              end function
                                                                              
                                                                              public static double code(double re, double im) {
                                                                              	double tmp;
                                                                              	if ((Math.exp(re) * Math.sin(im)) <= 0.98) {
                                                                              		tmp = im * 1.0;
                                                                              	} else {
                                                                              		tmp = 0.5 * (im * (re * re));
                                                                              	}
                                                                              	return tmp;
                                                                              }
                                                                              
                                                                              def code(re, im):
                                                                              	tmp = 0
                                                                              	if (math.exp(re) * math.sin(im)) <= 0.98:
                                                                              		tmp = im * 1.0
                                                                              	else:
                                                                              		tmp = 0.5 * (im * (re * re))
                                                                              	return tmp
                                                                              
                                                                              function code(re, im)
                                                                              	tmp = 0.0
                                                                              	if (Float64(exp(re) * sin(im)) <= 0.98)
                                                                              		tmp = Float64(im * 1.0);
                                                                              	else
                                                                              		tmp = Float64(0.5 * Float64(im * Float64(re * re)));
                                                                              	end
                                                                              	return tmp
                                                                              end
                                                                              
                                                                              function tmp_2 = code(re, im)
                                                                              	tmp = 0.0;
                                                                              	if ((exp(re) * sin(im)) <= 0.98)
                                                                              		tmp = im * 1.0;
                                                                              	else
                                                                              		tmp = 0.5 * (im * (re * re));
                                                                              	end
                                                                              	tmp_2 = tmp;
                                                                              end
                                                                              
                                                                              code[re_, im_] := If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision], 0.98], N[(im * 1.0), $MachinePrecision], N[(0.5 * N[(im * N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                                              
                                                                              \begin{array}{l}
                                                                              
                                                                              \\
                                                                              \begin{array}{l}
                                                                              \mathbf{if}\;e^{re} \cdot \sin im \leq 0.98:\\
                                                                              \;\;\;\;im \cdot 1\\
                                                                              
                                                                              \mathbf{else}:\\
                                                                              \;\;\;\;0.5 \cdot \left(im \cdot \left(re \cdot re\right)\right)\\
                                                                              
                                                                              
                                                                              \end{array}
                                                                              \end{array}
                                                                              
                                                                              Derivation
                                                                              1. Split input into 2 regimes
                                                                              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.97999999999999998

                                                                                1. Initial program 100.0%

                                                                                  \[e^{re} \cdot \sin im \]
                                                                                2. Add Preprocessing
                                                                                3. Taylor expanded in im around 0

                                                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                4. Step-by-step derivation
                                                                                  1. lower-*.f64N/A

                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                  2. lower-exp.f6469.0

                                                                                    \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                5. Applied rewrites69.0%

                                                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                6. Taylor expanded in re around 0

                                                                                  \[\leadsto im \cdot 1 \]
                                                                                7. Step-by-step derivation
                                                                                  1. Applied rewrites33.0%

                                                                                    \[\leadsto im \cdot 1 \]

                                                                                  if 0.97999999999999998 < (*.f64 (exp.f64 re) (sin.f64 im))

                                                                                  1. Initial program 100.0%

                                                                                    \[e^{re} \cdot \sin im \]
                                                                                  2. Add Preprocessing
                                                                                  3. Taylor expanded in im around 0

                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                  4. Step-by-step derivation
                                                                                    1. lower-*.f64N/A

                                                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                    2. lower-exp.f6479.3

                                                                                      \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                  5. Applied rewrites79.3%

                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                  6. Taylor expanded in re around 0

                                                                                    \[\leadsto im + \color{blue}{re \cdot \left(im + \frac{1}{2} \cdot \left(im \cdot re\right)\right)} \]
                                                                                  7. Step-by-step derivation
                                                                                    1. Applied rewrites39.7%

                                                                                      \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, im\right) \]
                                                                                    2. Taylor expanded in re around inf

                                                                                      \[\leadsto \frac{1}{2} \cdot \left(im \cdot \color{blue}{{re}^{2}}\right) \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites45.9%

                                                                                        \[\leadsto 0.5 \cdot \left(im \cdot \color{blue}{\left(re \cdot re\right)}\right) \]
                                                                                    4. Recombined 2 regimes into one program.
                                                                                    5. Add Preprocessing

                                                                                    Alternative 16: 97.5% accurate, 1.1× speedup?

                                                                                    \[\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 -0.07:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re\right) \cdot t\_0, \frac{1}{t\_0}, 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
                                                                                    (FPCore (re im)
                                                                                     :precision binary64
                                                                                     (let* ((t_0 (fma re (* re (fma re 0.16666666666666666 0.5)) (- re))))
                                                                                       (if (<= re -0.07)
                                                                                         (* (exp re) im)
                                                                                         (if (<= re 350.0)
                                                                                           (*
                                                                                            (sin im)
                                                                                            (fma
                                                                                             (* (fma (fma re 0.16666666666666666 0.5) (* re re) re) t_0)
                                                                                             (/ 1.0 t_0)
                                                                                             1.0))
                                                                                           (if (<= re 1e+103)
                                                                                             (* (exp re) (fma im (* -0.16666666666666666 (* im im)) im))
                                                                                             (* (sin im) (* re (* re (* re 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 <= -0.07) {
                                                                                    		tmp = exp(re) * im;
                                                                                    	} else if (re <= 350.0) {
                                                                                    		tmp = sin(im) * fma((fma(fma(re, 0.16666666666666666, 0.5), (re * re), re) * t_0), (1.0 / t_0), 1.0);
                                                                                    	} else if (re <= 1e+103) {
                                                                                    		tmp = exp(re) * fma(im, (-0.16666666666666666 * (im * im)), im);
                                                                                    	} else {
                                                                                    		tmp = sin(im) * (re * (re * (re * 0.16666666666666666)));
                                                                                    	}
                                                                                    	return tmp;
                                                                                    }
                                                                                    
                                                                                    function code(re, im)
                                                                                    	t_0 = fma(re, Float64(re * fma(re, 0.16666666666666666, 0.5)), Float64(-re))
                                                                                    	tmp = 0.0
                                                                                    	if (re <= -0.07)
                                                                                    		tmp = Float64(exp(re) * im);
                                                                                    	elseif (re <= 350.0)
                                                                                    		tmp = Float64(sin(im) * fma(Float64(fma(fma(re, 0.16666666666666666, 0.5), Float64(re * re), re) * t_0), Float64(1.0 / t_0), 1.0));
                                                                                    	elseif (re <= 1e+103)
                                                                                    		tmp = Float64(exp(re) * fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im));
                                                                                    	else
                                                                                    		tmp = Float64(sin(im) * Float64(re * Float64(re * Float64(re * 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, -0.07], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Sin[im], $MachinePrecision] * N[(N[(N[(N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] * N[(re * re), $MachinePrecision] + re), $MachinePrecision] * t$95$0), $MachinePrecision] * N[(1.0 / t$95$0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[(N[Exp[re], $MachinePrecision] * N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $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 -0.07:\\
                                                                                    \;\;\;\;e^{re} \cdot im\\
                                                                                    
                                                                                    \mathbf{elif}\;re \leq 350:\\
                                                                                    \;\;\;\;\sin im \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re\right) \cdot t\_0, \frac{1}{t\_0}, 1\right)\\
                                                                                    
                                                                                    \mathbf{elif}\;re \leq 10^{+103}:\\
                                                                                    \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                                                    
                                                                                    \mathbf{else}:\\
                                                                                    \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\
                                                                                    
                                                                                    
                                                                                    \end{array}
                                                                                    \end{array}
                                                                                    
                                                                                    Derivation
                                                                                    1. Split input into 4 regimes
                                                                                    2. if re < -0.070000000000000007

                                                                                      1. Initial program 100.0%

                                                                                        \[e^{re} \cdot \sin im \]
                                                                                      2. Add Preprocessing
                                                                                      3. Taylor expanded in im around 0

                                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                      4. Step-by-step derivation
                                                                                        1. lower-*.f64N/A

                                                                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                        2. lower-exp.f6498.6

                                                                                          \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                      5. Applied rewrites98.6%

                                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]

                                                                                      if -0.070000000000000007 < re < 350

                                                                                      1. Initial program 100.0%

                                                                                        \[e^{re} \cdot \sin im \]
                                                                                      2. Add Preprocessing
                                                                                      3. Taylor expanded in re around 0

                                                                                        \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                      4. Step-by-step derivation
                                                                                        1. +-commutativeN/A

                                                                                          \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                        2. lower-fma.f64N/A

                                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                        3. +-commutativeN/A

                                                                                          \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                        4. lower-fma.f64N/A

                                                                                          \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                        5. +-commutativeN/A

                                                                                          \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                        6. *-commutativeN/A

                                                                                          \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                        7. lower-fma.f6499.2

                                                                                          \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                      5. Applied rewrites99.2%

                                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]
                                                                                      6. Step-by-step derivation
                                                                                        1. Applied rewrites99.2%

                                                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re\right) \cdot \mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), -re\right), \color{blue}{\frac{1}{\mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), -re\right)}}, 1\right) \cdot \sin im \]

                                                                                        if 350 < re < 1e103

                                                                                        1. Initial program 100.0%

                                                                                          \[e^{re} \cdot \sin im \]
                                                                                        2. Add Preprocessing
                                                                                        3. Taylor expanded in im around 0

                                                                                          \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                                                                                        4. Step-by-step derivation
                                                                                          1. +-commutativeN/A

                                                                                            \[\leadsto e^{re} \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                                                                                          2. distribute-lft-inN/A

                                                                                            \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                                                                                          3. *-rgt-identityN/A

                                                                                            \[\leadsto e^{re} \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                                                                                          4. lower-fma.f64N/A

                                                                                            \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                                                                                          5. lower-*.f64N/A

                                                                                            \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \color{blue}{\frac{-1}{6} \cdot {im}^{2}}, im\right) \]
                                                                                          6. unpow2N/A

                                                                                            \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                          7. lower-*.f6488.2

                                                                                            \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                        5. Applied rewrites88.2%

                                                                                          \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)} \]

                                                                                        if 1e103 < re

                                                                                        1. Initial program 100.0%

                                                                                          \[e^{re} \cdot \sin im \]
                                                                                        2. Add Preprocessing
                                                                                        3. Taylor expanded in re around 0

                                                                                          \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                        4. Step-by-step derivation
                                                                                          1. +-commutativeN/A

                                                                                            \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                          2. lower-fma.f64N/A

                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                          3. +-commutativeN/A

                                                                                            \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                          4. lower-fma.f64N/A

                                                                                            \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                          5. +-commutativeN/A

                                                                                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                          6. *-commutativeN/A

                                                                                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                          7. lower-fma.f64100.0

                                                                                            \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                        5. Applied rewrites100.0%

                                                                                          \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]
                                                                                        6. Taylor expanded in re around inf

                                                                                          \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{{re}^{3}}\right) \cdot \sin im \]
                                                                                        7. Step-by-step derivation
                                                                                          1. Applied rewrites100.0%

                                                                                            \[\leadsto \left(re \cdot \color{blue}{\left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)}\right) \cdot \sin im \]
                                                                                        8. Recombined 4 regimes into one program.
                                                                                        9. Final simplification98.5%

                                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.07:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), re \cdot re, re\right) \cdot \mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), -re\right), \frac{1}{\mathsf{fma}\left(re, re \cdot \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), -re\right)}, 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
                                                                                        10. Add Preprocessing

                                                                                        Alternative 17: 97.5% accurate, 1.5× speedup?

                                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -0.07:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
                                                                                        (FPCore (re im)
                                                                                         :precision binary64
                                                                                         (if (<= re -0.07)
                                                                                           (* (exp re) im)
                                                                                           (if (<= re 350.0)
                                                                                             (* (sin im) (fma re (fma re (fma re 0.16666666666666666 0.5) 1.0) 1.0))
                                                                                             (if (<= re 1e+103)
                                                                                               (* (exp re) (fma im (* -0.16666666666666666 (* im im)) im))
                                                                                               (* (sin im) (* re (* re (* re 0.16666666666666666))))))))
                                                                                        double code(double re, double im) {
                                                                                        	double tmp;
                                                                                        	if (re <= -0.07) {
                                                                                        		tmp = exp(re) * im;
                                                                                        	} else if (re <= 350.0) {
                                                                                        		tmp = sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0);
                                                                                        	} else if (re <= 1e+103) {
                                                                                        		tmp = exp(re) * fma(im, (-0.16666666666666666 * (im * im)), im);
                                                                                        	} else {
                                                                                        		tmp = sin(im) * (re * (re * (re * 0.16666666666666666)));
                                                                                        	}
                                                                                        	return tmp;
                                                                                        }
                                                                                        
                                                                                        function code(re, im)
                                                                                        	tmp = 0.0
                                                                                        	if (re <= -0.07)
                                                                                        		tmp = Float64(exp(re) * im);
                                                                                        	elseif (re <= 350.0)
                                                                                        		tmp = Float64(sin(im) * fma(re, fma(re, fma(re, 0.16666666666666666, 0.5), 1.0), 1.0));
                                                                                        	elseif (re <= 1e+103)
                                                                                        		tmp = Float64(exp(re) * fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im));
                                                                                        	else
                                                                                        		tmp = Float64(sin(im) * Float64(re * Float64(re * Float64(re * 0.16666666666666666))));
                                                                                        	end
                                                                                        	return tmp
                                                                                        end
                                                                                        
                                                                                        code[re_, im_] := If[LessEqual[re, -0.07], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666 + 0.5), $MachinePrecision] + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[(N[Exp[re], $MachinePrecision] * N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                                                                                        
                                                                                        \begin{array}{l}
                                                                                        
                                                                                        \\
                                                                                        \begin{array}{l}
                                                                                        \mathbf{if}\;re \leq -0.07:\\
                                                                                        \;\;\;\;e^{re} \cdot im\\
                                                                                        
                                                                                        \mathbf{elif}\;re \leq 350:\\
                                                                                        \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\
                                                                                        
                                                                                        \mathbf{elif}\;re \leq 10^{+103}:\\
                                                                                        \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                                                        
                                                                                        \mathbf{else}:\\
                                                                                        \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\
                                                                                        
                                                                                        
                                                                                        \end{array}
                                                                                        \end{array}
                                                                                        
                                                                                        Derivation
                                                                                        1. Split input into 4 regimes
                                                                                        2. if re < -0.070000000000000007

                                                                                          1. Initial program 100.0%

                                                                                            \[e^{re} \cdot \sin im \]
                                                                                          2. Add Preprocessing
                                                                                          3. Taylor expanded in im around 0

                                                                                            \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                          4. Step-by-step derivation
                                                                                            1. lower-*.f64N/A

                                                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                            2. lower-exp.f6498.6

                                                                                              \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                          5. Applied rewrites98.6%

                                                                                            \[\leadsto \color{blue}{im \cdot e^{re}} \]

                                                                                          if -0.070000000000000007 < re < 350

                                                                                          1. Initial program 100.0%

                                                                                            \[e^{re} \cdot \sin im \]
                                                                                          2. Add Preprocessing
                                                                                          3. Taylor expanded in re around 0

                                                                                            \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                          4. Step-by-step derivation
                                                                                            1. +-commutativeN/A

                                                                                              \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                            2. lower-fma.f64N/A

                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                            3. +-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                            4. lower-fma.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                            5. +-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                            6. *-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                            7. lower-fma.f6499.2

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                          5. Applied rewrites99.2%

                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]

                                                                                          if 350 < re < 1e103

                                                                                          1. Initial program 100.0%

                                                                                            \[e^{re} \cdot \sin im \]
                                                                                          2. Add Preprocessing
                                                                                          3. Taylor expanded in im around 0

                                                                                            \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                                                                                          4. Step-by-step derivation
                                                                                            1. +-commutativeN/A

                                                                                              \[\leadsto e^{re} \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                                                                                            2. distribute-lft-inN/A

                                                                                              \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                                                                                            3. *-rgt-identityN/A

                                                                                              \[\leadsto e^{re} \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                                                                                            4. lower-fma.f64N/A

                                                                                              \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                                                                                            5. lower-*.f64N/A

                                                                                              \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \color{blue}{\frac{-1}{6} \cdot {im}^{2}}, im\right) \]
                                                                                            6. unpow2N/A

                                                                                              \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                            7. lower-*.f6488.2

                                                                                              \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                          5. Applied rewrites88.2%

                                                                                            \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)} \]

                                                                                          if 1e103 < re

                                                                                          1. Initial program 100.0%

                                                                                            \[e^{re} \cdot \sin im \]
                                                                                          2. Add Preprocessing
                                                                                          3. Taylor expanded in re around 0

                                                                                            \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                          4. Step-by-step derivation
                                                                                            1. +-commutativeN/A

                                                                                              \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                            2. lower-fma.f64N/A

                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                            3. +-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                            4. lower-fma.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                            5. +-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                            6. *-commutativeN/A

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                            7. lower-fma.f64100.0

                                                                                              \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                          5. Applied rewrites100.0%

                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]
                                                                                          6. Taylor expanded in re around inf

                                                                                            \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{{re}^{3}}\right) \cdot \sin im \]
                                                                                          7. Step-by-step derivation
                                                                                            1. Applied rewrites100.0%

                                                                                              \[\leadsto \left(re \cdot \color{blue}{\left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)}\right) \cdot \sin im \]
                                                                                          8. Recombined 4 regimes into one program.
                                                                                          9. Final simplification98.5%

                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -0.07:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
                                                                                          10. Add Preprocessing

                                                                                          Alternative 18: 97.3% accurate, 1.5× speedup?

                                                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
                                                                                          (FPCore (re im)
                                                                                           :precision binary64
                                                                                           (if (<= re -2.15e-5)
                                                                                             (* (exp re) im)
                                                                                             (if (<= re 350.0)
                                                                                               (* (sin im) (fma re (fma re 0.5 1.0) 1.0))
                                                                                               (if (<= re 1e+103)
                                                                                                 (* (exp re) (fma im (* -0.16666666666666666 (* im im)) im))
                                                                                                 (* (sin im) (* re (* re (* re 0.16666666666666666))))))))
                                                                                          double code(double re, double im) {
                                                                                          	double tmp;
                                                                                          	if (re <= -2.15e-5) {
                                                                                          		tmp = exp(re) * im;
                                                                                          	} else if (re <= 350.0) {
                                                                                          		tmp = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
                                                                                          	} else if (re <= 1e+103) {
                                                                                          		tmp = exp(re) * fma(im, (-0.16666666666666666 * (im * im)), im);
                                                                                          	} else {
                                                                                          		tmp = sin(im) * (re * (re * (re * 0.16666666666666666)));
                                                                                          	}
                                                                                          	return tmp;
                                                                                          }
                                                                                          
                                                                                          function code(re, im)
                                                                                          	tmp = 0.0
                                                                                          	if (re <= -2.15e-5)
                                                                                          		tmp = Float64(exp(re) * im);
                                                                                          	elseif (re <= 350.0)
                                                                                          		tmp = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0));
                                                                                          	elseif (re <= 1e+103)
                                                                                          		tmp = Float64(exp(re) * fma(im, Float64(-0.16666666666666666 * Float64(im * im)), im));
                                                                                          	else
                                                                                          		tmp = Float64(sin(im) * Float64(re * Float64(re * Float64(re * 0.16666666666666666))));
                                                                                          	end
                                                                                          	return tmp
                                                                                          end
                                                                                          
                                                                                          code[re_, im_] := If[LessEqual[re, -2.15e-5], N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision], If[LessEqual[re, 350.0], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], N[(N[Exp[re], $MachinePrecision] * N[(im * N[(-0.16666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] + im), $MachinePrecision]), $MachinePrecision], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                                                                                          
                                                                                          \begin{array}{l}
                                                                                          
                                                                                          \\
                                                                                          \begin{array}{l}
                                                                                          \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\
                                                                                          \;\;\;\;e^{re} \cdot im\\
                                                                                          
                                                                                          \mathbf{elif}\;re \leq 350:\\
                                                                                          \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
                                                                                          
                                                                                          \mathbf{elif}\;re \leq 10^{+103}:\\
                                                                                          \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\
                                                                                          
                                                                                          \mathbf{else}:\\
                                                                                          \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\
                                                                                          
                                                                                          
                                                                                          \end{array}
                                                                                          \end{array}
                                                                                          
                                                                                          Derivation
                                                                                          1. Split input into 4 regimes
                                                                                          2. if re < -2.1500000000000001e-5

                                                                                            1. Initial program 100.0%

                                                                                              \[e^{re} \cdot \sin im \]
                                                                                            2. Add Preprocessing
                                                                                            3. Taylor expanded in im around 0

                                                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                            4. Step-by-step derivation
                                                                                              1. lower-*.f64N/A

                                                                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                              2. lower-exp.f6498.6

                                                                                                \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                            5. Applied rewrites98.6%

                                                                                              \[\leadsto \color{blue}{im \cdot e^{re}} \]

                                                                                            if -2.1500000000000001e-5 < re < 350

                                                                                            1. Initial program 100.0%

                                                                                              \[e^{re} \cdot \sin im \]
                                                                                            2. Add Preprocessing
                                                                                            3. Taylor expanded in re around 0

                                                                                              \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
                                                                                            4. Step-by-step derivation
                                                                                              1. +-commutativeN/A

                                                                                                \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
                                                                                              2. lower-fma.f64N/A

                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
                                                                                              3. +-commutativeN/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
                                                                                              4. *-commutativeN/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
                                                                                              5. lower-fma.f6499.2

                                                                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
                                                                                            5. Applied rewrites99.2%

                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]

                                                                                            if 350 < re < 1e103

                                                                                            1. Initial program 100.0%

                                                                                              \[e^{re} \cdot \sin im \]
                                                                                            2. Add Preprocessing
                                                                                            3. Taylor expanded in im around 0

                                                                                              \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(1 + \frac{-1}{6} \cdot {im}^{2}\right)\right)} \]
                                                                                            4. Step-by-step derivation
                                                                                              1. +-commutativeN/A

                                                                                                \[\leadsto e^{re} \cdot \left(im \cdot \color{blue}{\left(\frac{-1}{6} \cdot {im}^{2} + 1\right)}\right) \]
                                                                                              2. distribute-lft-inN/A

                                                                                                \[\leadsto e^{re} \cdot \color{blue}{\left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + im \cdot 1\right)} \]
                                                                                              3. *-rgt-identityN/A

                                                                                                \[\leadsto e^{re} \cdot \left(im \cdot \left(\frac{-1}{6} \cdot {im}^{2}\right) + \color{blue}{im}\right) \]
                                                                                              4. lower-fma.f64N/A

                                                                                                \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, \frac{-1}{6} \cdot {im}^{2}, im\right)} \]
                                                                                              5. lower-*.f64N/A

                                                                                                \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \color{blue}{\frac{-1}{6} \cdot {im}^{2}}, im\right) \]
                                                                                              6. unpow2N/A

                                                                                                \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, \frac{-1}{6} \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                              7. lower-*.f6488.2

                                                                                                \[\leadsto e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \color{blue}{\left(im \cdot im\right)}, im\right) \]
                                                                                            5. Applied rewrites88.2%

                                                                                              \[\leadsto e^{re} \cdot \color{blue}{\mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)} \]

                                                                                            if 1e103 < re

                                                                                            1. Initial program 100.0%

                                                                                              \[e^{re} \cdot \sin im \]
                                                                                            2. Add Preprocessing
                                                                                            3. Taylor expanded in re around 0

                                                                                              \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                            4. Step-by-step derivation
                                                                                              1. +-commutativeN/A

                                                                                                \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                              2. lower-fma.f64N/A

                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                              3. +-commutativeN/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                              4. lower-fma.f64N/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                              5. +-commutativeN/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                              6. *-commutativeN/A

                                                                                                \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                              7. lower-fma.f64100.0

                                                                                                \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                            5. Applied rewrites100.0%

                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]
                                                                                            6. Taylor expanded in re around inf

                                                                                              \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{{re}^{3}}\right) \cdot \sin im \]
                                                                                            7. Step-by-step derivation
                                                                                              1. Applied rewrites100.0%

                                                                                                \[\leadsto \left(re \cdot \color{blue}{\left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)}\right) \cdot \sin im \]
                                                                                            8. Recombined 4 regimes into one program.
                                                                                            9. Final simplification98.5%

                                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 350:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot \mathsf{fma}\left(im, -0.16666666666666666 \cdot \left(im \cdot im\right), im\right)\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
                                                                                            10. Add Preprocessing

                                                                                            Alternative 19: 96.8% accurate, 1.5× speedup?

                                                                                            \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{re} \cdot im\\ \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;re \leq 5000000:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \end{array} \]
                                                                                            (FPCore (re im)
                                                                                             :precision binary64
                                                                                             (let* ((t_0 (* (exp re) im)))
                                                                                               (if (<= re -2.15e-5)
                                                                                                 t_0
                                                                                                 (if (<= re 5000000.0)
                                                                                                   (* (sin im) (fma re (fma re 0.5 1.0) 1.0))
                                                                                                   (if (<= re 1e+103)
                                                                                                     t_0
                                                                                                     (* (sin im) (* re (* re (* re 0.16666666666666666)))))))))
                                                                                            double code(double re, double im) {
                                                                                            	double t_0 = exp(re) * im;
                                                                                            	double tmp;
                                                                                            	if (re <= -2.15e-5) {
                                                                                            		tmp = t_0;
                                                                                            	} else if (re <= 5000000.0) {
                                                                                            		tmp = sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0);
                                                                                            	} else if (re <= 1e+103) {
                                                                                            		tmp = t_0;
                                                                                            	} else {
                                                                                            		tmp = sin(im) * (re * (re * (re * 0.16666666666666666)));
                                                                                            	}
                                                                                            	return tmp;
                                                                                            }
                                                                                            
                                                                                            function code(re, im)
                                                                                            	t_0 = Float64(exp(re) * im)
                                                                                            	tmp = 0.0
                                                                                            	if (re <= -2.15e-5)
                                                                                            		tmp = t_0;
                                                                                            	elseif (re <= 5000000.0)
                                                                                            		tmp = Float64(sin(im) * fma(re, fma(re, 0.5, 1.0), 1.0));
                                                                                            	elseif (re <= 1e+103)
                                                                                            		tmp = t_0;
                                                                                            	else
                                                                                            		tmp = Float64(sin(im) * Float64(re * Float64(re * Float64(re * 0.16666666666666666))));
                                                                                            	end
                                                                                            	return tmp
                                                                                            end
                                                                                            
                                                                                            code[re_, im_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[re, -2.15e-5], t$95$0, If[LessEqual[re, 5000000.0], N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * 0.5 + 1.0), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[re, 1e+103], t$95$0, N[(N[Sin[im], $MachinePrecision] * N[(re * N[(re * N[(re * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                                                            
                                                                                            \begin{array}{l}
                                                                                            
                                                                                            \\
                                                                                            \begin{array}{l}
                                                                                            t_0 := e^{re} \cdot im\\
                                                                                            \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\
                                                                                            \;\;\;\;t\_0\\
                                                                                            
                                                                                            \mathbf{elif}\;re \leq 5000000:\\
                                                                                            \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\
                                                                                            
                                                                                            \mathbf{elif}\;re \leq 10^{+103}:\\
                                                                                            \;\;\;\;t\_0\\
                                                                                            
                                                                                            \mathbf{else}:\\
                                                                                            \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\
                                                                                            
                                                                                            
                                                                                            \end{array}
                                                                                            \end{array}
                                                                                            
                                                                                            Derivation
                                                                                            1. Split input into 3 regimes
                                                                                            2. if re < -2.1500000000000001e-5 or 5e6 < re < 1e103

                                                                                              1. Initial program 100.0%

                                                                                                \[e^{re} \cdot \sin im \]
                                                                                              2. Add Preprocessing
                                                                                              3. Taylor expanded in im around 0

                                                                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                              4. Step-by-step derivation
                                                                                                1. lower-*.f64N/A

                                                                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                2. lower-exp.f6495.3

                                                                                                  \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                              5. Applied rewrites95.3%

                                                                                                \[\leadsto \color{blue}{im \cdot e^{re}} \]

                                                                                              if -2.1500000000000001e-5 < re < 5e6

                                                                                              1. Initial program 100.0%

                                                                                                \[e^{re} \cdot \sin im \]
                                                                                              2. Add Preprocessing
                                                                                              3. Taylor expanded in re around 0

                                                                                                \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
                                                                                              4. Step-by-step derivation
                                                                                                1. +-commutativeN/A

                                                                                                  \[\leadsto \color{blue}{\left(re \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
                                                                                                2. lower-fma.f64N/A

                                                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + \frac{1}{2} \cdot re, 1\right)} \cdot \sin im \]
                                                                                                3. +-commutativeN/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{\frac{1}{2} \cdot re + 1}, 1\right) \cdot \sin im \]
                                                                                                4. *-commutativeN/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{2}} + 1, 1\right) \cdot \sin im \]
                                                                                                5. lower-fma.f6498.5

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.5, 1\right)}, 1\right) \cdot \sin im \]
                                                                                              5. Applied rewrites98.5%

                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)} \cdot \sin im \]

                                                                                              if 1e103 < re

                                                                                              1. Initial program 100.0%

                                                                                                \[e^{re} \cdot \sin im \]
                                                                                              2. Add Preprocessing
                                                                                              3. Taylor expanded in re around 0

                                                                                                \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
                                                                                              4. Step-by-step derivation
                                                                                                1. +-commutativeN/A

                                                                                                  \[\leadsto \color{blue}{\left(re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right) + 1\right)} \cdot \sin im \]
                                                                                                2. lower-fma.f64N/A

                                                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(re, 1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right), 1\right)} \cdot \sin im \]
                                                                                                3. +-commutativeN/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right) + 1}, 1\right) \cdot \sin im \]
                                                                                                4. lower-fma.f64N/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, \frac{1}{2} + \frac{1}{6} \cdot re, 1\right)}, 1\right) \cdot \sin im \]
                                                                                                5. +-commutativeN/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\frac{1}{6} \cdot re + \frac{1}{2}}, 1\right), 1\right) \cdot \sin im \]
                                                                                                6. *-commutativeN/A

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{re \cdot \frac{1}{6}} + \frac{1}{2}, 1\right), 1\right) \cdot \sin im \]
                                                                                                7. lower-fma.f64100.0

                                                                                                  \[\leadsto \mathsf{fma}\left(re, \mathsf{fma}\left(re, \color{blue}{\mathsf{fma}\left(re, 0.16666666666666666, 0.5\right)}, 1\right), 1\right) \cdot \sin im \]
                                                                                              5. Applied rewrites100.0%

                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.16666666666666666, 0.5\right), 1\right), 1\right)} \cdot \sin im \]
                                                                                              6. Taylor expanded in re around inf

                                                                                                \[\leadsto \left(\frac{1}{6} \cdot \color{blue}{{re}^{3}}\right) \cdot \sin im \]
                                                                                              7. Step-by-step derivation
                                                                                                1. Applied rewrites100.0%

                                                                                                  \[\leadsto \left(re \cdot \color{blue}{\left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)}\right) \cdot \sin im \]
                                                                                              8. Recombined 3 regimes into one program.
                                                                                              9. Final simplification97.7%

                                                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;re \leq -2.15 \cdot 10^{-5}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{elif}\;re \leq 5000000:\\ \;\;\;\;\sin im \cdot \mathsf{fma}\left(re, \mathsf{fma}\left(re, 0.5, 1\right), 1\right)\\ \mathbf{elif}\;re \leq 10^{+103}:\\ \;\;\;\;e^{re} \cdot im\\ \mathbf{else}:\\ \;\;\;\;\sin im \cdot \left(re \cdot \left(re \cdot \left(re \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
                                                                                              10. Add Preprocessing

                                                                                              Alternative 20: 28.6% accurate, 17.1× speedup?

                                                                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 6.2 \cdot 10^{+71}:\\ \;\;\;\;im \cdot 1\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\\ \end{array} \end{array} \]
                                                                                              (FPCore (re im) :precision binary64 (if (<= im 6.2e+71) (* im 1.0) (* re im)))
                                                                                              double code(double re, double im) {
                                                                                              	double tmp;
                                                                                              	if (im <= 6.2e+71) {
                                                                                              		tmp = im * 1.0;
                                                                                              	} 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 (im <= 6.2d+71) then
                                                                                                      tmp = im * 1.0d0
                                                                                                  else
                                                                                                      tmp = re * im
                                                                                                  end if
                                                                                                  code = tmp
                                                                                              end function
                                                                                              
                                                                                              public static double code(double re, double im) {
                                                                                              	double tmp;
                                                                                              	if (im <= 6.2e+71) {
                                                                                              		tmp = im * 1.0;
                                                                                              	} else {
                                                                                              		tmp = re * im;
                                                                                              	}
                                                                                              	return tmp;
                                                                                              }
                                                                                              
                                                                                              def code(re, im):
                                                                                              	tmp = 0
                                                                                              	if im <= 6.2e+71:
                                                                                              		tmp = im * 1.0
                                                                                              	else:
                                                                                              		tmp = re * im
                                                                                              	return tmp
                                                                                              
                                                                                              function code(re, im)
                                                                                              	tmp = 0.0
                                                                                              	if (im <= 6.2e+71)
                                                                                              		tmp = Float64(im * 1.0);
                                                                                              	else
                                                                                              		tmp = Float64(re * im);
                                                                                              	end
                                                                                              	return tmp
                                                                                              end
                                                                                              
                                                                                              function tmp_2 = code(re, im)
                                                                                              	tmp = 0.0;
                                                                                              	if (im <= 6.2e+71)
                                                                                              		tmp = im * 1.0;
                                                                                              	else
                                                                                              		tmp = re * im;
                                                                                              	end
                                                                                              	tmp_2 = tmp;
                                                                                              end
                                                                                              
                                                                                              code[re_, im_] := If[LessEqual[im, 6.2e+71], N[(im * 1.0), $MachinePrecision], N[(re * im), $MachinePrecision]]
                                                                                              
                                                                                              \begin{array}{l}
                                                                                              
                                                                                              \\
                                                                                              \begin{array}{l}
                                                                                              \mathbf{if}\;im \leq 6.2 \cdot 10^{+71}:\\
                                                                                              \;\;\;\;im \cdot 1\\
                                                                                              
                                                                                              \mathbf{else}:\\
                                                                                              \;\;\;\;re \cdot im\\
                                                                                              
                                                                                              
                                                                                              \end{array}
                                                                                              \end{array}
                                                                                              
                                                                                              Derivation
                                                                                              1. Split input into 2 regimes
                                                                                              2. if im < 6.20000000000000036e71

                                                                                                1. Initial program 100.0%

                                                                                                  \[e^{re} \cdot \sin im \]
                                                                                                2. Add Preprocessing
                                                                                                3. Taylor expanded in im around 0

                                                                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                4. Step-by-step derivation
                                                                                                  1. lower-*.f64N/A

                                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                  2. lower-exp.f6480.6

                                                                                                    \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                                5. Applied rewrites80.6%

                                                                                                  \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                6. Taylor expanded in re around 0

                                                                                                  \[\leadsto im \cdot 1 \]
                                                                                                7. Step-by-step derivation
                                                                                                  1. Applied rewrites37.7%

                                                                                                    \[\leadsto im \cdot 1 \]

                                                                                                  if 6.20000000000000036e71 < im

                                                                                                  1. Initial program 99.9%

                                                                                                    \[e^{re} \cdot \sin im \]
                                                                                                  2. Add Preprocessing
                                                                                                  3. Taylor expanded in im around 0

                                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                  4. Step-by-step derivation
                                                                                                    1. lower-*.f64N/A

                                                                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                    2. lower-exp.f6435.1

                                                                                                      \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                                  5. Applied rewrites35.1%

                                                                                                    \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                  6. Taylor expanded in re around 0

                                                                                                    \[\leadsto im + \color{blue}{im \cdot re} \]
                                                                                                  7. Step-by-step derivation
                                                                                                    1. Applied rewrites11.7%

                                                                                                      \[\leadsto \mathsf{fma}\left(im, \color{blue}{re}, im\right) \]
                                                                                                    2. Taylor expanded in re around inf

                                                                                                      \[\leadsto im \cdot re \]
                                                                                                    3. Step-by-step derivation
                                                                                                      1. Applied rewrites12.9%

                                                                                                        \[\leadsto re \cdot im \]
                                                                                                    4. Recombined 2 regimes into one program.
                                                                                                    5. Add Preprocessing

                                                                                                    Alternative 21: 30.1% accurate, 29.4× speedup?

                                                                                                    \[\begin{array}{l} \\ \mathsf{fma}\left(im, re, im\right) \end{array} \]
                                                                                                    (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}
                                                                                                    
                                                                                                    Derivation
                                                                                                    1. Initial program 100.0%

                                                                                                      \[e^{re} \cdot \sin im \]
                                                                                                    2. Add Preprocessing
                                                                                                    3. Taylor expanded in im around 0

                                                                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                    4. Step-by-step derivation
                                                                                                      1. lower-*.f64N/A

                                                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                      2. lower-exp.f6470.1

                                                                                                        \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                                    5. Applied rewrites70.1%

                                                                                                      \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                    6. Taylor expanded in re around 0

                                                                                                      \[\leadsto im + \color{blue}{im \cdot re} \]
                                                                                                    7. Step-by-step derivation
                                                                                                      1. Applied rewrites33.3%

                                                                                                        \[\leadsto \mathsf{fma}\left(im, \color{blue}{re}, im\right) \]
                                                                                                      2. Add Preprocessing

                                                                                                      Alternative 22: 6.6% accurate, 34.3× speedup?

                                                                                                      \[\begin{array}{l} \\ re \cdot im \end{array} \]
                                                                                                      (FPCore (re im) :precision binary64 (* re im))
                                                                                                      double code(double re, double im) {
                                                                                                      	return re * im;
                                                                                                      }
                                                                                                      
                                                                                                      real(8) function code(re, im)
                                                                                                          real(8), intent (in) :: re
                                                                                                          real(8), intent (in) :: im
                                                                                                          code = re * im
                                                                                                      end function
                                                                                                      
                                                                                                      public static double code(double re, double im) {
                                                                                                      	return re * im;
                                                                                                      }
                                                                                                      
                                                                                                      def code(re, im):
                                                                                                      	return re * im
                                                                                                      
                                                                                                      function code(re, im)
                                                                                                      	return Float64(re * im)
                                                                                                      end
                                                                                                      
                                                                                                      function tmp = code(re, im)
                                                                                                      	tmp = re * im;
                                                                                                      end
                                                                                                      
                                                                                                      code[re_, im_] := N[(re * im), $MachinePrecision]
                                                                                                      
                                                                                                      \begin{array}{l}
                                                                                                      
                                                                                                      \\
                                                                                                      re \cdot im
                                                                                                      \end{array}
                                                                                                      
                                                                                                      Derivation
                                                                                                      1. Initial program 100.0%

                                                                                                        \[e^{re} \cdot \sin im \]
                                                                                                      2. Add Preprocessing
                                                                                                      3. Taylor expanded in im around 0

                                                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                      4. Step-by-step derivation
                                                                                                        1. lower-*.f64N/A

                                                                                                          \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                        2. lower-exp.f6470.1

                                                                                                          \[\leadsto im \cdot \color{blue}{e^{re}} \]
                                                                                                      5. Applied rewrites70.1%

                                                                                                        \[\leadsto \color{blue}{im \cdot e^{re}} \]
                                                                                                      6. Taylor expanded in re around 0

                                                                                                        \[\leadsto im + \color{blue}{im \cdot re} \]
                                                                                                      7. Step-by-step derivation
                                                                                                        1. Applied rewrites33.3%

                                                                                                          \[\leadsto \mathsf{fma}\left(im, \color{blue}{re}, im\right) \]
                                                                                                        2. Taylor expanded in re around inf

                                                                                                          \[\leadsto im \cdot re \]
                                                                                                        3. Step-by-step derivation
                                                                                                          1. Applied rewrites7.7%

                                                                                                            \[\leadsto re \cdot im \]
                                                                                                          2. Add Preprocessing

                                                                                                          Reproduce

                                                                                                          ?
                                                                                                          herbie shell --seed 2024233 
                                                                                                          (FPCore (re im)
                                                                                                            :name "math.exp on complex, imaginary part"
                                                                                                            :precision binary64
                                                                                                            (* (exp re) (sin im)))