math.exp on complex, imaginary part

Percentage Accurate: 100.0% → 98.5%
Time: 7.3s
Alternatives: 18
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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(re, im)
use fmin_fmax_functions
    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 18 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);
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(re, im)
use fmin_fmax_functions
    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: 98.5% accurate, 0.2× speedup?

\[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ t_1 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \mathbf{elif}\;t\_1 \leq -0.04:\\ \;\;\;\;\frac{\sin im\_m}{\mathsf{fma}\left(-4, re, 4\right)} \cdot 4\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right):\\ \;\;\;\;e^{re} \cdot im\_m\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\ \end{array} \end{array} \end{array} \]
im\_m = (fabs.f64 im)
im\_s = (copysign.f64 #s(literal 1 binary64) im)
(FPCore (im_s re im_m)
 :precision binary64
 (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0))
        (t_1 (* (exp re) (sin im_m))))
   (*
    im_s
    (if (<= t_1 (- INFINITY))
      (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
      (if (<= t_1 -0.04)
        (* (/ (sin im_m) (fma -4.0 re 4.0)) 4.0)
        (if (or (<= t_1 2e-154) (not (<= t_1 1.0)))
          (* (exp re) im_m)
          (* (fma (fma 0.5 re 1.0) re 1.0) (sin im_m))))))))
im\_m = fabs(im);
im\_s = copysign(1.0, im);
double code(double im_s, double re, double im_m) {
	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
	double t_1 = exp(re) * sin(im_m);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
	} else if (t_1 <= -0.04) {
		tmp = (sin(im_m) / fma(-4.0, re, 4.0)) * 4.0;
	} else if ((t_1 <= 2e-154) || !(t_1 <= 1.0)) {
		tmp = exp(re) * im_m;
	} else {
		tmp = fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m);
	}
	return im_s * tmp;
}
im\_m = abs(im)
im\_s = copysign(1.0, im)
function code(im_s, re, im_m)
	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
	t_1 = Float64(exp(re) * sin(im_m))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
	elseif (t_1 <= -0.04)
		tmp = Float64(Float64(sin(im_m) / fma(-4.0, re, 4.0)) * 4.0);
	elseif ((t_1 <= 2e-154) || !(t_1 <= 1.0))
		tmp = Float64(exp(re) * im_m);
	else
		tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m));
	end
	return Float64(im_s * tmp)
end
im\_m = N[Abs[im], $MachinePrecision]
im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], If[LessEqual[t$95$1, -0.04], N[(N[(N[Sin[im$95$m], $MachinePrecision] / N[(-4.0 * re + 4.0), $MachinePrecision]), $MachinePrecision] * 4.0), $MachinePrecision], If[Or[LessEqual[t$95$1, 2e-154], N[Not[LessEqual[t$95$1, 1.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im$95$m), $MachinePrecision], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
\begin{array}{l}
im\_m = \left|im\right|
\\
im\_s = \mathsf{copysign}\left(1, im\right)

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

\mathbf{elif}\;t\_1 \leq -0.04:\\
\;\;\;\;\frac{\sin im\_m}{\mathsf{fma}\left(-4, re, 4\right)} \cdot 4\\

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right):\\
\;\;\;\;e^{re} \cdot im\_m\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\


\end{array}
\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} \]
    4. Step-by-step derivation
      1. lower-sin.f642.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
      15. lower-exp.f6472.0

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

      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
    9. Taylor expanded in re around 0

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

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

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

      1. Initial program 100.0%

        \[e^{re} \cdot \sin im \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-*.f64N/A

          \[\leadsto \color{blue}{e^{re} \cdot \sin im} \]
        2. lift-exp.f64N/A

          \[\leadsto \color{blue}{e^{re}} \cdot \sin im \]
        3. sinh-+-cosh-revN/A

          \[\leadsto \color{blue}{\left(\cosh re + \sinh re\right)} \cdot \sin im \]
        4. flip-+N/A

          \[\leadsto \color{blue}{\frac{\cosh re \cdot \cosh re - \sinh re \cdot \sinh re}{\cosh re - \sinh re}} \cdot \sin im \]
        5. sinh---cosh-revN/A

          \[\leadsto \frac{\cosh re \cdot \cosh re - \sinh re \cdot \sinh re}{\color{blue}{e^{\mathsf{neg}\left(re\right)}}} \cdot \sin im \]
        6. associate-*l/N/A

          \[\leadsto \color{blue}{\frac{\left(\cosh re \cdot \cosh re - \sinh re \cdot \sinh re\right) \cdot \sin im}{e^{\mathsf{neg}\left(re\right)}}} \]
        7. sinh-coshN/A

          \[\leadsto \frac{\color{blue}{1} \cdot \sin im}{e^{\mathsf{neg}\left(re\right)}} \]
        8. *-lft-identityN/A

          \[\leadsto \frac{\color{blue}{\sin im}}{e^{\mathsf{neg}\left(re\right)}} \]
        9. sinh---cosh-revN/A

          \[\leadsto \frac{\sin im}{\color{blue}{\cosh re - \sinh re}} \]
        10. cosh-defN/A

          \[\leadsto \frac{\sin im}{\color{blue}{\frac{e^{re} + e^{\mathsf{neg}\left(re\right)}}{2}} - \sinh re} \]
        11. sinh-defN/A

          \[\leadsto \frac{\sin im}{\frac{e^{re} + e^{\mathsf{neg}\left(re\right)}}{2} - \color{blue}{\frac{e^{re} - e^{\mathsf{neg}\left(re\right)}}{2}}} \]
        12. frac-subN/A

          \[\leadsto \frac{\sin im}{\color{blue}{\frac{\left(e^{re} + e^{\mathsf{neg}\left(re\right)}\right) \cdot 2 - 2 \cdot \left(e^{re} - e^{\mathsf{neg}\left(re\right)}\right)}{2 \cdot 2}}} \]
        13. associate-/r/N/A

          \[\leadsto \color{blue}{\frac{\sin im}{\left(e^{re} + e^{\mathsf{neg}\left(re\right)}\right) \cdot 2 - 2 \cdot \left(e^{re} - e^{\mathsf{neg}\left(re\right)}\right)} \cdot \left(2 \cdot 2\right)} \]
        14. lower-*.f64N/A

          \[\leadsto \color{blue}{\frac{\sin im}{\left(e^{re} + e^{\mathsf{neg}\left(re\right)}\right) \cdot 2 - 2 \cdot \left(e^{re} - e^{\mathsf{neg}\left(re\right)}\right)} \cdot \left(2 \cdot 2\right)} \]
      4. Applied rewrites99.9%

        \[\leadsto \color{blue}{\frac{\sin im}{4 \cdot \cosh re - 4 \cdot \sinh re} \cdot 4} \]
      5. Taylor expanded in re around 0

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

          \[\leadsto \frac{\sin im}{\color{blue}{-4 \cdot re + 4}} \cdot 4 \]
        2. lower-fma.f6499.3

          \[\leadsto \frac{\sin im}{\color{blue}{\mathsf{fma}\left(-4, re, 4\right)}} \cdot 4 \]
      7. Applied rewrites99.3%

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

      if -0.0400000000000000008 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154 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.2

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

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

      if 1.9999999999999999e-154 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

      1. Initial program 100.0%

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

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

          \[\leadsto \color{blue}{\left(1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
        2. fp-cancel-sub-sign-invN/A

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

          \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right)\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
        4. distribute-lft-neg-outN/A

          \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)\right)} + 1\right) \cdot \sin im \]
        5. distribute-lft-neg-outN/A

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

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
        7. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
        8. *-rgt-identityN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{re} - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)\right)\right)\right)\right) + 1\right) \cdot \sin im \]
        9. fp-cancel-sign-sub-invN/A

          \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
        10. remove-double-negN/A

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

          \[\leadsto \left(\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right) + \color{blue}{\left(0 + 1\right)}\right) \cdot \sin im \]
        12. associate-+r+N/A

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

        \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right)} \cdot \sin im \]
    11. Recombined 4 regimes into one program.
    12. Final simplification91.0%

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

    Alternative 2: 98.5% accurate, 0.2× speedup?

    \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ t_1 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \mathbf{elif}\;t\_1 \leq -0.04:\\ \;\;\;\;\left(1 + re\right) \cdot \sin im\_m\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right):\\ \;\;\;\;e^{re} \cdot im\_m\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\ \end{array} \end{array} \end{array} \]
    im\_m = (fabs.f64 im)
    im\_s = (copysign.f64 #s(literal 1 binary64) im)
    (FPCore (im_s re im_m)
     :precision binary64
     (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0))
            (t_1 (* (exp re) (sin im_m))))
       (*
        im_s
        (if (<= t_1 (- INFINITY))
          (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
          (if (<= t_1 -0.04)
            (* (+ 1.0 re) (sin im_m))
            (if (or (<= t_1 2e-154) (not (<= t_1 1.0)))
              (* (exp re) im_m)
              (* (fma (fma 0.5 re 1.0) re 1.0) (sin im_m))))))))
    im\_m = fabs(im);
    im\_s = copysign(1.0, im);
    double code(double im_s, double re, double im_m) {
    	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
    	double t_1 = exp(re) * sin(im_m);
    	double tmp;
    	if (t_1 <= -((double) INFINITY)) {
    		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
    	} else if (t_1 <= -0.04) {
    		tmp = (1.0 + re) * sin(im_m);
    	} else if ((t_1 <= 2e-154) || !(t_1 <= 1.0)) {
    		tmp = exp(re) * im_m;
    	} else {
    		tmp = fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m);
    	}
    	return im_s * tmp;
    }
    
    im\_m = abs(im)
    im\_s = copysign(1.0, im)
    function code(im_s, re, im_m)
    	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
    	t_1 = Float64(exp(re) * sin(im_m))
    	tmp = 0.0
    	if (t_1 <= Float64(-Inf))
    		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
    	elseif (t_1 <= -0.04)
    		tmp = Float64(Float64(1.0 + re) * sin(im_m));
    	elseif ((t_1 <= 2e-154) || !(t_1 <= 1.0))
    		tmp = Float64(exp(re) * im_m);
    	else
    		tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m));
    	end
    	return Float64(im_s * tmp)
    end
    
    im\_m = N[Abs[im], $MachinePrecision]
    im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
    code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], If[LessEqual[t$95$1, -0.04], N[(N[(1.0 + re), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$1, 2e-154], N[Not[LessEqual[t$95$1, 1.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im$95$m), $MachinePrecision], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]]]]), $MachinePrecision]]]
    
    \begin{array}{l}
    im\_m = \left|im\right|
    \\
    im\_s = \mathsf{copysign}\left(1, im\right)
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\
    t_1 := e^{re} \cdot \sin im\_m\\
    im\_s \cdot \begin{array}{l}
    \mathbf{if}\;t\_1 \leq -\infty:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\
    
    \mathbf{elif}\;t\_1 \leq -0.04:\\
    \;\;\;\;\left(1 + re\right) \cdot \sin im\_m\\
    
    \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right):\\
    \;\;\;\;e^{re} \cdot im\_m\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\
    
    
    \end{array}
    \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} \]
      4. Step-by-step derivation
        1. lower-sin.f642.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
        15. lower-exp.f6472.0

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

        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
      9. Taylor expanded in re around 0

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

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

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

        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-+.f6499.3

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

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

        if -0.0400000000000000008 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154 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.2

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

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

        if 1.9999999999999999e-154 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

        1. Initial program 100.0%

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

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

            \[\leadsto \color{blue}{\left(1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
          2. fp-cancel-sub-sign-invN/A

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

            \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right)\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
          4. distribute-lft-neg-outN/A

            \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)\right)} + 1\right) \cdot \sin im \]
          5. distribute-lft-neg-outN/A

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

            \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
          7. fp-cancel-sign-sub-invN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
          8. *-rgt-identityN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{re} - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)\right)\right)\right)\right) + 1\right) \cdot \sin im \]
          9. fp-cancel-sign-sub-invN/A

            \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
          10. remove-double-negN/A

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

            \[\leadsto \left(\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right) + \color{blue}{\left(0 + 1\right)}\right) \cdot \sin im \]
          12. associate-+r+N/A

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

          \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right)} \cdot \sin im \]
      11. Recombined 4 regimes into one program.
      12. Final simplification91.0%

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

      Alternative 3: 98.4% accurate, 0.2× speedup?

      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ t_1 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \mathbf{elif}\;t\_1 \leq -0.04 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right)\right):\\ \;\;\;\;\left(1 + re\right) \cdot \sin im\_m\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\_m\\ \end{array} \end{array} \end{array} \]
      im\_m = (fabs.f64 im)
      im\_s = (copysign.f64 #s(literal 1 binary64) im)
      (FPCore (im_s re im_m)
       :precision binary64
       (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0))
              (t_1 (* (exp re) (sin im_m))))
         (*
          im_s
          (if (<= t_1 (- INFINITY))
            (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
            (if (or (<= t_1 -0.04) (not (or (<= t_1 2e-154) (not (<= t_1 1.0)))))
              (* (+ 1.0 re) (sin im_m))
              (* (exp re) im_m))))))
      im\_m = fabs(im);
      im\_s = copysign(1.0, im);
      double code(double im_s, double re, double im_m) {
      	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
      	double t_1 = exp(re) * sin(im_m);
      	double tmp;
      	if (t_1 <= -((double) INFINITY)) {
      		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
      	} else if ((t_1 <= -0.04) || !((t_1 <= 2e-154) || !(t_1 <= 1.0))) {
      		tmp = (1.0 + re) * sin(im_m);
      	} else {
      		tmp = exp(re) * im_m;
      	}
      	return im_s * tmp;
      }
      
      im\_m = abs(im)
      im\_s = copysign(1.0, im)
      function code(im_s, re, im_m)
      	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
      	t_1 = Float64(exp(re) * sin(im_m))
      	tmp = 0.0
      	if (t_1 <= Float64(-Inf))
      		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
      	elseif ((t_1 <= -0.04) || !((t_1 <= 2e-154) || !(t_1 <= 1.0)))
      		tmp = Float64(Float64(1.0 + re) * sin(im_m));
      	else
      		tmp = Float64(exp(re) * im_m);
      	end
      	return Float64(im_s * tmp)
      end
      
      im\_m = N[Abs[im], $MachinePrecision]
      im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
      code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], If[Or[LessEqual[t$95$1, -0.04], N[Not[Or[LessEqual[t$95$1, 2e-154], N[Not[LessEqual[t$95$1, 1.0]], $MachinePrecision]]], $MachinePrecision]], N[(N[(1.0 + re), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * im$95$m), $MachinePrecision]]]), $MachinePrecision]]]
      
      \begin{array}{l}
      im\_m = \left|im\right|
      \\
      im\_s = \mathsf{copysign}\left(1, im\right)
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\
      t_1 := e^{re} \cdot \sin im\_m\\
      im\_s \cdot \begin{array}{l}
      \mathbf{if}\;t\_1 \leq -\infty:\\
      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\
      
      \mathbf{elif}\;t\_1 \leq -0.04 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right)\right):\\
      \;\;\;\;\left(1 + re\right) \cdot \sin im\_m\\
      
      \mathbf{else}:\\
      \;\;\;\;e^{re} \cdot im\_m\\
      
      
      \end{array}
      \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} \]
        4. Step-by-step derivation
          1. lower-sin.f642.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
          15. lower-exp.f6472.0

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

          \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
        9. Taylor expanded in re around 0

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

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

          if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0400000000000000008 or 1.9999999999999999e-154 < (*.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-+.f6499.7

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

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

          if -0.0400000000000000008 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154 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.2

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

            \[\leadsto \color{blue}{e^{re} \cdot im} \]
        11. Recombined 3 regimes into one program.
        12. Final simplification91.0%

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

        Alternative 4: 98.0% accurate, 0.2× speedup?

        \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ t_1 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \mathbf{elif}\;t\_1 \leq -0.04 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right)\right):\\ \;\;\;\;\sin im\_m\\ \mathbf{else}:\\ \;\;\;\;e^{re} \cdot im\_m\\ \end{array} \end{array} \end{array} \]
        im\_m = (fabs.f64 im)
        im\_s = (copysign.f64 #s(literal 1 binary64) im)
        (FPCore (im_s re im_m)
         :precision binary64
         (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0))
                (t_1 (* (exp re) (sin im_m))))
           (*
            im_s
            (if (<= t_1 (- INFINITY))
              (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
              (if (or (<= t_1 -0.04) (not (or (<= t_1 2e-154) (not (<= t_1 1.0)))))
                (sin im_m)
                (* (exp re) im_m))))))
        im\_m = fabs(im);
        im\_s = copysign(1.0, im);
        double code(double im_s, double re, double im_m) {
        	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
        	double t_1 = exp(re) * sin(im_m);
        	double tmp;
        	if (t_1 <= -((double) INFINITY)) {
        		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
        	} else if ((t_1 <= -0.04) || !((t_1 <= 2e-154) || !(t_1 <= 1.0))) {
        		tmp = sin(im_m);
        	} else {
        		tmp = exp(re) * im_m;
        	}
        	return im_s * tmp;
        }
        
        im\_m = abs(im)
        im\_s = copysign(1.0, im)
        function code(im_s, re, im_m)
        	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
        	t_1 = Float64(exp(re) * sin(im_m))
        	tmp = 0.0
        	if (t_1 <= Float64(-Inf))
        		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
        	elseif ((t_1 <= -0.04) || !((t_1 <= 2e-154) || !(t_1 <= 1.0)))
        		tmp = sin(im_m);
        	else
        		tmp = Float64(exp(re) * im_m);
        	end
        	return Float64(im_s * tmp)
        end
        
        im\_m = N[Abs[im], $MachinePrecision]
        im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
        code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], If[Or[LessEqual[t$95$1, -0.04], N[Not[Or[LessEqual[t$95$1, 2e-154], N[Not[LessEqual[t$95$1, 1.0]], $MachinePrecision]]], $MachinePrecision]], N[Sin[im$95$m], $MachinePrecision], N[(N[Exp[re], $MachinePrecision] * im$95$m), $MachinePrecision]]]), $MachinePrecision]]]
        
        \begin{array}{l}
        im\_m = \left|im\right|
        \\
        im\_s = \mathsf{copysign}\left(1, im\right)
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\
        t_1 := e^{re} \cdot \sin im\_m\\
        im\_s \cdot \begin{array}{l}
        \mathbf{if}\;t\_1 \leq -\infty:\\
        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\
        
        \mathbf{elif}\;t\_1 \leq -0.04 \lor \neg \left(t\_1 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_1 \leq 1\right)\right):\\
        \;\;\;\;\sin im\_m\\
        
        \mathbf{else}:\\
        \;\;\;\;e^{re} \cdot im\_m\\
        
        
        \end{array}
        \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} \]
          4. Step-by-step derivation
            1. lower-sin.f642.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
            15. lower-exp.f6472.0

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

            \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
          9. Taylor expanded in re around 0

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

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

            if -inf.0 < (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0400000000000000008 or 1.9999999999999999e-154 < (*.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.0

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

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

            if -0.0400000000000000008 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154 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.2

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

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

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

          Alternative 5: 97.2% accurate, 0.3× speedup?

          \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_0 \leq -0.04:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \sin im\_m\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_0 \leq 1\right):\\ \;\;\;\;e^{re} \cdot im\_m\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\ \end{array} \end{array} \end{array} \]
          im\_m = (fabs.f64 im)
          im\_s = (copysign.f64 #s(literal 1 binary64) im)
          (FPCore (im_s re im_m)
           :precision binary64
           (let* ((t_0 (* (exp re) (sin im_m))))
             (*
              im_s
              (if (<= t_0 -0.04)
                (* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) (sin im_m))
                (if (or (<= t_0 2e-154) (not (<= t_0 1.0)))
                  (* (exp re) im_m)
                  (* (fma (fma 0.5 re 1.0) re 1.0) (sin im_m)))))))
          im\_m = fabs(im);
          im\_s = copysign(1.0, im);
          double code(double im_s, double re, double im_m) {
          	double t_0 = exp(re) * sin(im_m);
          	double tmp;
          	if (t_0 <= -0.04) {
          		tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im_m);
          	} else if ((t_0 <= 2e-154) || !(t_0 <= 1.0)) {
          		tmp = exp(re) * im_m;
          	} else {
          		tmp = fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m);
          	}
          	return im_s * tmp;
          }
          
          im\_m = abs(im)
          im\_s = copysign(1.0, im)
          function code(im_s, re, im_m)
          	t_0 = Float64(exp(re) * sin(im_m))
          	tmp = 0.0
          	if (t_0 <= -0.04)
          		tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * sin(im_m));
          	elseif ((t_0 <= 2e-154) || !(t_0 <= 1.0))
          		tmp = Float64(exp(re) * im_m);
          	else
          		tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * sin(im_m));
          	end
          	return Float64(im_s * tmp)
          end
          
          im\_m = N[Abs[im], $MachinePrecision]
          im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
          code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$0, -0.04], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[t$95$0, 2e-154], N[Not[LessEqual[t$95$0, 1.0]], $MachinePrecision]], N[(N[Exp[re], $MachinePrecision] * im$95$m), $MachinePrecision], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]
          
          \begin{array}{l}
          im\_m = \left|im\right|
          \\
          im\_s = \mathsf{copysign}\left(1, im\right)
          
          \\
          \begin{array}{l}
          t_0 := e^{re} \cdot \sin im\_m\\
          im\_s \cdot \begin{array}{l}
          \mathbf{if}\;t\_0 \leq -0.04:\\
          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, re, 0.5\right), re, 1\right), re, 1\right) \cdot \sin im\_m\\
          
          \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-154} \lor \neg \left(t\_0 \leq 1\right):\\
          \;\;\;\;e^{re} \cdot im\_m\\
          
          \mathbf{else}:\\
          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot \sin im\_m\\
          
          
          \end{array}
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if (*.f64 (exp.f64 re) (sin.f64 im)) < -0.0400000000000000008

            1. Initial program 100.0%

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

              \[\leadsto \color{blue}{\left(1 + re \cdot \left(1 + re \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot re\right)\right)\right)} \cdot \sin im \]
            4. Applied rewrites88.6%

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

            if -0.0400000000000000008 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154 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.2

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

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

            if 1.9999999999999999e-154 < (*.f64 (exp.f64 re) (sin.f64 im)) < 1

            1. Initial program 100.0%

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

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

                \[\leadsto \color{blue}{\left(1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)} \cdot \sin im \]
              2. fp-cancel-sub-sign-invN/A

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

                \[\leadsto \color{blue}{\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right)\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right) + 1\right)} \cdot \sin im \]
              4. distribute-lft-neg-outN/A

                \[\leadsto \left(\color{blue}{\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(re\right)\right) \cdot \left(1 + \frac{1}{2} \cdot re\right)\right)\right)} + 1\right) \cdot \sin im \]
              5. distribute-lft-neg-outN/A

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

                \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
              7. fp-cancel-sign-sub-invN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re \cdot 1 - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
              8. *-rgt-identityN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\color{blue}{re} - \left(\mathsf{neg}\left(re\right)\right) \cdot \left(\frac{1}{2} \cdot re\right)\right)\right)\right)\right)\right) + 1\right) \cdot \sin im \]
              9. fp-cancel-sign-sub-invN/A

                \[\leadsto \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\color{blue}{\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right)}\right)\right)\right)\right) + 1\right) \cdot \sin im \]
              10. remove-double-negN/A

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

                \[\leadsto \left(\left(re + re \cdot \left(\frac{1}{2} \cdot re\right)\right) + \color{blue}{\left(0 + 1\right)}\right) \cdot \sin im \]
              12. associate-+r+N/A

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

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

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

          Alternative 6: 69.3% accurate, 0.4× speedup?

          \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ t_1 := e^{re} \cdot \sin im\_m\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;t\_1 \leq -\infty:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \mathbf{elif}\;t\_1 \leq 1:\\ \;\;\;\;\sin im\_m\\ \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\_m\\ \end{array} \end{array} \end{array} \]
          im\_m = (fabs.f64 im)
          im\_s = (copysign.f64 #s(literal 1 binary64) im)
          (FPCore (im_s re im_m)
           :precision binary64
           (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0))
                  (t_1 (* (exp re) (sin im_m))))
             (*
              im_s
              (if (<= t_1 (- INFINITY))
                (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
                (if (<= t_1 1.0)
                  (sin im_m)
                  (*
                   (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0)
                   im_m))))))
          im\_m = fabs(im);
          im\_s = copysign(1.0, im);
          double code(double im_s, double re, double im_m) {
          	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
          	double t_1 = exp(re) * sin(im_m);
          	double tmp;
          	if (t_1 <= -((double) INFINITY)) {
          		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
          	} else if (t_1 <= 1.0) {
          		tmp = sin(im_m);
          	} else {
          		tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m;
          	}
          	return im_s * tmp;
          }
          
          im\_m = abs(im)
          im\_s = copysign(1.0, im)
          function code(im_s, re, im_m)
          	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
          	t_1 = Float64(exp(re) * sin(im_m))
          	tmp = 0.0
          	if (t_1 <= Float64(-Inf))
          		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
          	elseif (t_1 <= 1.0)
          		tmp = sin(im_m);
          	else
          		tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m);
          	end
          	return Float64(im_s * tmp)
          end
          
          im\_m = N[Abs[im], $MachinePrecision]
          im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
          code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]}, N[(im$95$s * If[LessEqual[t$95$1, (-Infinity)], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], If[LessEqual[t$95$1, 1.0], N[Sin[im$95$m], $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]]), $MachinePrecision]]]
          
          \begin{array}{l}
          im\_m = \left|im\right|
          \\
          im\_s = \mathsf{copysign}\left(1, im\right)
          
          \\
          \begin{array}{l}
          t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\
          t_1 := e^{re} \cdot \sin im\_m\\
          im\_s \cdot \begin{array}{l}
          \mathbf{if}\;t\_1 \leq -\infty:\\
          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\
          
          \mathbf{elif}\;t\_1 \leq 1:\\
          \;\;\;\;\sin im\_m\\
          
          \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\_m\\
          
          
          \end{array}
          \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} \]
            4. Step-by-step derivation
              1. lower-sin.f642.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
              15. lower-exp.f6472.0

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

              \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
            9. Taylor expanded in re around 0

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

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

              if -inf.0 < (*.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.f6469.1

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

                \[\leadsto \color{blue}{\sin 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.f6477.8

                  \[\leadsto \color{blue}{e^{re}} \cdot im \]
              5. Applied rewrites77.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 rewrites62.9%

                  \[\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. Add Preprocessing

              Alternative 7: 46.0% accurate, 0.8× speedup?

              \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ \begin{array}{l} t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\ \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\_m\\ \end{array} \end{array} \end{array} \]
              im\_m = (fabs.f64 im)
              im\_s = (copysign.f64 #s(literal 1 binary64) im)
              (FPCore (im_s re im_m)
               :precision binary64
               (let* ((t_0 (fma (* im_m im_m) -0.16666666666666666 1.0)))
                 (*
                  im_s
                  (if (<= (* (exp re) (sin im_m)) 0.0)
                    (* (fma (* (fma 0.5 re 1.0) t_0) re t_0) im_m)
                    (* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) im_m)))))
              im\_m = fabs(im);
              im\_s = copysign(1.0, im);
              double code(double im_s, double re, double im_m) {
              	double t_0 = fma((im_m * im_m), -0.16666666666666666, 1.0);
              	double tmp;
              	if ((exp(re) * sin(im_m)) <= 0.0) {
              		tmp = fma((fma(0.5, re, 1.0) * t_0), re, t_0) * im_m;
              	} else {
              		tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m;
              	}
              	return im_s * tmp;
              }
              
              im\_m = abs(im)
              im\_s = copysign(1.0, im)
              function code(im_s, re, im_m)
              	t_0 = fma(Float64(im_m * im_m), -0.16666666666666666, 1.0)
              	tmp = 0.0
              	if (Float64(exp(re) * sin(im_m)) <= 0.0)
              		tmp = Float64(fma(Float64(fma(0.5, re, 1.0) * t_0), re, t_0) * im_m);
              	else
              		tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m);
              	end
              	return Float64(im_s * tmp)
              end
              
              im\_m = N[Abs[im], $MachinePrecision]
              im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
              code[im$95$s_, re_, im$95$m_] := Block[{t$95$0 = N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision]}, N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * t$95$0), $MachinePrecision] * re + t$95$0), $MachinePrecision] * im$95$m), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]]
              
              \begin{array}{l}
              im\_m = \left|im\right|
              \\
              im\_s = \mathsf{copysign}\left(1, im\right)
              
              \\
              \begin{array}{l}
              t_0 := \mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right)\\
              im\_s \cdot \begin{array}{l}
              \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0:\\
              \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right) \cdot t\_0, re, t\_0\right) \cdot im\_m\\
              
              \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\_m\\
              
              
              \end{array}
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
                  15. lower-exp.f6461.5

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

                  \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
                9. Taylor expanded in re around 0

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

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

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

                    \[\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 rewrites53.0%

                      \[\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. Add Preprocessing

                  Alternative 8: 45.9% accurate, 0.9× speedup?

                  \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\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\_m\\ \end{array} \end{array} \]
                  im\_m = (fabs.f64 im)
                  im\_s = (copysign.f64 #s(literal 1 binary64) im)
                  (FPCore (im_s re im_m)
                   :precision binary64
                   (*
                    im_s
                    (if (<= (* (exp re) (sin im_m)) 4e-309)
                      (* (fma (* im_m im_m) -0.16666666666666666 1.0) (fma re im_m im_m))
                      (* (fma (fma (fma 0.16666666666666666 re 0.5) re 1.0) re 1.0) im_m))))
                  im\_m = fabs(im);
                  im\_s = copysign(1.0, im);
                  double code(double im_s, double re, double im_m) {
                  	double tmp;
                  	if ((exp(re) * sin(im_m)) <= 4e-309) {
                  		tmp = fma((im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m);
                  	} else {
                  		tmp = fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m;
                  	}
                  	return im_s * tmp;
                  }
                  
                  im\_m = abs(im)
                  im\_s = copysign(1.0, im)
                  function code(im_s, re, im_m)
                  	tmp = 0.0
                  	if (Float64(exp(re) * sin(im_m)) <= 4e-309)
                  		tmp = Float64(fma(Float64(im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m));
                  	else
                  		tmp = Float64(fma(fma(fma(0.16666666666666666, re, 0.5), re, 1.0), re, 1.0) * im_m);
                  	end
                  	return Float64(im_s * tmp)
                  end
                  
                  im\_m = N[Abs[im], $MachinePrecision]
                  im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                  code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 4e-309], N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * N[(re * im$95$m + im$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re + 0.5), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                  
                  \begin{array}{l}
                  im\_m = \left|im\right|
                  \\
                  im\_s = \mathsf{copysign}\left(1, im\right)
                  
                  \\
                  im\_s \cdot \begin{array}{l}
                  \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\
                  \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\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\_m\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 3.9999999999999977e-309

                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
                      15. lower-exp.f6461.5

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

                      \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
                    9. Taylor expanded in re around 0

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

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

                      if 3.9999999999999977e-309 < (*.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.f6459.1

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

                        \[\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 rewrites53.0%

                          \[\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. Add Preprocessing

                      Alternative 9: 45.7% accurate, 0.9× speedup?

                      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot re, re, 1\right), re, 1\right) \cdot im\_m\\ \end{array} \end{array} \]
                      im\_m = (fabs.f64 im)
                      im\_s = (copysign.f64 #s(literal 1 binary64) im)
                      (FPCore (im_s re im_m)
                       :precision binary64
                       (*
                        im_s
                        (if (<= (* (exp re) (sin im_m)) 4e-309)
                          (* (fma (* im_m im_m) -0.16666666666666666 1.0) (fma re im_m im_m))
                          (* (fma (fma (* 0.16666666666666666 re) re 1.0) re 1.0) im_m))))
                      im\_m = fabs(im);
                      im\_s = copysign(1.0, im);
                      double code(double im_s, double re, double im_m) {
                      	double tmp;
                      	if ((exp(re) * sin(im_m)) <= 4e-309) {
                      		tmp = fma((im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m);
                      	} else {
                      		tmp = fma(fma((0.16666666666666666 * re), re, 1.0), re, 1.0) * im_m;
                      	}
                      	return im_s * tmp;
                      }
                      
                      im\_m = abs(im)
                      im\_s = copysign(1.0, im)
                      function code(im_s, re, im_m)
                      	tmp = 0.0
                      	if (Float64(exp(re) * sin(im_m)) <= 4e-309)
                      		tmp = Float64(fma(Float64(im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m));
                      	else
                      		tmp = Float64(fma(fma(Float64(0.16666666666666666 * re), re, 1.0), re, 1.0) * im_m);
                      	end
                      	return Float64(im_s * tmp)
                      end
                      
                      im\_m = N[Abs[im], $MachinePrecision]
                      im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                      code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 4e-309], N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * N[(re * im$95$m + im$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(0.16666666666666666 * re), $MachinePrecision] * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                      
                      \begin{array}{l}
                      im\_m = \left|im\right|
                      \\
                      im\_s = \mathsf{copysign}\left(1, im\right)
                      
                      \\
                      im\_s \cdot \begin{array}{l}
                      \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\
                      \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\right)\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666 \cdot re, re, 1\right), re, 1\right) \cdot im\_m\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 2 regimes
                      2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 3.9999999999999977e-309

                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
                          15. lower-exp.f6461.5

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

                          \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
                        9. Taylor expanded in re around 0

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

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

                          if 3.9999999999999977e-309 < (*.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.f6459.1

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

                            \[\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 rewrites53.0%

                              \[\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(\mathsf{fma}\left(\frac{1}{6} \cdot re, re, 1\right), re, 1\right) \cdot im \]
                            3. Step-by-step derivation
                              1. Applied rewrites52.5%

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

                            Alternative 10: 45.6% accurate, 0.9× speedup?

                            \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 2 \cdot 10^{-154}:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im\_m\\ \end{array} \end{array} \]
                            im\_m = (fabs.f64 im)
                            im\_s = (copysign.f64 #s(literal 1 binary64) im)
                            (FPCore (im_s re im_m)
                             :precision binary64
                             (*
                              im_s
                              (if (<= (* (exp re) (sin im_m)) 2e-154)
                                (* (fma (* im_m im_m) -0.16666666666666666 1.0) (fma re im_m im_m))
                                (* (fma (* (* re re) 0.16666666666666666) re 1.0) im_m))))
                            im\_m = fabs(im);
                            im\_s = copysign(1.0, im);
                            double code(double im_s, double re, double im_m) {
                            	double tmp;
                            	if ((exp(re) * sin(im_m)) <= 2e-154) {
                            		tmp = fma((im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m);
                            	} else {
                            		tmp = fma(((re * re) * 0.16666666666666666), re, 1.0) * im_m;
                            	}
                            	return im_s * tmp;
                            }
                            
                            im\_m = abs(im)
                            im\_s = copysign(1.0, im)
                            function code(im_s, re, im_m)
                            	tmp = 0.0
                            	if (Float64(exp(re) * sin(im_m)) <= 2e-154)
                            		tmp = Float64(fma(Float64(im_m * im_m), -0.16666666666666666, 1.0) * fma(re, im_m, im_m));
                            	else
                            		tmp = Float64(fma(Float64(Float64(re * re) * 0.16666666666666666), re, 1.0) * im_m);
                            	end
                            	return Float64(im_s * tmp)
                            end
                            
                            im\_m = N[Abs[im], $MachinePrecision]
                            im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                            code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 2e-154], N[(N[(N[(im$95$m * im$95$m), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * N[(re * im$95$m + im$95$m), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(re * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                            
                            \begin{array}{l}
                            im\_m = \left|im\right|
                            \\
                            im\_s = \mathsf{copysign}\left(1, im\right)
                            
                            \\
                            im\_s \cdot \begin{array}{l}
                            \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 2 \cdot 10^{-154}:\\
                            \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, -0.16666666666666666, 1\right) \cdot \mathsf{fma}\left(re, im\_m, im\_m\right)\\
                            
                            \mathbf{else}:\\
                            \;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im\_m\\
                            
                            
                            \end{array}
                            \end{array}
                            
                            Derivation
                            1. Split input into 2 regimes
                            2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 1.9999999999999999e-154

                              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.f6449.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\mathsf{fma}\left(\frac{-1}{6}, \color{blue}{im \cdot im}, 1\right) \cdot e^{re}\right) \cdot im \]
                                15. lower-exp.f6465.0

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

                                \[\leadsto \color{blue}{\left(\mathsf{fma}\left(-0.16666666666666666, im \cdot im, 1\right) \cdot e^{re}\right) \cdot im} \]
                              9. Taylor expanded in re around 0

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

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

                                if 1.9999999999999999e-154 < (*.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.f6452.6

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

                                  \[\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 rewrites45.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 rewrites45.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. Add Preprocessing

                                  Alternative 11: 44.8% accurate, 0.9× speedup?

                                  \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im\_m\\ \end{array} \end{array} \]
                                  im\_m = (fabs.f64 im)
                                  im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                  (FPCore (im_s re im_m)
                                   :precision binary64
                                   (*
                                    im_s
                                    (if (<= (* (exp re) (sin im_m)) 0.0)
                                      (fma (* im_m im_m) (* im_m -0.16666666666666666) im_m)
                                      (* (fma (* (* re re) 0.16666666666666666) re 1.0) im_m))))
                                  im\_m = fabs(im);
                                  im\_s = copysign(1.0, im);
                                  double code(double im_s, double re, double im_m) {
                                  	double tmp;
                                  	if ((exp(re) * sin(im_m)) <= 0.0) {
                                  		tmp = fma((im_m * im_m), (im_m * -0.16666666666666666), im_m);
                                  	} else {
                                  		tmp = fma(((re * re) * 0.16666666666666666), re, 1.0) * im_m;
                                  	}
                                  	return im_s * tmp;
                                  }
                                  
                                  im\_m = abs(im)
                                  im\_s = copysign(1.0, im)
                                  function code(im_s, re, im_m)
                                  	tmp = 0.0
                                  	if (Float64(exp(re) * sin(im_m)) <= 0.0)
                                  		tmp = fma(Float64(im_m * im_m), Float64(im_m * -0.16666666666666666), im_m);
                                  	else
                                  		tmp = Float64(fma(Float64(Float64(re * re) * 0.16666666666666666), re, 1.0) * im_m);
                                  	end
                                  	return Float64(im_s * tmp)
                                  end
                                  
                                  im\_m = N[Abs[im], $MachinePrecision]
                                  im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                  code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 0.0], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * -0.16666666666666666), $MachinePrecision] + im$95$m), $MachinePrecision], N[(N[(N[(N[(re * re), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  im\_m = \left|im\right|
                                  \\
                                  im\_s = \mathsf{copysign}\left(1, im\right)
                                  
                                  \\
                                  im\_s \cdot \begin{array}{l}
                                  \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0:\\
                                  \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(\left(re \cdot re\right) \cdot 0.16666666666666666, re, 1\right) \cdot im\_m\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.0

                                    1. Initial program 100.0%

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

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

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

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

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

                                        \[\leadsto \mathsf{fma}\left({im}^{3}, \color{blue}{-0.16666666666666666}, im\right) \]
                                      2. Step-by-step derivation
                                        1. Applied rewrites25.3%

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

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

                                        1. Initial program 100.0%

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

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

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

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

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

                                          \[\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 rewrites53.0%

                                            \[\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 rewrites52.0%

                                              \[\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. Add Preprocessing

                                          Alternative 12: 42.9% accurate, 0.9× speedup?

                                          \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot im\_m\\ \end{array} \end{array} \]
                                          im\_m = (fabs.f64 im)
                                          im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                          (FPCore (im_s re im_m)
                                           :precision binary64
                                           (*
                                            im_s
                                            (if (<= (* (exp re) (sin im_m)) 4e-309)
                                              (fma (* im_m im_m) (* im_m -0.16666666666666666) im_m)
                                              (* (fma (fma 0.5 re 1.0) re 1.0) im_m))))
                                          im\_m = fabs(im);
                                          im\_s = copysign(1.0, im);
                                          double code(double im_s, double re, double im_m) {
                                          	double tmp;
                                          	if ((exp(re) * sin(im_m)) <= 4e-309) {
                                          		tmp = fma((im_m * im_m), (im_m * -0.16666666666666666), im_m);
                                          	} else {
                                          		tmp = fma(fma(0.5, re, 1.0), re, 1.0) * im_m;
                                          	}
                                          	return im_s * tmp;
                                          }
                                          
                                          im\_m = abs(im)
                                          im\_s = copysign(1.0, im)
                                          function code(im_s, re, im_m)
                                          	tmp = 0.0
                                          	if (Float64(exp(re) * sin(im_m)) <= 4e-309)
                                          		tmp = fma(Float64(im_m * im_m), Float64(im_m * -0.16666666666666666), im_m);
                                          	else
                                          		tmp = Float64(fma(fma(0.5, re, 1.0), re, 1.0) * im_m);
                                          	end
                                          	return Float64(im_s * tmp)
                                          end
                                          
                                          im\_m = N[Abs[im], $MachinePrecision]
                                          im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                          code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 4e-309], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * -0.16666666666666666), $MachinePrecision] + im$95$m), $MachinePrecision], N[(N[(N[(0.5 * re + 1.0), $MachinePrecision] * re + 1.0), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                                          
                                          \begin{array}{l}
                                          im\_m = \left|im\right|
                                          \\
                                          im\_s = \mathsf{copysign}\left(1, im\right)
                                          
                                          \\
                                          im\_s \cdot \begin{array}{l}
                                          \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 4 \cdot 10^{-309}:\\
                                          \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.5, re, 1\right), re, 1\right) \cdot im\_m\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 3.9999999999999977e-309

                                            1. Initial program 100.0%

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

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

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

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

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

                                                \[\leadsto \mathsf{fma}\left({im}^{3}, \color{blue}{-0.16666666666666666}, im\right) \]
                                              2. Step-by-step derivation
                                                1. Applied rewrites25.3%

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

                                                if 3.9999999999999977e-309 < (*.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.f6459.1

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

                                                  \[\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 rewrites46.7%

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

                                                Alternative 13: 42.1% accurate, 0.9× speedup?

                                                \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 2 \cdot 10^{-8}:\\ \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot im\_m\\ \end{array} \end{array} \]
                                                im\_m = (fabs.f64 im)
                                                im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                (FPCore (im_s re im_m)
                                                 :precision binary64
                                                 (*
                                                  im_s
                                                  (if (<= (* (exp re) (sin im_m)) 2e-8)
                                                    (fma (* im_m im_m) (* im_m -0.16666666666666666) im_m)
                                                    (* (* (* re re) 0.5) im_m))))
                                                im\_m = fabs(im);
                                                im\_s = copysign(1.0, im);
                                                double code(double im_s, double re, double im_m) {
                                                	double tmp;
                                                	if ((exp(re) * sin(im_m)) <= 2e-8) {
                                                		tmp = fma((im_m * im_m), (im_m * -0.16666666666666666), im_m);
                                                	} else {
                                                		tmp = ((re * re) * 0.5) * im_m;
                                                	}
                                                	return im_s * tmp;
                                                }
                                                
                                                im\_m = abs(im)
                                                im\_s = copysign(1.0, im)
                                                function code(im_s, re, im_m)
                                                	tmp = 0.0
                                                	if (Float64(exp(re) * sin(im_m)) <= 2e-8)
                                                		tmp = fma(Float64(im_m * im_m), Float64(im_m * -0.16666666666666666), im_m);
                                                	else
                                                		tmp = Float64(Float64(Float64(re * re) * 0.5) * im_m);
                                                	end
                                                	return Float64(im_s * tmp)
                                                end
                                                
                                                im\_m = N[Abs[im], $MachinePrecision]
                                                im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 2e-8], N[(N[(im$95$m * im$95$m), $MachinePrecision] * N[(im$95$m * -0.16666666666666666), $MachinePrecision] + im$95$m), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                                                
                                                \begin{array}{l}
                                                im\_m = \left|im\right|
                                                \\
                                                im\_s = \mathsf{copysign}\left(1, im\right)
                                                
                                                \\
                                                im\_s \cdot \begin{array}{l}
                                                \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 2 \cdot 10^{-8}:\\
                                                \;\;\;\;\mathsf{fma}\left(im\_m \cdot im\_m, im\_m \cdot -0.16666666666666666, im\_m\right)\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot im\_m\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 2 regimes
                                                2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 2e-8

                                                  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.f6453.2

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

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

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

                                                      \[\leadsto \mathsf{fma}\left({im}^{3}, \color{blue}{-0.16666666666666666}, im\right) \]
                                                    2. Step-by-step derivation
                                                      1. Applied rewrites37.1%

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

                                                      if 2e-8 < (*.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.f6444.5

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

                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 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 rewrites28.4%

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

                                                        Alternative 14: 37.9% accurate, 0.9× speedup?

                                                        \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0.15:\\ \;\;\;\;1 \cdot im\_m\\ \mathbf{else}:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot im\_m\\ \end{array} \end{array} \]
                                                        im\_m = (fabs.f64 im)
                                                        im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                        (FPCore (im_s re im_m)
                                                         :precision binary64
                                                         (*
                                                          im_s
                                                          (if (<= (* (exp re) (sin im_m)) 0.15)
                                                            (* 1.0 im_m)
                                                            (* (* (* re re) 0.5) im_m))))
                                                        im\_m = fabs(im);
                                                        im\_s = copysign(1.0, im);
                                                        double code(double im_s, double re, double im_m) {
                                                        	double tmp;
                                                        	if ((exp(re) * sin(im_m)) <= 0.15) {
                                                        		tmp = 1.0 * im_m;
                                                        	} else {
                                                        		tmp = ((re * re) * 0.5) * im_m;
                                                        	}
                                                        	return im_s * tmp;
                                                        }
                                                        
                                                        im\_m =     private
                                                        im\_s =     private
                                                        module fmin_fmax_functions
                                                            implicit none
                                                            private
                                                            public fmax
                                                            public fmin
                                                        
                                                            interface fmax
                                                                module procedure fmax88
                                                                module procedure fmax44
                                                                module procedure fmax84
                                                                module procedure fmax48
                                                            end interface
                                                            interface fmin
                                                                module procedure fmin88
                                                                module procedure fmin44
                                                                module procedure fmin84
                                                                module procedure fmin48
                                                            end interface
                                                        contains
                                                            real(8) function fmax88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmax44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmin44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                            end function
                                                        end module
                                                        
                                                        real(8) function code(im_s, re, im_m)
                                                        use fmin_fmax_functions
                                                            real(8), intent (in) :: im_s
                                                            real(8), intent (in) :: re
                                                            real(8), intent (in) :: im_m
                                                            real(8) :: tmp
                                                            if ((exp(re) * sin(im_m)) <= 0.15d0) then
                                                                tmp = 1.0d0 * im_m
                                                            else
                                                                tmp = ((re * re) * 0.5d0) * im_m
                                                            end if
                                                            code = im_s * tmp
                                                        end function
                                                        
                                                        im\_m = Math.abs(im);
                                                        im\_s = Math.copySign(1.0, im);
                                                        public static double code(double im_s, double re, double im_m) {
                                                        	double tmp;
                                                        	if ((Math.exp(re) * Math.sin(im_m)) <= 0.15) {
                                                        		tmp = 1.0 * im_m;
                                                        	} else {
                                                        		tmp = ((re * re) * 0.5) * im_m;
                                                        	}
                                                        	return im_s * tmp;
                                                        }
                                                        
                                                        im\_m = math.fabs(im)
                                                        im\_s = math.copysign(1.0, im)
                                                        def code(im_s, re, im_m):
                                                        	tmp = 0
                                                        	if (math.exp(re) * math.sin(im_m)) <= 0.15:
                                                        		tmp = 1.0 * im_m
                                                        	else:
                                                        		tmp = ((re * re) * 0.5) * im_m
                                                        	return im_s * tmp
                                                        
                                                        im\_m = abs(im)
                                                        im\_s = copysign(1.0, im)
                                                        function code(im_s, re, im_m)
                                                        	tmp = 0.0
                                                        	if (Float64(exp(re) * sin(im_m)) <= 0.15)
                                                        		tmp = Float64(1.0 * im_m);
                                                        	else
                                                        		tmp = Float64(Float64(Float64(re * re) * 0.5) * im_m);
                                                        	end
                                                        	return Float64(im_s * tmp)
                                                        end
                                                        
                                                        im\_m = abs(im);
                                                        im\_s = sign(im) * abs(1.0);
                                                        function tmp_2 = code(im_s, re, im_m)
                                                        	tmp = 0.0;
                                                        	if ((exp(re) * sin(im_m)) <= 0.15)
                                                        		tmp = 1.0 * im_m;
                                                        	else
                                                        		tmp = ((re * re) * 0.5) * im_m;
                                                        	end
                                                        	tmp_2 = im_s * tmp;
                                                        end
                                                        
                                                        im\_m = N[Abs[im], $MachinePrecision]
                                                        im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                        code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 0.15], N[(1.0 * im$95$m), $MachinePrecision], N[(N[(N[(re * re), $MachinePrecision] * 0.5), $MachinePrecision] * im$95$m), $MachinePrecision]]), $MachinePrecision]
                                                        
                                                        \begin{array}{l}
                                                        im\_m = \left|im\right|
                                                        \\
                                                        im\_s = \mathsf{copysign}\left(1, im\right)
                                                        
                                                        \\
                                                        im\_s \cdot \begin{array}{l}
                                                        \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0.15:\\
                                                        \;\;\;\;1 \cdot im\_m\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\left(\left(re \cdot re\right) \cdot 0.5\right) \cdot im\_m\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.149999999999999994

                                                          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.f6476.3

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

                                                            \[\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 rewrites33.9%

                                                              \[\leadsto 1 \cdot im \]

                                                            if 0.149999999999999994 < (*.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.f6447.1

                                                                \[\leadsto \color{blue}{e^{re}} \cdot im \]
                                                            5. Applied rewrites47.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 rewrites24.5%

                                                                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(im \cdot re, 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 rewrites30.0%

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

                                                              Alternative 15: 30.2% accurate, 0.9× speedup?

                                                              \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \begin{array}{l} \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0.92:\\ \;\;\;\;1 \cdot im\_m\\ \mathbf{else}:\\ \;\;\;\;re \cdot im\_m\\ \end{array} \end{array} \]
                                                              im\_m = (fabs.f64 im)
                                                              im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                              (FPCore (im_s re im_m)
                                                               :precision binary64
                                                               (* im_s (if (<= (* (exp re) (sin im_m)) 0.92) (* 1.0 im_m) (* re im_m))))
                                                              im\_m = fabs(im);
                                                              im\_s = copysign(1.0, im);
                                                              double code(double im_s, double re, double im_m) {
                                                              	double tmp;
                                                              	if ((exp(re) * sin(im_m)) <= 0.92) {
                                                              		tmp = 1.0 * im_m;
                                                              	} else {
                                                              		tmp = re * im_m;
                                                              	}
                                                              	return im_s * tmp;
                                                              }
                                                              
                                                              im\_m =     private
                                                              im\_s =     private
                                                              module fmin_fmax_functions
                                                                  implicit none
                                                                  private
                                                                  public fmax
                                                                  public fmin
                                                              
                                                                  interface fmax
                                                                      module procedure fmax88
                                                                      module procedure fmax44
                                                                      module procedure fmax84
                                                                      module procedure fmax48
                                                                  end interface
                                                                  interface fmin
                                                                      module procedure fmin88
                                                                      module procedure fmin44
                                                                      module procedure fmin84
                                                                      module procedure fmin48
                                                                  end interface
                                                              contains
                                                                  real(8) function fmax88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmax44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmax48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin88(x, y) result (res)
                                                                      real(8), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(4) function fmin44(x, y) result (res)
                                                                      real(4), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin84(x, y) result(res)
                                                                      real(8), intent (in) :: x
                                                                      real(4), intent (in) :: y
                                                                      res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                  end function
                                                                  real(8) function fmin48(x, y) result(res)
                                                                      real(4), intent (in) :: x
                                                                      real(8), intent (in) :: y
                                                                      res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                  end function
                                                              end module
                                                              
                                                              real(8) function code(im_s, re, im_m)
                                                              use fmin_fmax_functions
                                                                  real(8), intent (in) :: im_s
                                                                  real(8), intent (in) :: re
                                                                  real(8), intent (in) :: im_m
                                                                  real(8) :: tmp
                                                                  if ((exp(re) * sin(im_m)) <= 0.92d0) then
                                                                      tmp = 1.0d0 * im_m
                                                                  else
                                                                      tmp = re * im_m
                                                                  end if
                                                                  code = im_s * tmp
                                                              end function
                                                              
                                                              im\_m = Math.abs(im);
                                                              im\_s = Math.copySign(1.0, im);
                                                              public static double code(double im_s, double re, double im_m) {
                                                              	double tmp;
                                                              	if ((Math.exp(re) * Math.sin(im_m)) <= 0.92) {
                                                              		tmp = 1.0 * im_m;
                                                              	} else {
                                                              		tmp = re * im_m;
                                                              	}
                                                              	return im_s * tmp;
                                                              }
                                                              
                                                              im\_m = math.fabs(im)
                                                              im\_s = math.copysign(1.0, im)
                                                              def code(im_s, re, im_m):
                                                              	tmp = 0
                                                              	if (math.exp(re) * math.sin(im_m)) <= 0.92:
                                                              		tmp = 1.0 * im_m
                                                              	else:
                                                              		tmp = re * im_m
                                                              	return im_s * tmp
                                                              
                                                              im\_m = abs(im)
                                                              im\_s = copysign(1.0, im)
                                                              function code(im_s, re, im_m)
                                                              	tmp = 0.0
                                                              	if (Float64(exp(re) * sin(im_m)) <= 0.92)
                                                              		tmp = Float64(1.0 * im_m);
                                                              	else
                                                              		tmp = Float64(re * im_m);
                                                              	end
                                                              	return Float64(im_s * tmp)
                                                              end
                                                              
                                                              im\_m = abs(im);
                                                              im\_s = sign(im) * abs(1.0);
                                                              function tmp_2 = code(im_s, re, im_m)
                                                              	tmp = 0.0;
                                                              	if ((exp(re) * sin(im_m)) <= 0.92)
                                                              		tmp = 1.0 * im_m;
                                                              	else
                                                              		tmp = re * im_m;
                                                              	end
                                                              	tmp_2 = im_s * tmp;
                                                              end
                                                              
                                                              im\_m = N[Abs[im], $MachinePrecision]
                                                              im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                              code[im$95$s_, re_, im$95$m_] := N[(im$95$s * If[LessEqual[N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision], 0.92], N[(1.0 * im$95$m), $MachinePrecision], N[(re * im$95$m), $MachinePrecision]]), $MachinePrecision]
                                                              
                                                              \begin{array}{l}
                                                              im\_m = \left|im\right|
                                                              \\
                                                              im\_s = \mathsf{copysign}\left(1, im\right)
                                                              
                                                              \\
                                                              im\_s \cdot \begin{array}{l}
                                                              \mathbf{if}\;e^{re} \cdot \sin im\_m \leq 0.92:\\
                                                              \;\;\;\;1 \cdot im\_m\\
                                                              
                                                              \mathbf{else}:\\
                                                              \;\;\;\;re \cdot im\_m\\
                                                              
                                                              
                                                              \end{array}
                                                              \end{array}
                                                              
                                                              Derivation
                                                              1. Split input into 2 regimes
                                                              2. if (*.f64 (exp.f64 re) (sin.f64 im)) < 0.92000000000000004

                                                                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.f6467.6

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

                                                                  \[\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 rewrites30.2%

                                                                    \[\leadsto 1 \cdot im \]

                                                                  if 0.92000000000000004 < (*.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.f6467.6

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

                                                                    \[\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 rewrites2.9%

                                                                      \[\leadsto 1 \cdot im \]
                                                                    2. Taylor expanded in re around 0

                                                                      \[\leadsto im + \color{blue}{im \cdot re} \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites21.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 rewrites21.7%

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

                                                                      Alternative 16: 100.0% accurate, 1.0× speedup?

                                                                      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(e^{re} \cdot \sin im\_m\right) \end{array} \]
                                                                      im\_m = (fabs.f64 im)
                                                                      im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                                      (FPCore (im_s re im_m) :precision binary64 (* im_s (* (exp re) (sin im_m))))
                                                                      im\_m = fabs(im);
                                                                      im\_s = copysign(1.0, im);
                                                                      double code(double im_s, double re, double im_m) {
                                                                      	return im_s * (exp(re) * sin(im_m));
                                                                      }
                                                                      
                                                                      im\_m =     private
                                                                      im\_s =     private
                                                                      module fmin_fmax_functions
                                                                          implicit none
                                                                          private
                                                                          public fmax
                                                                          public fmin
                                                                      
                                                                          interface fmax
                                                                              module procedure fmax88
                                                                              module procedure fmax44
                                                                              module procedure fmax84
                                                                              module procedure fmax48
                                                                          end interface
                                                                          interface fmin
                                                                              module procedure fmin88
                                                                              module procedure fmin44
                                                                              module procedure fmin84
                                                                              module procedure fmin48
                                                                          end interface
                                                                      contains
                                                                          real(8) function fmax88(x, y) result (res)
                                                                              real(8), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(4) function fmax44(x, y) result (res)
                                                                              real(4), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmax84(x, y) result(res)
                                                                              real(8), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmax48(x, y) result(res)
                                                                              real(4), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin88(x, y) result (res)
                                                                              real(8), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(4) function fmin44(x, y) result (res)
                                                                              real(4), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin84(x, y) result(res)
                                                                              real(8), intent (in) :: x
                                                                              real(4), intent (in) :: y
                                                                              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                          end function
                                                                          real(8) function fmin48(x, y) result(res)
                                                                              real(4), intent (in) :: x
                                                                              real(8), intent (in) :: y
                                                                              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                          end function
                                                                      end module
                                                                      
                                                                      real(8) function code(im_s, re, im_m)
                                                                      use fmin_fmax_functions
                                                                          real(8), intent (in) :: im_s
                                                                          real(8), intent (in) :: re
                                                                          real(8), intent (in) :: im_m
                                                                          code = im_s * (exp(re) * sin(im_m))
                                                                      end function
                                                                      
                                                                      im\_m = Math.abs(im);
                                                                      im\_s = Math.copySign(1.0, im);
                                                                      public static double code(double im_s, double re, double im_m) {
                                                                      	return im_s * (Math.exp(re) * Math.sin(im_m));
                                                                      }
                                                                      
                                                                      im\_m = math.fabs(im)
                                                                      im\_s = math.copysign(1.0, im)
                                                                      def code(im_s, re, im_m):
                                                                      	return im_s * (math.exp(re) * math.sin(im_m))
                                                                      
                                                                      im\_m = abs(im)
                                                                      im\_s = copysign(1.0, im)
                                                                      function code(im_s, re, im_m)
                                                                      	return Float64(im_s * Float64(exp(re) * sin(im_m)))
                                                                      end
                                                                      
                                                                      im\_m = abs(im);
                                                                      im\_s = sign(im) * abs(1.0);
                                                                      function tmp = code(im_s, re, im_m)
                                                                      	tmp = im_s * (exp(re) * sin(im_m));
                                                                      end
                                                                      
                                                                      im\_m = N[Abs[im], $MachinePrecision]
                                                                      im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                                      code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(N[Exp[re], $MachinePrecision] * N[Sin[im$95$m], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      im\_m = \left|im\right|
                                                                      \\
                                                                      im\_s = \mathsf{copysign}\left(1, im\right)
                                                                      
                                                                      \\
                                                                      im\_s \cdot \left(e^{re} \cdot \sin im\_m\right)
                                                                      \end{array}
                                                                      
                                                                      Derivation
                                                                      1. Initial program 100.0%

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

                                                                      Alternative 17: 30.2% accurate, 29.4× speedup?

                                                                      \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \mathsf{fma}\left(im\_m, re, im\_m\right) \end{array} \]
                                                                      im\_m = (fabs.f64 im)
                                                                      im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                                      (FPCore (im_s re im_m) :precision binary64 (* im_s (fma im_m re im_m)))
                                                                      im\_m = fabs(im);
                                                                      im\_s = copysign(1.0, im);
                                                                      double code(double im_s, double re, double im_m) {
                                                                      	return im_s * fma(im_m, re, im_m);
                                                                      }
                                                                      
                                                                      im\_m = abs(im)
                                                                      im\_s = copysign(1.0, im)
                                                                      function code(im_s, re, im_m)
                                                                      	return Float64(im_s * fma(im_m, re, im_m))
                                                                      end
                                                                      
                                                                      im\_m = N[Abs[im], $MachinePrecision]
                                                                      im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                                      code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(im$95$m * re + im$95$m), $MachinePrecision]), $MachinePrecision]
                                                                      
                                                                      \begin{array}{l}
                                                                      im\_m = \left|im\right|
                                                                      \\
                                                                      im\_s = \mathsf{copysign}\left(1, im\right)
                                                                      
                                                                      \\
                                                                      im\_s \cdot \mathsf{fma}\left(im\_m, re, im\_m\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.f6467.6

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

                                                                        \[\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 rewrites30.0%

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

                                                                        Alternative 18: 6.7% accurate, 34.3× speedup?

                                                                        \[\begin{array}{l} im\_m = \left|im\right| \\ im\_s = \mathsf{copysign}\left(1, im\right) \\ im\_s \cdot \left(re \cdot im\_m\right) \end{array} \]
                                                                        im\_m = (fabs.f64 im)
                                                                        im\_s = (copysign.f64 #s(literal 1 binary64) im)
                                                                        (FPCore (im_s re im_m) :precision binary64 (* im_s (* re im_m)))
                                                                        im\_m = fabs(im);
                                                                        im\_s = copysign(1.0, im);
                                                                        double code(double im_s, double re, double im_m) {
                                                                        	return im_s * (re * im_m);
                                                                        }
                                                                        
                                                                        im\_m =     private
                                                                        im\_s =     private
                                                                        module fmin_fmax_functions
                                                                            implicit none
                                                                            private
                                                                            public fmax
                                                                            public fmin
                                                                        
                                                                            interface fmax
                                                                                module procedure fmax88
                                                                                module procedure fmax44
                                                                                module procedure fmax84
                                                                                module procedure fmax48
                                                                            end interface
                                                                            interface fmin
                                                                                module procedure fmin88
                                                                                module procedure fmin44
                                                                                module procedure fmin84
                                                                                module procedure fmin48
                                                                            end interface
                                                                        contains
                                                                            real(8) function fmax88(x, y) result (res)
                                                                                real(8), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(4) function fmax44(x, y) result (res)
                                                                                real(4), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmax84(x, y) result(res)
                                                                                real(8), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmax48(x, y) result(res)
                                                                                real(4), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin88(x, y) result (res)
                                                                                real(8), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(4) function fmin44(x, y) result (res)
                                                                                real(4), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin84(x, y) result(res)
                                                                                real(8), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin48(x, y) result(res)
                                                                                real(4), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                            end function
                                                                        end module
                                                                        
                                                                        real(8) function code(im_s, re, im_m)
                                                                        use fmin_fmax_functions
                                                                            real(8), intent (in) :: im_s
                                                                            real(8), intent (in) :: re
                                                                            real(8), intent (in) :: im_m
                                                                            code = im_s * (re * im_m)
                                                                        end function
                                                                        
                                                                        im\_m = Math.abs(im);
                                                                        im\_s = Math.copySign(1.0, im);
                                                                        public static double code(double im_s, double re, double im_m) {
                                                                        	return im_s * (re * im_m);
                                                                        }
                                                                        
                                                                        im\_m = math.fabs(im)
                                                                        im\_s = math.copysign(1.0, im)
                                                                        def code(im_s, re, im_m):
                                                                        	return im_s * (re * im_m)
                                                                        
                                                                        im\_m = abs(im)
                                                                        im\_s = copysign(1.0, im)
                                                                        function code(im_s, re, im_m)
                                                                        	return Float64(im_s * Float64(re * im_m))
                                                                        end
                                                                        
                                                                        im\_m = abs(im);
                                                                        im\_s = sign(im) * abs(1.0);
                                                                        function tmp = code(im_s, re, im_m)
                                                                        	tmp = im_s * (re * im_m);
                                                                        end
                                                                        
                                                                        im\_m = N[Abs[im], $MachinePrecision]
                                                                        im\_s = N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision]
                                                                        code[im$95$s_, re_, im$95$m_] := N[(im$95$s * N[(re * im$95$m), $MachinePrecision]), $MachinePrecision]
                                                                        
                                                                        \begin{array}{l}
                                                                        im\_m = \left|im\right|
                                                                        \\
                                                                        im\_s = \mathsf{copysign}\left(1, im\right)
                                                                        
                                                                        \\
                                                                        im\_s \cdot \left(re \cdot im\_m\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.f6467.6

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

                                                                          \[\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 rewrites24.6%

                                                                            \[\leadsto 1 \cdot im \]
                                                                          2. Taylor expanded in re around 0

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

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

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

                                                                              Reproduce

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