math.exp on complex, imaginary part

Percentage Accurate: 100.0% → 100.0%
Time: 15.1s
Alternatives: 17
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 17 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} \\ \sin im \cdot e^{re} \end{array} \]
(FPCore (re im) :precision binary64 (* (sin im) (exp re)))
double code(double re, double im) {
	return sin(im) * exp(re);
}
real(8) function code(re, im)
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = sin(im) * exp(re)
end function
public static double code(double re, double im) {
	return Math.sin(im) * Math.exp(re);
}
def code(re, im):
	return math.sin(im) * math.exp(re)
function code(re, im)
	return Float64(sin(im) * exp(re))
end
function tmp = code(re, im)
	tmp = sin(im) * exp(re);
end
code[re_, im_] := N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\sin im \cdot e^{re}
\end{array}
Derivation
  1. Initial program 100.0%

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

    \[\leadsto \sin im \cdot e^{re} \]
  4. Add Preprocessing

Alternative 2: 86.3% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin im \cdot e^{re}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\ \mathbf{elif}\;t\_0 \leq -0.1:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-53} \lor \neg \left(t\_0 \leq 1\right):\\ \;\;\;\;im \cdot e^{re}\\ \mathbf{else}:\\ \;\;\;\;\left(1 + re\right) \cdot \sin im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin im) (exp re))))
   (if (<= t_0 (- INFINITY))
     (fma
      (fma (fma -0.16666666666666666 re -0.16666666666666666) (* im im) re)
      im
      im)
     (if (<= t_0 -0.1)
       (sin im)
       (if (or (<= t_0 5e-53) (not (<= t_0 1.0)))
         (* im (exp re))
         (* (+ 1.0 re) (sin im)))))))
double code(double re, double im) {
	double t_0 = sin(im) * exp(re);
	double tmp;
	if (t_0 <= -((double) INFINITY)) {
		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), (im * im), re), im, im);
	} else if (t_0 <= -0.1) {
		tmp = sin(im);
	} else if ((t_0 <= 5e-53) || !(t_0 <= 1.0)) {
		tmp = im * exp(re);
	} else {
		tmp = (1.0 + re) * sin(im);
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(sin(im) * exp(re))
	tmp = 0.0
	if (t_0 <= Float64(-Inf))
		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), Float64(im * im), re), im, im);
	elseif (t_0 <= -0.1)
		tmp = sin(im);
	elseif ((t_0 <= 5e-53) || !(t_0 <= 1.0))
		tmp = Float64(im * exp(re));
	else
		tmp = Float64(Float64(1.0 + re) * sin(im));
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.16666666666666666 * re + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + re), $MachinePrecision] * im + im), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Sin[im], $MachinePrecision], If[Or[LessEqual[t$95$0, 5e-53], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]], N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision], N[(N[(1.0 + re), $MachinePrecision] * N[Sin[im], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;t\_0 \leq 5 \cdot 10^{-53} \lor \neg \left(t\_0 \leq 1\right):\\
\;\;\;\;im \cdot e^{re}\\

\mathbf{else}:\\
\;\;\;\;\left(1 + re\right) \cdot \sin im\\


\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}{\sin im + re \cdot \sin im} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
      3. lower-sin.f64N/A

        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
      4. lower-sin.f645.1

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

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

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

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

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

      1. Initial program 99.9%

        \[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.1

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

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

      if -0.10000000000000001 < (*.f64 (exp.f64 re) (sin.f64 im)) < 5e-53 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. *-commutativeN/A

          \[\leadsto \color{blue}{e^{re} \cdot im} \]
        2. lower-*.f64N/A

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

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

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

      if 5e-53 < (*.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\right)} \cdot \sin im \]
      4. Step-by-step derivation
        1. lower-+.f64100.0

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

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

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

    Alternative 3: 86.2% accurate, 0.2× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin im \cdot e^{re}\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\ \mathbf{elif}\;t\_0 \leq -0.1 \lor \neg \left(t\_0 \leq 10^{-20} \lor \neg \left(t\_0 \leq 1\right)\right):\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;im \cdot e^{re}\\ \end{array} \end{array} \]
    (FPCore (re im)
     :precision binary64
     (let* ((t_0 (* (sin im) (exp re))))
       (if (<= t_0 (- INFINITY))
         (fma
          (fma (fma -0.16666666666666666 re -0.16666666666666666) (* im im) re)
          im
          im)
         (if (or (<= t_0 -0.1) (not (or (<= t_0 1e-20) (not (<= t_0 1.0)))))
           (sin im)
           (* im (exp re))))))
    double code(double re, double im) {
    	double t_0 = sin(im) * exp(re);
    	double tmp;
    	if (t_0 <= -((double) INFINITY)) {
    		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), (im * im), re), im, im);
    	} else if ((t_0 <= -0.1) || !((t_0 <= 1e-20) || !(t_0 <= 1.0))) {
    		tmp = sin(im);
    	} else {
    		tmp = im * exp(re);
    	}
    	return tmp;
    }
    
    function code(re, im)
    	t_0 = Float64(sin(im) * exp(re))
    	tmp = 0.0
    	if (t_0 <= Float64(-Inf))
    		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), Float64(im * im), re), im, im);
    	elseif ((t_0 <= -0.1) || !((t_0 <= 1e-20) || !(t_0 <= 1.0)))
    		tmp = sin(im);
    	else
    		tmp = Float64(im * exp(re));
    	end
    	return tmp
    end
    
    code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.16666666666666666 * re + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + re), $MachinePrecision] * im + im), $MachinePrecision], If[Or[LessEqual[t$95$0, -0.1], N[Not[Or[LessEqual[t$95$0, 1e-20], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]]], $MachinePrecision]], N[Sin[im], $MachinePrecision], N[(im * N[Exp[re], $MachinePrecision]), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \sin im \cdot e^{re}\\
    \mathbf{if}\;t\_0 \leq -\infty:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\
    
    \mathbf{elif}\;t\_0 \leq -0.1 \lor \neg \left(t\_0 \leq 10^{-20} \lor \neg \left(t\_0 \leq 1\right)\right):\\
    \;\;\;\;\sin im\\
    
    \mathbf{else}:\\
    \;\;\;\;im \cdot e^{re}\\
    
    
    \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}{\sin im + re \cdot \sin im} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
        2. lower-fma.f64N/A

          \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
        3. lower-sin.f64N/A

          \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
        4. lower-sin.f645.1

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

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

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

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

        if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.10000000000000001 or 9.99999999999999945e-21 < (*.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.6

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

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

        if -0.10000000000000001 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.99999999999999945e-21 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. *-commutativeN/A

            \[\leadsto \color{blue}{e^{re} \cdot im} \]
          2. lower-*.f64N/A

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

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

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

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

      Alternative 4: 63.2% accurate, 0.2× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin im \cdot e^{re}\\ t_1 := \mathsf{fma}\left(-re, re, 1\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\ \mathbf{elif}\;t\_0 \leq -0.1:\\ \;\;\;\;\sin im\\ \mathbf{elif}\;t\_0 \leq 10^{-20}:\\ \;\;\;\;{\left(\frac{\mathsf{fma}\left(\frac{re - 1}{t\_1} \cdot \mathsf{fma}\left(-0.019444444444444445, im \cdot im, -0.16666666666666666\right), im \cdot im, \frac{1 - re}{t\_1}\right)}{im}\right)}^{-1}\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin im\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (let* ((t_0 (* (sin im) (exp re))) (t_1 (fma (- re) re 1.0)))
         (if (<= t_0 (- INFINITY))
           (fma
            (fma (fma -0.16666666666666666 re -0.16666666666666666) (* im im) re)
            im
            im)
           (if (<= t_0 -0.1)
             (sin im)
             (if (<= t_0 1e-20)
               (pow
                (/
                 (fma
                  (*
                   (/ (- re 1.0) t_1)
                   (fma -0.019444444444444445 (* im im) -0.16666666666666666))
                  (* im im)
                  (/ (- 1.0 re) t_1))
                 im)
                -1.0)
               (if (<= t_0 1.0)
                 (sin im)
                 (* (* (* (fma 0.16666666666666666 re 0.5) re) re) im)))))))
      double code(double re, double im) {
      	double t_0 = sin(im) * exp(re);
      	double t_1 = fma(-re, re, 1.0);
      	double tmp;
      	if (t_0 <= -((double) INFINITY)) {
      		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), (im * im), re), im, im);
      	} else if (t_0 <= -0.1) {
      		tmp = sin(im);
      	} else if (t_0 <= 1e-20) {
      		tmp = pow((fma((((re - 1.0) / t_1) * fma(-0.019444444444444445, (im * im), -0.16666666666666666)), (im * im), ((1.0 - re) / t_1)) / im), -1.0);
      	} else if (t_0 <= 1.0) {
      		tmp = sin(im);
      	} else {
      		tmp = ((fma(0.16666666666666666, re, 0.5) * re) * re) * im;
      	}
      	return tmp;
      }
      
      function code(re, im)
      	t_0 = Float64(sin(im) * exp(re))
      	t_1 = fma(Float64(-re), re, 1.0)
      	tmp = 0.0
      	if (t_0 <= Float64(-Inf))
      		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), Float64(im * im), re), im, im);
      	elseif (t_0 <= -0.1)
      		tmp = sin(im);
      	elseif (t_0 <= 1e-20)
      		tmp = Float64(fma(Float64(Float64(Float64(re - 1.0) / t_1) * fma(-0.019444444444444445, Float64(im * im), -0.16666666666666666)), Float64(im * im), Float64(Float64(1.0 - re) / t_1)) / im) ^ -1.0;
      	elseif (t_0 <= 1.0)
      		tmp = sin(im);
      	else
      		tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * re) * re) * im);
      	end
      	return tmp
      end
      
      code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-re) * re + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(N[(-0.16666666666666666 * re + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + re), $MachinePrecision] * im + im), $MachinePrecision], If[LessEqual[t$95$0, -0.1], N[Sin[im], $MachinePrecision], If[LessEqual[t$95$0, 1e-20], N[Power[N[(N[(N[(N[(N[(re - 1.0), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(-0.019444444444444445 * N[(im * im), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(N[(1.0 - re), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / im), $MachinePrecision], -1.0], $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[Sin[im], $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * im), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \sin im \cdot e^{re}\\
      t_1 := \mathsf{fma}\left(-re, re, 1\right)\\
      \mathbf{if}\;t\_0 \leq -\infty:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\
      
      \mathbf{elif}\;t\_0 \leq -0.1:\\
      \;\;\;\;\sin im\\
      
      \mathbf{elif}\;t\_0 \leq 10^{-20}:\\
      \;\;\;\;{\left(\frac{\mathsf{fma}\left(\frac{re - 1}{t\_1} \cdot \mathsf{fma}\left(-0.019444444444444445, im \cdot im, -0.16666666666666666\right), im \cdot im, \frac{1 - re}{t\_1}\right)}{im}\right)}^{-1}\\
      
      \mathbf{elif}\;t\_0 \leq 1:\\
      \;\;\;\;\sin im\\
      
      \mathbf{else}:\\
      \;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im\\
      
      
      \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}{\sin im + re \cdot \sin im} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

            \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
          2. lower-fma.f64N/A

            \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
          3. lower-sin.f64N/A

            \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
          4. lower-sin.f645.1

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

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

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

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

          if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.10000000000000001 or 9.99999999999999945e-21 < (*.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.6

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

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

          if -0.10000000000000001 < (*.f64 (exp.f64 re) (sin.f64 im)) < 9.99999999999999945e-21

          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 + re \cdot \sin im} \]
          4. Step-by-step derivation
            1. +-commutativeN/A

              \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
            2. lower-fma.f64N/A

              \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
            3. lower-sin.f64N/A

              \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
            4. lower-sin.f6454.2

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

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

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

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

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

              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. *-commutativeN/A

                  \[\leadsto \color{blue}{e^{re} \cdot im} \]
                2. lower-*.f64N/A

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

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

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

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

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

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

                    \[\leadsto \left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im \]
                4. Recombined 4 regimes into one program.
                5. Final simplification70.7%

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

                Alternative 5: 40.3% accurate, 0.3× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin im \cdot e^{re}\\ t_1 := \mathsf{fma}\left(-re, re, 1\right)\\ \mathbf{if}\;t\_0 \leq -0.32:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\ \mathbf{elif}\;t\_0 \leq 0.5:\\ \;\;\;\;{\left(\frac{\mathsf{fma}\left(\frac{re - 1}{t\_1} \cdot \mathsf{fma}\left(-0.019444444444444445, im \cdot im, -0.16666666666666666\right), im \cdot im, \frac{1 - re}{t\_1}\right)}{im}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im\\ \end{array} \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (let* ((t_0 (* (sin im) (exp re))) (t_1 (fma (- re) re 1.0)))
                   (if (<= t_0 -0.32)
                     (fma
                      (fma (fma -0.16666666666666666 re -0.16666666666666666) (* im im) re)
                      im
                      im)
                     (if (<= t_0 0.5)
                       (pow
                        (/
                         (fma
                          (*
                           (/ (- re 1.0) t_1)
                           (fma -0.019444444444444445 (* im im) -0.16666666666666666))
                          (* im im)
                          (/ (- 1.0 re) t_1))
                         im)
                        -1.0)
                       (* (* (* (fma 0.16666666666666666 re 0.5) re) re) im)))))
                double code(double re, double im) {
                	double t_0 = sin(im) * exp(re);
                	double t_1 = fma(-re, re, 1.0);
                	double tmp;
                	if (t_0 <= -0.32) {
                		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), (im * im), re), im, im);
                	} else if (t_0 <= 0.5) {
                		tmp = pow((fma((((re - 1.0) / t_1) * fma(-0.019444444444444445, (im * im), -0.16666666666666666)), (im * im), ((1.0 - re) / t_1)) / im), -1.0);
                	} else {
                		tmp = ((fma(0.16666666666666666, re, 0.5) * re) * re) * im;
                	}
                	return tmp;
                }
                
                function code(re, im)
                	t_0 = Float64(sin(im) * exp(re))
                	t_1 = fma(Float64(-re), re, 1.0)
                	tmp = 0.0
                	if (t_0 <= -0.32)
                		tmp = fma(fma(fma(-0.16666666666666666, re, -0.16666666666666666), Float64(im * im), re), im, im);
                	elseif (t_0 <= 0.5)
                		tmp = Float64(fma(Float64(Float64(Float64(re - 1.0) / t_1) * fma(-0.019444444444444445, Float64(im * im), -0.16666666666666666)), Float64(im * im), Float64(Float64(1.0 - re) / t_1)) / im) ^ -1.0;
                	else
                		tmp = Float64(Float64(Float64(fma(0.16666666666666666, re, 0.5) * re) * re) * im);
                	end
                	return tmp
                end
                
                code[re_, im_] := Block[{t$95$0 = N[(N[Sin[im], $MachinePrecision] * N[Exp[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-re) * re + 1.0), $MachinePrecision]}, If[LessEqual[t$95$0, -0.32], N[(N[(N[(-0.16666666666666666 * re + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + re), $MachinePrecision] * im + im), $MachinePrecision], If[LessEqual[t$95$0, 0.5], N[Power[N[(N[(N[(N[(N[(re - 1.0), $MachinePrecision] / t$95$1), $MachinePrecision] * N[(-0.019444444444444445 * N[(im * im), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(N[(1.0 - re), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] / im), $MachinePrecision], -1.0], $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * im), $MachinePrecision]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := \sin im \cdot e^{re}\\
                t_1 := \mathsf{fma}\left(-re, re, 1\right)\\
                \mathbf{if}\;t\_0 \leq -0.32:\\
                \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\
                
                \mathbf{elif}\;t\_0 \leq 0.5:\\
                \;\;\;\;{\left(\frac{\mathsf{fma}\left(\frac{re - 1}{t\_1} \cdot \mathsf{fma}\left(-0.019444444444444445, im \cdot im, -0.16666666666666666\right), im \cdot im, \frac{1 - re}{t\_1}\right)}{im}\right)}^{-1}\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.320000000000000007

                  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 + re \cdot \sin im} \]
                  4. Step-by-step derivation
                    1. +-commutativeN/A

                      \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                    2. lower-fma.f64N/A

                      \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                    3. lower-sin.f64N/A

                      \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                    4. lower-sin.f6458.5

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

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

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

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

                    if -0.320000000000000007 < (*.f64 (exp.f64 re) (sin.f64 im)) < 0.5

                    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 + re \cdot \sin im} \]
                    4. Step-by-step derivation
                      1. +-commutativeN/A

                        \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                      2. lower-fma.f64N/A

                        \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                      3. lower-sin.f64N/A

                        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                      4. lower-sin.f6458.3

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

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

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

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

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

                        if 0.5 < (*.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. *-commutativeN/A

                            \[\leadsto \color{blue}{e^{re} \cdot im} \]
                          2. lower-*.f64N/A

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

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

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

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

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

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

                              \[\leadsto \left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im \]
                          4. Recombined 3 regimes into one program.
                          5. Final simplification43.1%

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

                          Alternative 6: 38.9% accurate, 0.4× speedup?

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

                            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 + re \cdot \sin im} \]
                            4. Step-by-step derivation
                              1. +-commutativeN/A

                                \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                              2. lower-fma.f64N/A

                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                              3. lower-sin.f64N/A

                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                              4. lower-sin.f6461.7

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

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

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

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

                              if -0.10000000000000001 < (*.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 + re \cdot \sin im} \]
                              4. Step-by-step derivation
                                1. +-commutativeN/A

                                  \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                2. lower-fma.f64N/A

                                  \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                3. lower-sin.f64N/A

                                  \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                4. lower-sin.f6438.7

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

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

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

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

                                    \[\leadsto \frac{1}{\frac{\mathsf{fma}\left(0.16666666666666666, im \cdot im, 1\right) \cdot \frac{1 - re}{\mathsf{fma}\left(-re, re, 1\right)}}{\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. *-commutativeN/A

                                      \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                    2. lower-*.f64N/A

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

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

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

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

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

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

                                  Alternative 7: 36.9% accurate, 0.5× speedup?

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

                                    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 + re \cdot \sin im} \]
                                    4. Step-by-step derivation
                                      1. +-commutativeN/A

                                        \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                      2. lower-fma.f64N/A

                                        \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                      3. lower-sin.f64N/A

                                        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                      4. lower-sin.f6461.7

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

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

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

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

                                      if -0.10000000000000001 < (*.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 + re \cdot \sin im} \]
                                      4. Step-by-step derivation
                                        1. +-commutativeN/A

                                          \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                        2. lower-fma.f64N/A

                                          \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                        3. lower-sin.f64N/A

                                          \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                        4. lower-sin.f6438.7

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

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

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

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

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

                                          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. *-commutativeN/A

                                              \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                            2. lower-*.f64N/A

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

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

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

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

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

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

                                          Alternative 8: 35.9% accurate, 0.9× speedup?

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

                                            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 + re \cdot \sin im} \]
                                            4. Step-by-step derivation
                                              1. +-commutativeN/A

                                                \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                              2. lower-fma.f64N/A

                                                \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                              3. lower-sin.f64N/A

                                                \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                              4. lower-sin.f6456.5

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

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

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

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

                                              if 2e-3 < (*.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. *-commutativeN/A

                                                  \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                2. lower-*.f64N/A

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

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

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

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

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

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

                                              Alternative 9: 35.9% accurate, 0.9× speedup?

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

                                                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 + re \cdot \sin im} \]
                                                4. Step-by-step derivation
                                                  1. +-commutativeN/A

                                                    \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                                  2. lower-fma.f64N/A

                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                                  3. lower-sin.f64N/A

                                                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                                  4. lower-sin.f6456.5

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

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

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

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

                                                  if 2e-3 < (*.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. *-commutativeN/A

                                                      \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                    2. lower-*.f64N/A

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

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

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

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

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

                                                      \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot {re}^{2}, re, 1\right) \cdot im \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites22.6%

                                                        \[\leadsto \mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im \]
                                                    4. Recombined 2 regimes into one program.
                                                    5. Final simplification37.2%

                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\sin im \cdot e^{re} \leq 0.002:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.16666666666666666, re, -0.16666666666666666\right), im \cdot im, re\right), im, im\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im\\ \end{array} \]
                                                    6. Add Preprocessing

                                                    Alternative 10: 37.5% accurate, 0.9× speedup?

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

                                                          \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                        2. lower-*.f64N/A

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

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

                                                        \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                      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 rewrites40.4%

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

                                                        if 0.5 < (*.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. *-commutativeN/A

                                                            \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                          2. lower-*.f64N/A

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

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

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

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

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

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

                                                              \[\leadsto \left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im \]
                                                          4. Recombined 2 regimes into one program.
                                                          5. Final simplification36.6%

                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\sin im \cdot e^{re} \leq 0.5:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 0.5, im\right), re, im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right) \cdot re\right) \cdot re\right) \cdot im\\ \end{array} \]
                                                          6. Add Preprocessing

                                                          Alternative 11: 36.3% accurate, 0.9× speedup?

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

                                                                \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                              2. lower-*.f64N/A

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

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

                                                              \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                            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 rewrites40.4%

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

                                                              if 0.5 < (*.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. *-commutativeN/A

                                                                  \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                2. lower-*.f64N/A

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

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

                                                                \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                              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 rewrites16.3%

                                                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(re \cdot im, 0.5, im\right), \color{blue}{re}, 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 rewrites21.1%

                                                                    \[\leadsto \left(\left(re \cdot re\right) \cdot im\right) \cdot 0.5 \]
                                                                4. Recombined 2 regimes into one program.
                                                                5. Final simplification35.5%

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\sin im \cdot e^{re} \leq 0.5:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 0.5, im\right), re, im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.5\\ \end{array} \]
                                                                6. Add Preprocessing

                                                                Alternative 12: 34.1% accurate, 0.9× speedup?

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

                                                                      \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                    2. lower-*.f64N/A

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

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

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

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

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

                                                                    if 0.5 < (*.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. *-commutativeN/A

                                                                        \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                      2. lower-*.f64N/A

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

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

                                                                      \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                    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 rewrites16.3%

                                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(re \cdot im, 0.5, im\right), \color{blue}{re}, 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 rewrites21.1%

                                                                          \[\leadsto \left(\left(re \cdot re\right) \cdot im\right) \cdot 0.5 \]
                                                                      4. Recombined 2 regimes into one program.
                                                                      5. Final simplification35.0%

                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;\sin im \cdot e^{re} \leq 0.5:\\ \;\;\;\;\mathsf{fma}\left(re, im, im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.5\\ \end{array} \]
                                                                      6. Add Preprocessing

                                                                      Alternative 13: 39.8% accurate, 9.4× speedup?

                                                                      \[\begin{array}{l} \\ \mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im \end{array} \]
                                                                      (FPCore (re im)
                                                                       :precision binary64
                                                                       (* (fma (* (* re re) 0.16666666666666666) re 1.0) im))
                                                                      double code(double re, double im) {
                                                                      	return fma(((re * re) * 0.16666666666666666), re, 1.0) * im;
                                                                      }
                                                                      
                                                                      function code(re, im)
                                                                      	return Float64(fma(Float64(Float64(re * re) * 0.16666666666666666), re, 1.0) * im)
                                                                      end
                                                                      
                                                                      code[re_, im_] := N[(N[(N[(N[(re * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \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. *-commutativeN/A

                                                                          \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                        2. lower-*.f64N/A

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

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

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

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

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

                                                                          \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot {re}^{2}, re, 1\right) \cdot im \]
                                                                        3. Step-by-step derivation
                                                                          1. Applied rewrites37.5%

                                                                            \[\leadsto \mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im \]
                                                                          2. Add Preprocessing

                                                                          Alternative 14: 37.8% accurate, 11.4× speedup?

                                                                          \[\begin{array}{l} \\ \mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot im \end{array} \]
                                                                          (FPCore (re im) :precision binary64 (* (fma (fma 0.5 re 1.0) re 1.0) im))
                                                                          double code(double re, double im) {
                                                                          	return fma(fma(0.5, re, 1.0), re, 1.0) * im;
                                                                          }
                                                                          
                                                                          function code(re, im)
                                                                          	return Float64(fma(fma(0.5, re, 1.0), re, 1.0) * im)
                                                                          end
                                                                          
                                                                          code[re_, im_] := N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          \mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \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. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                            2. lower-*.f64N/A

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

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

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

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

                                                                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot im \]
                                                                            2. Add Preprocessing

                                                                            Alternative 15: 28.7% accurate, 17.1× speedup?

                                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 1.15 \cdot 10^{+29}:\\ \;\;\;\;1 \cdot im\\ \mathbf{else}:\\ \;\;\;\;im \cdot re\\ \end{array} \end{array} \]
                                                                            (FPCore (re im) :precision binary64 (if (<= im 1.15e+29) (* 1.0 im) (* im re)))
                                                                            double code(double re, double im) {
                                                                            	double tmp;
                                                                            	if (im <= 1.15e+29) {
                                                                            		tmp = 1.0 * im;
                                                                            	} else {
                                                                            		tmp = im * re;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            real(8) function code(re, im)
                                                                                real(8), intent (in) :: re
                                                                                real(8), intent (in) :: im
                                                                                real(8) :: tmp
                                                                                if (im <= 1.15d+29) then
                                                                                    tmp = 1.0d0 * im
                                                                                else
                                                                                    tmp = im * re
                                                                                end if
                                                                                code = tmp
                                                                            end function
                                                                            
                                                                            public static double code(double re, double im) {
                                                                            	double tmp;
                                                                            	if (im <= 1.15e+29) {
                                                                            		tmp = 1.0 * im;
                                                                            	} else {
                                                                            		tmp = im * re;
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            def code(re, im):
                                                                            	tmp = 0
                                                                            	if im <= 1.15e+29:
                                                                            		tmp = 1.0 * im
                                                                            	else:
                                                                            		tmp = im * re
                                                                            	return tmp
                                                                            
                                                                            function code(re, im)
                                                                            	tmp = 0.0
                                                                            	if (im <= 1.15e+29)
                                                                            		tmp = Float64(1.0 * im);
                                                                            	else
                                                                            		tmp = Float64(im * re);
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            function tmp_2 = code(re, im)
                                                                            	tmp = 0.0;
                                                                            	if (im <= 1.15e+29)
                                                                            		tmp = 1.0 * im;
                                                                            	else
                                                                            		tmp = im * re;
                                                                            	end
                                                                            	tmp_2 = tmp;
                                                                            end
                                                                            
                                                                            code[re_, im_] := If[LessEqual[im, 1.15e+29], N[(1.0 * im), $MachinePrecision], N[(im * re), $MachinePrecision]]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            \begin{array}{l}
                                                                            \mathbf{if}\;im \leq 1.15 \cdot 10^{+29}:\\
                                                                            \;\;\;\;1 \cdot im\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;im \cdot re\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 2 regimes
                                                                            2. if im < 1.1500000000000001e29

                                                                              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. *-commutativeN/A

                                                                                  \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                                2. lower-*.f64N/A

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

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

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

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

                                                                                  \[\leadsto 1 \cdot im \]

                                                                                if 1.1500000000000001e29 < im

                                                                                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 + re \cdot \sin im} \]
                                                                                4. Step-by-step derivation
                                                                                  1. +-commutativeN/A

                                                                                    \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                                                                  2. lower-fma.f64N/A

                                                                                    \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                                                                  3. lower-sin.f64N/A

                                                                                    \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                                                                  4. lower-sin.f6453.4

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

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

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

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

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

                                                                                      \[\leadsto re \cdot im \]
                                                                                  4. Recombined 2 regimes into one program.
                                                                                  5. Final simplification29.1%

                                                                                    \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 1.15 \cdot 10^{+29}:\\ \;\;\;\;1 \cdot im\\ \mathbf{else}:\\ \;\;\;\;im \cdot re\\ \end{array} \]
                                                                                  6. Add Preprocessing

                                                                                  Alternative 16: 30.4% accurate, 29.4× speedup?

                                                                                  \[\begin{array}{l} \\ \mathsf{fma}\left(re, im, im\right) \end{array} \]
                                                                                  (FPCore (re im) :precision binary64 (fma re im im))
                                                                                  double code(double re, double im) {
                                                                                  	return fma(re, im, im);
                                                                                  }
                                                                                  
                                                                                  function code(re, im)
                                                                                  	return fma(re, im, im)
                                                                                  end
                                                                                  
                                                                                  code[re_, im_] := N[(re * im + im), $MachinePrecision]
                                                                                  
                                                                                  \begin{array}{l}
                                                                                  
                                                                                  \\
                                                                                  \mathsf{fma}\left(re, im, 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. *-commutativeN/A

                                                                                      \[\leadsto \color{blue}{e^{re} \cdot im} \]
                                                                                    2. lower-*.f64N/A

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

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

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

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

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

                                                                                    Alternative 17: 7.2% accurate, 34.3× speedup?

                                                                                    \[\begin{array}{l} \\ im \cdot re \end{array} \]
                                                                                    (FPCore (re im) :precision binary64 (* im re))
                                                                                    double code(double re, double im) {
                                                                                    	return im * re;
                                                                                    }
                                                                                    
                                                                                    real(8) function code(re, im)
                                                                                        real(8), intent (in) :: re
                                                                                        real(8), intent (in) :: im
                                                                                        code = im * re
                                                                                    end function
                                                                                    
                                                                                    public static double code(double re, double im) {
                                                                                    	return im * re;
                                                                                    }
                                                                                    
                                                                                    def code(re, im):
                                                                                    	return im * re
                                                                                    
                                                                                    function code(re, im)
                                                                                    	return Float64(im * re)
                                                                                    end
                                                                                    
                                                                                    function tmp = code(re, im)
                                                                                    	tmp = im * re;
                                                                                    end
                                                                                    
                                                                                    code[re_, im_] := N[(im * re), $MachinePrecision]
                                                                                    
                                                                                    \begin{array}{l}
                                                                                    
                                                                                    \\
                                                                                    im \cdot re
                                                                                    \end{array}
                                                                                    
                                                                                    Derivation
                                                                                    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 + re \cdot \sin im} \]
                                                                                    4. Step-by-step derivation
                                                                                      1. +-commutativeN/A

                                                                                        \[\leadsto \color{blue}{re \cdot \sin im + \sin im} \]
                                                                                      2. lower-fma.f64N/A

                                                                                        \[\leadsto \color{blue}{\mathsf{fma}\left(re, \sin im, \sin im\right)} \]
                                                                                      3. lower-sin.f64N/A

                                                                                        \[\leadsto \mathsf{fma}\left(re, \color{blue}{\sin im}, \sin im\right) \]
                                                                                      4. lower-sin.f6457.4

                                                                                        \[\leadsto \mathsf{fma}\left(re, \sin im, \color{blue}{\sin im}\right) \]
                                                                                    5. Applied rewrites57.4%

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

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

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

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

                                                                                          \[\leadsto re \cdot im \]
                                                                                        2. Final simplification6.6%

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

                                                                                        Reproduce

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