math.cos on complex, imaginary part

Percentage Accurate: 65.5% → 99.7%
Time: 6.9s
Alternatives: 20
Speedup: 2.5×

Specification

?
\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(re)) * (exp(-im) - exp(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 = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\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 20 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: 65.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(re)) * (exp(-im) - exp(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 = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)
\end{array}

Alternative 1: 99.7% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -3.8:\\ \;\;\;\;t\_0 \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 3.8:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* 0.5 (sin re))))
   (if (<= im -3.8)
     (* t_0 (- (exp (- im)) 1.0))
     (if (<= im 3.8)
       (*
        t_0
        (*
         (-
          (*
           (-
            (*
             (*
              (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666)
              im)
             im)
            0.3333333333333333)
           (* im im))
          2.0)
         im))
       (* t_0 (- 1.0 (exp im)))))))
double code(double re, double im) {
	double t_0 = 0.5 * sin(re);
	double tmp;
	if (im <= -3.8) {
		tmp = t_0 * (exp(-im) - 1.0);
	} else if (im <= 3.8) {
		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
	} else {
		tmp = t_0 * (1.0 - exp(im));
	}
	return tmp;
}
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
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 0.5d0 * sin(re)
    if (im <= (-3.8d0)) then
        tmp = t_0 * (exp(-im) - 1.0d0)
    else if (im <= 3.8d0) then
        tmp = t_0 * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
    else
        tmp = t_0 * (1.0d0 - exp(im))
    end if
    code = tmp
end function
public static double code(double re, double im) {
	double t_0 = 0.5 * Math.sin(re);
	double tmp;
	if (im <= -3.8) {
		tmp = t_0 * (Math.exp(-im) - 1.0);
	} else if (im <= 3.8) {
		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
	} else {
		tmp = t_0 * (1.0 - Math.exp(im));
	}
	return tmp;
}
def code(re, im):
	t_0 = 0.5 * math.sin(re)
	tmp = 0
	if im <= -3.8:
		tmp = t_0 * (math.exp(-im) - 1.0)
	elif im <= 3.8:
		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
	else:
		tmp = t_0 * (1.0 - math.exp(im))
	return tmp
function code(re, im)
	t_0 = Float64(0.5 * sin(re))
	tmp = 0.0
	if (im <= -3.8)
		tmp = Float64(t_0 * Float64(exp(Float64(-im)) - 1.0));
	elseif (im <= 3.8)
		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
	else
		tmp = Float64(t_0 * Float64(1.0 - exp(im)));
	end
	return tmp
end
function tmp_2 = code(re, im)
	t_0 = 0.5 * sin(re);
	tmp = 0.0;
	if (im <= -3.8)
		tmp = t_0 * (exp(-im) - 1.0);
	elseif (im <= 3.8)
		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
	else
		tmp = t_0 * (1.0 - exp(im));
	end
	tmp_2 = tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.8], N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8], N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \sin re\\
\mathbf{if}\;im \leq -3.8:\\
\;\;\;\;t\_0 \cdot \left(e^{-im} - 1\right)\\

\mathbf{elif}\;im \leq 3.8:\\
\;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -3.7999999999999998

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in im around 0

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - \color{blue}{1}\right) \]

      if -3.7999999999999998 < im < 3.7999999999999998

      1. Initial program 35.2%

        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        2. lower-*.f64N/A

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
      5. Applied rewrites99.9%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]

      if 3.7999999999999998 < im

      1. Initial program 100.0%

        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
      2. Add Preprocessing
      3. Taylor expanded in im around 0

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

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\color{blue}{1} - e^{im}\right) \]
      5. Recombined 3 regimes into one program.
      6. Add Preprocessing

      Alternative 2: 96.5% accurate, 1.4× speedup?

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

        1. Initial program 52.9%

          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

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

            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
          2. lower-*.f64N/A

            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        5. Applied rewrites94.8%

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]

        if 3.7999999999999998 < im

        1. Initial program 100.0%

          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
        2. Add Preprocessing
        3. Taylor expanded in im around 0

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

            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\color{blue}{1} - e^{im}\right) \]
        5. Recombined 2 regimes into one program.
        6. Add Preprocessing

        Alternative 3: 59.1% accurate, 1.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.05:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (if (<= (* 0.5 (sin re)) -0.05)
           (*
            (*
             (* (fma (* re re) -0.16666666666666666 1.0) re)
             (fma (* -0.16666666666666666 im) im -1.0))
            im)
           (*
            (*
             (fma
              (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
              (* re re)
              0.5)
             re)
            (*
             (-
              (*
               (-
                (*
                 (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                 im)
                0.3333333333333333)
               (* im im))
              2.0)
             im))))
        double code(double re, double im) {
        	double tmp;
        	if ((0.5 * sin(re)) <= -0.05) {
        		tmp = ((fma((re * re), -0.16666666666666666, 1.0) * re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
        	} else {
        		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 0.5) * re) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
        	}
        	return tmp;
        }
        
        function code(re, im)
        	tmp = 0.0
        	if (Float64(0.5 * sin(re)) <= -0.05)
        		tmp = Float64(Float64(Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
        	else
        		tmp = Float64(Float64(fma(Float64(Float64(0.004166666666666667 * Float64(re * re)) - 0.08333333333333333), Float64(re * re), 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
        	end
        	return tmp
        end
        
        code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], N[(N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;0.5 \cdot \sin re \leq -0.05:\\
        \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.050000000000000003

          1. Initial program 51.3%

            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

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

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

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

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

              \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
            5. distribute-rgt-outN/A

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

              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
            7. lift-sin.f64N/A

              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
            8. unpow2N/A

              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
            9. associate-*r*N/A

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

              \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
            11. lower-*.f6486.3

              \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
          5. Applied rewrites86.3%

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

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

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

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

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

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

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

              \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
            7. lower-*.f6428.3

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

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

          if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

          1. Initial program 70.2%

            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

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

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
            2. lower-*.f64N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
          5. Applied rewrites93.0%

            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
          6. Taylor expanded in re around 0

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

              \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            2. lower-*.f64N/A

              \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            3. +-commutativeN/A

              \[\leadsto \left(\left({re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            4. *-commutativeN/A

              \[\leadsto \left(\left(\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            5. lower-fma.f64N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            6. lower--.f64N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            7. lower-*.f64N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            8. unpow2N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            9. lower-*.f64N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            10. unpow2N/A

              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
            11. lower-*.f6475.0

              \[\leadsto \left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
          8. Applied rewrites75.0%

            \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
        3. Recombined 2 regimes into one program.
        4. Add Preprocessing

        Alternative 4: 97.1% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{if}\;im \leq -1.2 \cdot 10^{+64}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq -8.2:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
        (FPCore (re im)
         :precision binary64
         (let* ((t_0
                 (*
                  (* 0.5 (sin re))
                  (*
                   (-
                    (*
                     (* (- (* -0.016666666666666666 (* im im)) 0.3333333333333333) im)
                     im)
                    2.0)
                   im))))
           (if (<= im -1.2e+64)
             t_0
             (if (<= im -8.2)
               (*
                (*
                 0.5
                 (*
                  (fma
                   (- (* 0.008333333333333333 (* re re)) 0.16666666666666666)
                   (* re re)
                   1.0)
                  re))
                (- (exp (- im)) 1.0))
               (if (or (<= im 7.6) (not (<= im 1.01e+62)))
                 t_0
                 (*
                  (* 0.5 (* (fma (* re re) -0.16666666666666666 1.0) re))
                  (- 1.0 (exp im))))))))
        double code(double re, double im) {
        	double t_0 = (0.5 * sin(re)) * ((((((-0.016666666666666666 * (im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im);
        	double tmp;
        	if (im <= -1.2e+64) {
        		tmp = t_0;
        	} else if (im <= -8.2) {
        		tmp = (0.5 * (fma(((0.008333333333333333 * (re * re)) - 0.16666666666666666), (re * re), 1.0) * re)) * (exp(-im) - 1.0);
        	} else if ((im <= 7.6) || !(im <= 1.01e+62)) {
        		tmp = t_0;
        	} else {
        		tmp = (0.5 * (fma((re * re), -0.16666666666666666, 1.0) * re)) * (1.0 - exp(im));
        	}
        	return tmp;
        }
        
        function code(re, im)
        	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * Float64(im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im))
        	tmp = 0.0
        	if (im <= -1.2e+64)
        		tmp = t_0;
        	elseif (im <= -8.2)
        		tmp = Float64(Float64(0.5 * Float64(fma(Float64(Float64(0.008333333333333333 * Float64(re * re)) - 0.16666666666666666), Float64(re * re), 1.0) * re)) * Float64(exp(Float64(-im)) - 1.0));
        	elseif ((im <= 7.6) || !(im <= 1.01e+62))
        		tmp = t_0;
        	else
        		tmp = Float64(Float64(0.5 * Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re)) * Float64(1.0 - exp(im)));
        	end
        	return tmp
        end
        
        code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -1.2e+64], t$95$0, If[LessEqual[im, -8.2], N[(N[(0.5 * N[(N[(N[(N[(0.008333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(re * re), $MachinePrecision] + 1.0), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 7.6], N[Not[LessEqual[im, 1.01e+62]], $MachinePrecision]], t$95$0, N[(N[(0.5 * N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\
        \mathbf{if}\;im \leq -1.2 \cdot 10^{+64}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;im \leq -8.2:\\
        \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right)\\
        
        \mathbf{elif}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if im < -1.2e64 or -8.1999999999999993 < im < 7.5999999999999996 or 1.01e62 < im

          1. Initial program 61.7%

            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

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

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

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

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot im\right) \]
            4. *-commutativeN/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot {im}^{2} - 2\right) \cdot im\right) \]
            5. unpow2N/A

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

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            7. lower-*.f64N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            8. lower-*.f64N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            9. lower--.f64N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            10. lower-*.f64N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            11. unpow2N/A

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            12. lower-*.f6499.8

              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
          5. Applied rewrites99.8%

            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)} \]

          if -1.2e64 < im < -8.1999999999999993

          1. Initial program 100.0%

            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
          2. Add Preprocessing
          3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\frac{1}{2} \cdot \left(\mathsf{fma}\left(\frac{1}{120} \cdot \left(re \cdot re\right) - \frac{1}{6}, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right) \]
              11. lift-*.f6483.3

                \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right) \]
            4. Applied rewrites83.3%

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

            if 7.5999999999999996 < im < 1.01e62

            1. Initial program 100.0%

              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right) \]
              4. Applied rewrites85.7%

                \[\leadsto \left(0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)}\right) \cdot \left(1 - e^{im}\right) \]
            5. Recombined 3 regimes into one program.
            6. Final simplification98.3%

              \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -1.2 \cdot 10^{+64}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -8.2:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \]
            7. Add Preprocessing

            Alternative 5: 58.7% accurate, 1.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.05:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \end{array} \end{array} \]
            (FPCore (re im)
             :precision binary64
             (if (<= (* 0.5 (sin re)) -0.05)
               (*
                (*
                 (* (fma (* re re) -0.16666666666666666 1.0) re)
                 (fma (* -0.16666666666666666 im) im -1.0))
                im)
               (*
                (* 0.5 re)
                (*
                 (-
                  (*
                   (*
                    (-
                     (*
                      (* (- (* (* -0.0003968253968253968 im) im) 0.016666666666666666) im)
                      im)
                     0.3333333333333333)
                    im)
                   im)
                  2.0)
                 im))))
            double code(double re, double im) {
            	double tmp;
            	if ((0.5 * sin(re)) <= -0.05) {
            		tmp = ((fma((re * re), -0.16666666666666666, 1.0) * re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
            	} else {
            		tmp = (0.5 * re) * ((((((((((-0.0003968253968253968 * im) * im) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * im) * im) - 2.0) * im);
            	}
            	return tmp;
            }
            
            function code(re, im)
            	tmp = 0.0
            	if (Float64(0.5 * sin(re)) <= -0.05)
            		tmp = Float64(Float64(Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
            	else
            		tmp = Float64(Float64(0.5 * re) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * im) * im) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * im) * im) - 2.0) * im));
            	end
            	return tmp
            end
            
            code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * im), $MachinePrecision] * im), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;0.5 \cdot \sin re \leq -0.05:\\
            \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.050000000000000003

              1. Initial program 51.3%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

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

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

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

                  \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                5. distribute-rgt-outN/A

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

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                7. lift-sin.f64N/A

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                8. unpow2N/A

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                9. associate-*r*N/A

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

                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                11. lower-*.f6486.3

                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
              5. Applied rewrites86.3%

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                7. lower-*.f6428.3

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

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

              if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

              1. Initial program 70.2%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                2. lower-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
              5. Applied rewrites93.0%

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
              6. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. lift-sin.f64N/A

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

                  \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                4. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                5. lift-sin.f6493.0

                  \[\leadsto \left(\color{blue}{\sin re} \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              7. Applied rewrites93.0%

                \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
              8. Taylor expanded in re around 0

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              9. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \left(\color{blue}{\frac{1}{2}} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. lower-*.f6474.3

                  \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              10. Applied rewrites74.3%

                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              11. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                3. lift--.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                4. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                5. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                6. lift--.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                7. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                8. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                9. associate-*r*N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                10. lower-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
              12. Applied rewrites74.3%

                \[\leadsto \left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 6: 58.6% accurate, 1.9× speedup?

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

              1. Initial program 51.3%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

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

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

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

                  \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                5. distribute-rgt-outN/A

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

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                7. lift-sin.f64N/A

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                8. unpow2N/A

                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                9. associate-*r*N/A

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

                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                11. lower-*.f6486.3

                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
              5. Applied rewrites86.3%

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                7. lower-*.f6428.3

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

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

              if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

              1. Initial program 70.2%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                2. lower-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
              5. Applied rewrites93.0%

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
              6. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. lift-sin.f64N/A

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

                  \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                4. lower-*.f64N/A

                  \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                5. lift-sin.f6493.0

                  \[\leadsto \left(\color{blue}{\sin re} \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              7. Applied rewrites93.0%

                \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
              8. Taylor expanded in re around 0

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              9. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \left(\color{blue}{\frac{1}{2}} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. lower-*.f6474.3

                  \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              10. Applied rewrites74.3%

                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              11. Taylor expanded in im around inf

                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              12. Step-by-step derivation
                1. pow2N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                2. associate-*l*N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                3. lift-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                4. lift-*.f6474.3

                  \[\leadsto \left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              13. Applied rewrites74.3%

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

            Alternative 7: 93.3% accurate, 2.0× speedup?

            \[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \end{array} \]
            (FPCore (re im)
             :precision binary64
             (*
              (* 0.5 (sin re))
              (*
               (-
                (*
                 (-
                  (*
                   (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                   im)
                  0.3333333333333333)
                 (* im im))
                2.0)
               im)))
            double code(double re, double im) {
            	return (0.5 * sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * 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 = (0.5d0 * sin(re)) * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
            end function
            
            public static double code(double re, double im) {
            	return (0.5 * Math.sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
            }
            
            def code(re, im):
            	return (0.5 * math.sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
            
            function code(re, im)
            	return Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im))
            end
            
            function tmp = code(re, im)
            	tmp = (0.5 * sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
            end
            
            code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)
            \end{array}
            
            Derivation
            1. Initial program 65.6%

              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
            2. Add Preprocessing
            3. Taylor expanded in im around 0

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

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
              2. lower-*.f64N/A

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
            5. Applied rewrites93.3%

              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
            6. Add Preprocessing

            Alternative 8: 95.6% accurate, 2.1× speedup?

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

              1. Initial program 100.0%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

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

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

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right) \]
                4. lower-*.f64N/A

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right) \]
                5. unpow2N/A

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                6. lower-*.f64100.0

                  \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
              5. Applied rewrites100.0%

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]

              if -7.99999999999999982e102 < im < -8.1999999999999993

              1. Initial program 100.0%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. Add Preprocessing
              3. Taylor expanded in im around 0

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

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

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

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

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

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

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

                    \[\leadsto \left(\frac{1}{2} \cdot \left(\mathsf{fma}\left(\frac{-1}{6}, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right) \]
                  6. lift-*.f6458.8

                    \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(-0.16666666666666666, re \cdot re, 1\right) \cdot re\right)\right) \cdot \left(e^{-im} - 1\right) \]
                4. Applied rewrites58.8%

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

                if -8.1999999999999993 < im < 7.4000000000000004

                1. Initial program 35.2%

                  \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

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

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

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

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

                    \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                  5. distribute-rgt-outN/A

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

                    \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                  7. lift-sin.f64N/A

                    \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                  8. unpow2N/A

                    \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                  9. associate-*r*N/A

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

                    \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                  11. lower-*.f6499.6

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

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

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

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

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

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

                    \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\frac{-1}{6} \cdot {im}^{2} - 1\right) \]
                  5. lift-sin.f64N/A

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

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

                    \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                  8. lower-*.f64N/A

                    \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                  9. pow2N/A

                    \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \frac{-1}{6} - 1\right) \]
                  10. lift-*.f6499.6

                    \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \]
                8. Applied rewrites99.6%

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

                if 7.4000000000000004 < im < 7.99999999999999982e102

                1. Initial program 100.0%

                  \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                2. Add Preprocessing
                3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right) \]
                  4. Applied rewrites87.5%

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

                Alternative 9: 92.5% accurate, 2.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.1 \cdot 10^{+137}:\\ \;\;\;\;\left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{elif}\;im \leq -0.048:\\ \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq 7.4:\\ \;\;\;\;\left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right)\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+102}:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \end{array} \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (if (<= im -2.1e+137)
                   (* (* (sin re) (fma (* -0.16666666666666666 im) im -1.0)) im)
                   (if (<= im -0.048)
                     (*
                      (*
                       (fma
                        (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
                        (* re re)
                        0.5)
                       re)
                      (*
                       (-
                        (*
                         (-
                          (*
                           (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                           im)
                          0.3333333333333333)
                         (* im im))
                        2.0)
                       im))
                     (if (<= im 7.4)
                       (* (* (sin re) im) (- (* (* im im) -0.16666666666666666) 1.0))
                       (if (<= im 8e+102)
                         (*
                          (* 0.5 (* (fma (* re re) -0.16666666666666666 1.0) re))
                          (- 1.0 (exp im)))
                         (*
                          (* 0.5 (sin re))
                          (* (- (* -0.3333333333333333 (* im im)) 2.0) im)))))))
                double code(double re, double im) {
                	double tmp;
                	if (im <= -2.1e+137) {
                		tmp = (sin(re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
                	} else if (im <= -0.048) {
                		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 0.5) * re) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                	} else if (im <= 7.4) {
                		tmp = (sin(re) * im) * (((im * im) * -0.16666666666666666) - 1.0);
                	} else if (im <= 8e+102) {
                		tmp = (0.5 * (fma((re * re), -0.16666666666666666, 1.0) * re)) * (1.0 - exp(im));
                	} else {
                		tmp = (0.5 * sin(re)) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                	}
                	return tmp;
                }
                
                function code(re, im)
                	tmp = 0.0
                	if (im <= -2.1e+137)
                		tmp = Float64(Float64(sin(re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
                	elseif (im <= -0.048)
                		tmp = Float64(Float64(fma(Float64(Float64(0.004166666666666667 * Float64(re * re)) - 0.08333333333333333), Float64(re * re), 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                	elseif (im <= 7.4)
                		tmp = Float64(Float64(sin(re) * im) * Float64(Float64(Float64(im * im) * -0.16666666666666666) - 1.0));
                	elseif (im <= 8e+102)
                		tmp = Float64(Float64(0.5 * Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re)) * Float64(1.0 - exp(im)));
                	else
                		tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                	end
                	return tmp
                end
                
                code[re_, im_] := If[LessEqual[im, -2.1e+137], N[(N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], If[LessEqual[im, -0.048], N[(N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.4], N[(N[(N[Sin[re], $MachinePrecision] * im), $MachinePrecision] * N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8e+102], N[(N[(0.5 * N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;im \leq -2.1 \cdot 10^{+137}:\\
                \;\;\;\;\left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
                
                \mathbf{elif}\;im \leq -0.048:\\
                \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                
                \mathbf{elif}\;im \leq 7.4:\\
                \;\;\;\;\left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right)\\
                
                \mathbf{elif}\;im \leq 8 \cdot 10^{+102}:\\
                \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 5 regimes
                2. if im < -2.0999999999999999e137

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

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

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

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

                      \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                    5. distribute-rgt-outN/A

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

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                    7. lift-sin.f64N/A

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                    8. unpow2N/A

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                    9. associate-*r*N/A

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

                      \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                    11. lower-*.f64100.0

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

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

                  if -2.0999999999999999e137 < im < -0.048000000000000001

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

                      \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                  5. Applied rewrites54.6%

                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                  6. Taylor expanded in re around 0

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

                      \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    2. lower-*.f64N/A

                      \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    3. +-commutativeN/A

                      \[\leadsto \left(\left({re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    4. *-commutativeN/A

                      \[\leadsto \left(\left(\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    5. lower-fma.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    6. lower--.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    7. lower-*.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    8. unpow2N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    9. lower-*.f64N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    10. unpow2N/A

                      \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    11. lower-*.f6462.5

                      \[\leadsto \left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                  8. Applied rewrites62.5%

                    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]

                  if -0.048000000000000001 < im < 7.4000000000000004

                  1. Initial program 35.2%

                    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

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

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

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

                      \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                    5. distribute-rgt-outN/A

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

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                    7. lift-sin.f64N/A

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                    8. unpow2N/A

                      \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                    9. associate-*r*N/A

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

                      \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                    11. lower-*.f6499.6

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

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

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

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

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

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

                      \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\frac{-1}{6} \cdot {im}^{2} - 1\right) \]
                    5. lift-sin.f64N/A

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

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

                      \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                    8. lower-*.f64N/A

                      \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                    9. pow2N/A

                      \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \frac{-1}{6} - 1\right) \]
                    10. lift-*.f6499.6

                      \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \]
                  8. Applied rewrites99.6%

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

                  if 7.4000000000000004 < im < 7.99999999999999982e102

                  1. Initial program 100.0%

                    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                  2. Add Preprocessing
                  3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

                        \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right) \]
                    4. Applied rewrites87.5%

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

                    if 7.99999999999999982e102 < im

                    1. Initial program 100.0%

                      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in im around 0

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

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

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

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right) \]
                      4. lower-*.f64N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right) \]
                      5. unpow2N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                      6. lower-*.f64100.0

                        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                    5. Applied rewrites100.0%

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

                  Alternative 10: 93.8% accurate, 2.1× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
                  (FPCore (re im)
                   :precision binary64
                   (if (or (<= im 7.6) (not (<= im 1.01e+62)))
                     (*
                      (* 0.5 (sin re))
                      (*
                       (-
                        (* (* (- (* -0.016666666666666666 (* im im)) 0.3333333333333333) im) im)
                        2.0)
                       im))
                     (*
                      (* 0.5 (* (fma (* re re) -0.16666666666666666 1.0) re))
                      (- 1.0 (exp im)))))
                  double code(double re, double im) {
                  	double tmp;
                  	if ((im <= 7.6) || !(im <= 1.01e+62)) {
                  		tmp = (0.5 * sin(re)) * ((((((-0.016666666666666666 * (im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im);
                  	} else {
                  		tmp = (0.5 * (fma((re * re), -0.16666666666666666, 1.0) * re)) * (1.0 - exp(im));
                  	}
                  	return tmp;
                  }
                  
                  function code(re, im)
                  	tmp = 0.0
                  	if ((im <= 7.6) || !(im <= 1.01e+62))
                  		tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * Float64(im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im));
                  	else
                  		tmp = Float64(Float64(0.5 * Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re)) * Float64(1.0 - exp(im)));
                  	end
                  	return tmp
                  end
                  
                  code[re_, im_] := If[Or[LessEqual[im, 7.6], N[Not[LessEqual[im, 1.01e+62]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\
                  \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 2 regimes
                  2. if im < 7.5999999999999996 or 1.01e62 < im

                    1. Initial program 63.6%

                      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in im around 0

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

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

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

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot im\right) \]
                      4. *-commutativeN/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot {im}^{2} - 2\right) \cdot im\right) \]
                      5. unpow2N/A

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

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      7. lower-*.f64N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      8. lower-*.f64N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      9. lower--.f64N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      10. lower-*.f64N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      11. unpow2N/A

                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      12. lower-*.f6495.5

                        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                    5. Applied rewrites95.5%

                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)} \]

                    if 7.5999999999999996 < im < 1.01e62

                    1. Initial program 100.0%

                      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                    2. Add Preprocessing
                    3. Taylor expanded in im around 0

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

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

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

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

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

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

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

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

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

                          \[\leadsto \left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right) \]
                      4. Applied rewrites85.7%

                        \[\leadsto \left(0.5 \cdot \color{blue}{\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)}\right) \cdot \left(1 - e^{im}\right) \]
                    5. Recombined 2 regimes into one program.
                    6. Final simplification94.9%

                      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 7.6 \lor \neg \left(im \leq 1.01 \cdot 10^{+62}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right)\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \]
                    7. Add Preprocessing

                    Alternative 11: 57.1% accurate, 2.1× speedup?

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

                      1. Initial program 51.3%

                        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

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

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

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

                          \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                        5. distribute-rgt-outN/A

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

                          \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                        7. lift-sin.f64N/A

                          \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                        8. unpow2N/A

                          \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                        9. associate-*r*N/A

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

                          \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                        11. lower-*.f6486.3

                          \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                      5. Applied rewrites86.3%

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                        7. lower-*.f6428.3

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

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

                      if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

                      1. Initial program 70.2%

                        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                      2. Add Preprocessing
                      3. Taylor expanded in im around 0

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

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

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

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot im\right) \]
                        4. *-commutativeN/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot {im}^{2} - 2\right) \cdot im\right) \]
                        5. unpow2N/A

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

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        7. lower-*.f64N/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        8. lower-*.f64N/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        9. lower--.f64N/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        10. lower-*.f64N/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        11. unpow2N/A

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                        12. lower-*.f6489.4

                          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      5. Applied rewrites89.4%

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

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

                          \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                      8. Recombined 2 regimes into one program.
                      9. Add Preprocessing

                      Alternative 12: 53.6% accurate, 2.1× speedup?

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

                        1. Initial program 51.3%

                          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

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

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

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

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

                            \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                          5. distribute-rgt-outN/A

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

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                          7. lift-sin.f64N/A

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                          8. unpow2N/A

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                          9. associate-*r*N/A

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

                            \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                          11. lower-*.f6486.3

                            \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                        5. Applied rewrites86.3%

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

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

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

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

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

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

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

                            \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                          7. lower-*.f6428.3

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

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

                        if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

                        1. Initial program 70.2%

                          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                        2. Add Preprocessing
                        3. Taylor expanded in im around 0

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

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

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

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

                            \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                          5. distribute-rgt-outN/A

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

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                          7. lift-sin.f64N/A

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                          8. unpow2N/A

                            \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                          9. associate-*r*N/A

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

                            \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                          11. lower-*.f6480.4

                            \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                        5. Applied rewrites80.4%

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

                          \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                        7. Step-by-step derivation
                          1. Applied rewrites62.9%

                            \[\leadsto \left(re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                          2. Step-by-step derivation
                            1. lift-*.f64N/A

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

                              \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                            3. lift-*.f64N/A

                              \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                            4. lift-fma.f64N/A

                              \[\leadsto \left(re \cdot \left(\left(\frac{-1}{6} \cdot im\right) \cdot im + -1\right)\right) \cdot im \]
                            5. associate-*l*N/A

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

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

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

                              \[\leadsto re \cdot \left(\mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right) \cdot im\right) \]
                            9. lift-*.f6466.3

                              \[\leadsto re \cdot \left(\mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right) \cdot im\right) \]
                          3. Applied rewrites66.3%

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

                        Alternative 13: 81.9% accurate, 2.3× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+140}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{elif}\;im \leq -9.8 \cdot 10^{-8}:\\ \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq 1.06 \cdot 10^{+32}:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left({im}^{7} \cdot -0.0003968253968253968\right)\\ \end{array} \end{array} \]
                        (FPCore (re im)
                         :precision binary64
                         (if (<= im -2.8e+140)
                           (*
                            (*
                             (* (fma (* re re) -0.16666666666666666 1.0) re)
                             (fma (* -0.16666666666666666 im) im -1.0))
                            im)
                           (if (<= im -9.8e-8)
                             (*
                              (*
                               (fma
                                (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
                                (* re re)
                                0.5)
                               re)
                              (*
                               (-
                                (*
                                 (-
                                  (*
                                   (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                                   im)
                                  0.3333333333333333)
                                 (* im im))
                                2.0)
                               im))
                             (if (<= im 1.06e+32)
                               (* (- (sin re)) im)
                               (* (* 0.5 re) (* (pow im 7.0) -0.0003968253968253968))))))
                        double code(double re, double im) {
                        	double tmp;
                        	if (im <= -2.8e+140) {
                        		tmp = ((fma((re * re), -0.16666666666666666, 1.0) * re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
                        	} else if (im <= -9.8e-8) {
                        		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 0.5) * re) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                        	} else if (im <= 1.06e+32) {
                        		tmp = -sin(re) * im;
                        	} else {
                        		tmp = (0.5 * re) * (pow(im, 7.0) * -0.0003968253968253968);
                        	}
                        	return tmp;
                        }
                        
                        function code(re, im)
                        	tmp = 0.0
                        	if (im <= -2.8e+140)
                        		tmp = Float64(Float64(Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
                        	elseif (im <= -9.8e-8)
                        		tmp = Float64(Float64(fma(Float64(Float64(0.004166666666666667 * Float64(re * re)) - 0.08333333333333333), Float64(re * re), 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                        	elseif (im <= 1.06e+32)
                        		tmp = Float64(Float64(-sin(re)) * im);
                        	else
                        		tmp = Float64(Float64(0.5 * re) * Float64((im ^ 7.0) * -0.0003968253968253968));
                        	end
                        	return tmp
                        end
                        
                        code[re_, im_] := If[LessEqual[im, -2.8e+140], N[(N[(N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], If[LessEqual[im, -9.8e-8], N[(N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.06e+32], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Power[im, 7.0], $MachinePrecision] * -0.0003968253968253968), $MachinePrecision]), $MachinePrecision]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;im \leq -2.8 \cdot 10^{+140}:\\
                        \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
                        
                        \mathbf{elif}\;im \leq -9.8 \cdot 10^{-8}:\\
                        \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                        
                        \mathbf{elif}\;im \leq 1.06 \cdot 10^{+32}:\\
                        \;\;\;\;\left(-\sin re\right) \cdot im\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\left(0.5 \cdot re\right) \cdot \left({im}^{7} \cdot -0.0003968253968253968\right)\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 4 regimes
                        2. if im < -2.79999999999999983e140

                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

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

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

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

                              \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                            5. distribute-rgt-outN/A

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

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                            7. lift-sin.f64N/A

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                            8. unpow2N/A

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                            9. associate-*r*N/A

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

                              \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                            11. lower-*.f64100.0

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

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

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

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

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

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

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

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

                              \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                            7. lower-*.f6485.7

                              \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                          8. Applied rewrites85.7%

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

                          if -2.79999999999999983e140 < im < -9.8000000000000004e-8

                          1. Initial program 98.7%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                            2. lower-*.f64N/A

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                          5. Applied rewrites60.3%

                            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                          6. Taylor expanded in re around 0

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

                              \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            2. lower-*.f64N/A

                              \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            3. +-commutativeN/A

                              \[\leadsto \left(\left({re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            4. *-commutativeN/A

                              \[\leadsto \left(\left(\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            5. lower-fma.f64N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            6. lower--.f64N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            7. lower-*.f64N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            8. unpow2N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            9. lower-*.f64N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            10. unpow2N/A

                              \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            11. lower-*.f6463.0

                              \[\leadsto \left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          8. Applied rewrites63.0%

                            \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]

                          if -9.8000000000000004e-8 < im < 1.0600000000000001e32

                          1. Initial program 36.8%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

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

                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                            3. lower-*.f64N/A

                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                            4. mul-1-negN/A

                              \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                            5. lower-neg.f64N/A

                              \[\leadsto \left(-\sin re\right) \cdot im \]
                            6. lift-sin.f6496.7

                              \[\leadsto \left(-\sin re\right) \cdot im \]
                          5. Applied rewrites96.7%

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

                          if 1.0600000000000001e32 < im

                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                            2. lower-*.f64N/A

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                          5. Applied rewrites94.3%

                            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                          6. Step-by-step derivation
                            1. lift-*.f64N/A

                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            2. lift-sin.f64N/A

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

                              \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            4. lower-*.f64N/A

                              \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            5. lift-sin.f6494.3

                              \[\leadsto \left(\color{blue}{\sin re} \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          7. Applied rewrites94.3%

                            \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                          8. Taylor expanded in re around 0

                            \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          9. Step-by-step derivation
                            1. *-commutativeN/A

                              \[\leadsto \left(\color{blue}{\frac{1}{2}} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            2. lower-*.f6475.5

                              \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          10. Applied rewrites75.5%

                            \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          11. Taylor expanded in im around inf

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

                              \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left({im}^{7} \cdot \frac{-1}{2520}\right) \]
                            2. lower-*.f64N/A

                              \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left({im}^{7} \cdot \frac{-1}{2520}\right) \]
                            3. lower-pow.f6477.0

                              \[\leadsto \left(0.5 \cdot re\right) \cdot \left({im}^{7} \cdot -0.0003968253968253968\right) \]
                          13. Applied rewrites77.0%

                            \[\leadsto \left(0.5 \cdot re\right) \cdot \left({im}^{7} \cdot \color{blue}{-0.0003968253968253968}\right) \]
                        3. Recombined 4 regimes into one program.
                        4. Add Preprocessing

                        Alternative 14: 53.0% accurate, 2.3× speedup?

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

                          1. Initial program 51.3%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

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

                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                            3. lower-*.f64N/A

                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                            4. mul-1-negN/A

                              \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                            5. lower-neg.f64N/A

                              \[\leadsto \left(-\sin re\right) \cdot im \]
                            6. lift-sin.f6454.8

                              \[\leadsto \left(-\sin re\right) \cdot im \]
                          5. Applied rewrites54.8%

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\left(re \cdot re\right) \cdot im, \frac{1}{6}, -1 \cdot im\right) \cdot re \]
                            10. mul-1-negN/A

                              \[\leadsto \mathsf{fma}\left(\left(re \cdot re\right) \cdot im, \frac{1}{6}, \mathsf{neg}\left(im\right)\right) \cdot re \]
                            11. lower-neg.f6422.5

                              \[\leadsto \mathsf{fma}\left(\left(re \cdot re\right) \cdot im, 0.16666666666666666, -im\right) \cdot re \]
                          8. Applied rewrites22.5%

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

                          if -0.050000000000000003 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re))

                          1. Initial program 70.2%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                          2. Add Preprocessing
                          3. Taylor expanded in im around 0

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

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

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

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

                              \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                            5. distribute-rgt-outN/A

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

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                            7. lift-sin.f64N/A

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                            8. unpow2N/A

                              \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                            9. associate-*r*N/A

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

                              \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                            11. lower-*.f6480.4

                              \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                          5. Applied rewrites80.4%

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

                            \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                          7. Step-by-step derivation
                            1. Applied rewrites62.9%

                              \[\leadsto \left(re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                            2. Step-by-step derivation
                              1. lift-*.f64N/A

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

                                \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              3. lift-*.f64N/A

                                \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              4. lift-fma.f64N/A

                                \[\leadsto \left(re \cdot \left(\left(\frac{-1}{6} \cdot im\right) \cdot im + -1\right)\right) \cdot im \]
                              5. associate-*l*N/A

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

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

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

                                \[\leadsto re \cdot \left(\mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right) \cdot im\right) \]
                              9. lift-*.f6466.3

                                \[\leadsto re \cdot \left(\mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right) \cdot im\right) \]
                            3. Applied rewrites66.3%

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

                          Alternative 15: 73.7% accurate, 2.4× speedup?

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

                            1. Initial program 69.4%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                              2. lower-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                            5. Applied rewrites94.5%

                              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                            6. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lift-sin.f64N/A

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

                                \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              4. lower-*.f64N/A

                                \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              5. lift-sin.f6494.5

                                \[\leadsto \left(\color{blue}{\sin re} \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            7. Applied rewrites94.5%

                              \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                            8. Taylor expanded in re around 0

                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            9. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \left(\color{blue}{\frac{1}{2}} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lower-*.f6474.0

                                \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            10. Applied rewrites74.0%

                              \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            11. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              3. lift--.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              4. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              5. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              6. lift--.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              7. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              8. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              9. associate-*r*N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                              10. lower-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                            12. Applied rewrites74.0%

                              \[\leadsto \left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]

                            if 7.50000000000000072e-21 < re

                            1. Initial program 54.3%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

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

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

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

                                \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                              5. distribute-rgt-outN/A

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

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              7. lift-sin.f64N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              8. unpow2N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                              9. associate-*r*N/A

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

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              11. lower-*.f6486.6

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                            5. Applied rewrites86.6%

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

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

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

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

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

                                \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\frac{-1}{6} \cdot {im}^{2} - 1\right) \]
                              5. lift-sin.f64N/A

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

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

                                \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                              8. lower-*.f64N/A

                                \[\leadsto \left(\sin re \cdot im\right) \cdot \left({im}^{2} \cdot \frac{-1}{6} - 1\right) \]
                              9. pow2N/A

                                \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot \frac{-1}{6} - 1\right) \]
                              10. lift-*.f6486.6

                                \[\leadsto \left(\sin re \cdot im\right) \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \]
                            8. Applied rewrites86.6%

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

                          Alternative 16: 73.7% accurate, 2.5× speedup?

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

                            1. Initial program 69.4%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                              2. lower-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                            5. Applied rewrites94.5%

                              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                            6. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lift-sin.f64N/A

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

                                \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              4. lower-*.f64N/A

                                \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              5. lift-sin.f6494.5

                                \[\leadsto \left(\color{blue}{\sin re} \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            7. Applied rewrites94.5%

                              \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                            8. Taylor expanded in re around 0

                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            9. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \left(\color{blue}{\frac{1}{2}} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lower-*.f6474.0

                                \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            10. Applied rewrites74.0%

                              \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            11. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              3. lift--.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              4. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              5. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              6. lift--.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              7. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              8. lift-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              9. associate-*r*N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                              10. lower-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im - \frac{1}{60}\right) \cdot \left(im \cdot im\right) - \frac{1}{3}\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]
                            12. Applied rewrites74.0%

                              \[\leadsto \left(0.5 \cdot re\right) \cdot \left(\left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right) \]

                            if 7.50000000000000072e-21 < re

                            1. Initial program 54.3%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

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

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

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

                                \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                              5. distribute-rgt-outN/A

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

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              7. lift-sin.f64N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              8. unpow2N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                              9. associate-*r*N/A

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

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              11. lower-*.f6486.6

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                            5. Applied rewrites86.6%

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

                          Alternative 17: 82.0% accurate, 2.5× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+140}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{elif}\;im \leq -9.8 \cdot 10^{-8} \lor \neg \left(im \leq 1.06 \cdot 10^{+32}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \end{array} \end{array} \]
                          (FPCore (re im)
                           :precision binary64
                           (if (<= im -2.8e+140)
                             (*
                              (*
                               (* (fma (* re re) -0.16666666666666666 1.0) re)
                               (fma (* -0.16666666666666666 im) im -1.0))
                              im)
                             (if (or (<= im -9.8e-8) (not (<= im 1.06e+32)))
                               (*
                                (*
                                 (fma
                                  (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
                                  (* re re)
                                  0.5)
                                 re)
                                (*
                                 (-
                                  (*
                                   (-
                                    (*
                                     (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                                     im)
                                    0.3333333333333333)
                                   (* im im))
                                  2.0)
                                 im))
                               (* (- (sin re)) im))))
                          double code(double re, double im) {
                          	double tmp;
                          	if (im <= -2.8e+140) {
                          		tmp = ((fma((re * re), -0.16666666666666666, 1.0) * re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
                          	} else if ((im <= -9.8e-8) || !(im <= 1.06e+32)) {
                          		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 0.5) * re) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                          	} else {
                          		tmp = -sin(re) * im;
                          	}
                          	return tmp;
                          }
                          
                          function code(re, im)
                          	tmp = 0.0
                          	if (im <= -2.8e+140)
                          		tmp = Float64(Float64(Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
                          	elseif ((im <= -9.8e-8) || !(im <= 1.06e+32))
                          		tmp = Float64(Float64(fma(Float64(Float64(0.004166666666666667 * Float64(re * re)) - 0.08333333333333333), Float64(re * re), 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                          	else
                          		tmp = Float64(Float64(-sin(re)) * im);
                          	end
                          	return tmp
                          end
                          
                          code[re_, im_] := If[LessEqual[im, -2.8e+140], N[(N[(N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], If[Or[LessEqual[im, -9.8e-8], N[Not[LessEqual[im, 1.06e+32]], $MachinePrecision]], N[(N[(N[(N[(N[(0.004166666666666667 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision]]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;im \leq -2.8 \cdot 10^{+140}:\\
                          \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
                          
                          \mathbf{elif}\;im \leq -9.8 \cdot 10^{-8} \lor \neg \left(im \leq 1.06 \cdot 10^{+32}\right):\\
                          \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\left(-\sin re\right) \cdot im\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 3 regimes
                          2. if im < -2.79999999999999983e140

                            1. Initial program 100.0%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

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

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

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

                                \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                              5. distribute-rgt-outN/A

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

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              7. lift-sin.f64N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              8. unpow2N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                              9. associate-*r*N/A

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

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              11. lower-*.f64100.0

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{6}, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              7. lower-*.f6485.7

                                \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                            8. Applied rewrites85.7%

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

                            if -2.79999999999999983e140 < im < -9.8000000000000004e-8 or 1.0600000000000001e32 < im

                            1. Initial program 99.7%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                              2. lower-*.f64N/A

                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                            5. Applied rewrites85.1%

                              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                            6. Taylor expanded in re around 0

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

                                \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              2. lower-*.f64N/A

                                \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              3. +-commutativeN/A

                                \[\leadsto \left(\left({re}^{2} \cdot \left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              4. *-commutativeN/A

                                \[\leadsto \left(\left(\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}\right) \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              5. lower-fma.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              6. lower--.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              7. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot {re}^{2} - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              8. unpow2N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              9. lower-*.f64N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, {re}^{2}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              10. unpow2N/A

                                \[\leadsto \left(\mathsf{fma}\left(\frac{1}{240} \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              11. lower-*.f6472.2

                                \[\leadsto \left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            8. Applied rewrites72.2%

                              \[\leadsto \color{blue}{\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]

                            if -9.8000000000000004e-8 < im < 1.0600000000000001e32

                            1. Initial program 36.8%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

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

                                \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                              3. lower-*.f64N/A

                                \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                              4. mul-1-negN/A

                                \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                              5. lower-neg.f64N/A

                                \[\leadsto \left(-\sin re\right) \cdot im \]
                              6. lift-sin.f6496.7

                                \[\leadsto \left(-\sin re\right) \cdot im \]
                            5. Applied rewrites96.7%

                              \[\leadsto \color{blue}{\left(-\sin re\right) \cdot im} \]
                          3. Recombined 3 regimes into one program.
                          4. Final simplification87.0%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.8 \cdot 10^{+140}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{elif}\;im \leq -9.8 \cdot 10^{-8} \lor \neg \left(im \leq 1.06 \cdot 10^{+32}\right):\\ \;\;\;\;\left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \end{array} \]
                          5. Add Preprocessing

                          Alternative 18: 50.4% accurate, 9.6× speedup?

                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2.45 \lor \neg \left(im \leq 2.05 \cdot 10^{-9}\right):\\ \;\;\;\;\left(re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \end{array} \]
                          (FPCore (re im)
                           :precision binary64
                           (if (or (<= im -2.45) (not (<= im 2.05e-9)))
                             (* (* re (* (* im im) -0.16666666666666666)) im)
                             (* (- re) im)))
                          double code(double re, double im) {
                          	double tmp;
                          	if ((im <= -2.45) || !(im <= 2.05e-9)) {
                          		tmp = (re * ((im * im) * -0.16666666666666666)) * im;
                          	} else {
                          		tmp = -re * im;
                          	}
                          	return tmp;
                          }
                          
                          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
                              real(8) :: tmp
                              if ((im <= (-2.45d0)) .or. (.not. (im <= 2.05d-9))) then
                                  tmp = (re * ((im * im) * (-0.16666666666666666d0))) * im
                              else
                                  tmp = -re * im
                              end if
                              code = tmp
                          end function
                          
                          public static double code(double re, double im) {
                          	double tmp;
                          	if ((im <= -2.45) || !(im <= 2.05e-9)) {
                          		tmp = (re * ((im * im) * -0.16666666666666666)) * im;
                          	} else {
                          		tmp = -re * im;
                          	}
                          	return tmp;
                          }
                          
                          def code(re, im):
                          	tmp = 0
                          	if (im <= -2.45) or not (im <= 2.05e-9):
                          		tmp = (re * ((im * im) * -0.16666666666666666)) * im
                          	else:
                          		tmp = -re * im
                          	return tmp
                          
                          function code(re, im)
                          	tmp = 0.0
                          	if ((im <= -2.45) || !(im <= 2.05e-9))
                          		tmp = Float64(Float64(re * Float64(Float64(im * im) * -0.16666666666666666)) * im);
                          	else
                          		tmp = Float64(Float64(-re) * im);
                          	end
                          	return tmp
                          end
                          
                          function tmp_2 = code(re, im)
                          	tmp = 0.0;
                          	if ((im <= -2.45) || ~((im <= 2.05e-9)))
                          		tmp = (re * ((im * im) * -0.16666666666666666)) * im;
                          	else
                          		tmp = -re * im;
                          	end
                          	tmp_2 = tmp;
                          end
                          
                          code[re_, im_] := If[Or[LessEqual[im, -2.45], N[Not[LessEqual[im, 2.05e-9]], $MachinePrecision]], N[(N[(re * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                          
                          \begin{array}{l}
                          
                          \\
                          \begin{array}{l}
                          \mathbf{if}\;im \leq -2.45 \lor \neg \left(im \leq 2.05 \cdot 10^{-9}\right):\\
                          \;\;\;\;\left(re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\left(-re\right) \cdot im\\
                          
                          
                          \end{array}
                          \end{array}
                          
                          Derivation
                          1. Split input into 2 regimes
                          2. if im < -2.4500000000000002 or 2.0500000000000002e-9 < im

                            1. Initial program 99.6%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. Add Preprocessing
                            3. Taylor expanded in im around 0

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

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

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

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

                                \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                              5. distribute-rgt-outN/A

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

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              7. lift-sin.f64N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                              8. unpow2N/A

                                \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                              9. associate-*r*N/A

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

                                \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                              11. lower-*.f6462.0

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

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

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

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

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

                                  \[\leadsto \left(re \cdot \left({im}^{2} \cdot \frac{-1}{6}\right)\right) \cdot im \]
                                2. pow2N/A

                                  \[\leadsto \left(re \cdot \left(\left(im \cdot im\right) \cdot \frac{-1}{6}\right)\right) \cdot im \]
                                3. lift-*.f64N/A

                                  \[\leadsto \left(re \cdot \left(\left(im \cdot im\right) \cdot \frac{-1}{6}\right)\right) \cdot im \]
                                4. lift-*.f6446.4

                                  \[\leadsto \left(re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im \]
                              4. Applied rewrites46.4%

                                \[\leadsto \left(re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im \]

                              if -2.4500000000000002 < im < 2.0500000000000002e-9

                              1. Initial program 34.6%

                                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                              2. Add Preprocessing
                              3. Taylor expanded in im around 0

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

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

                                  \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                3. lower-*.f64N/A

                                  \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                4. mul-1-negN/A

                                  \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                                5. lower-neg.f64N/A

                                  \[\leadsto \left(-\sin re\right) \cdot im \]
                                6. lift-sin.f6499.8

                                  \[\leadsto \left(-\sin re\right) \cdot im \]
                              5. Applied rewrites99.8%

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

                                \[\leadsto \left(-re\right) \cdot im \]
                              7. Step-by-step derivation
                                1. Applied rewrites58.2%

                                  \[\leadsto \left(-re\right) \cdot im \]
                              8. Recombined 2 regimes into one program.
                              9. Final simplification52.6%

                                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2.45 \lor \neg \left(im \leq 2.05 \cdot 10^{-9}\right):\\ \;\;\;\;\left(re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \]
                              10. Add Preprocessing

                              Alternative 19: 53.7% accurate, 14.4× speedup?

                              \[\begin{array}{l} \\ re \cdot \left(\mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right) \cdot im\right) \end{array} \]
                              (FPCore (re im)
                               :precision binary64
                               (* re (* (fma (* -0.16666666666666666 im) im -1.0) im)))
                              double code(double re, double im) {
                              	return re * (fma((-0.16666666666666666 * im), im, -1.0) * im);
                              }
                              
                              function code(re, im)
                              	return Float64(re * Float64(fma(Float64(-0.16666666666666666 * im), im, -1.0) * im))
                              end
                              
                              code[re_, im_] := N[(re * N[(N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]
                              
                              \begin{array}{l}
                              
                              \\
                              re \cdot \left(\mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right) \cdot im\right)
                              \end{array}
                              
                              Derivation
                              1. Initial program 65.6%

                                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                              2. Add Preprocessing
                              3. Taylor expanded in im around 0

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

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

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

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

                                  \[\leadsto \left(\left(\frac{-1}{6} \cdot {im}^{2}\right) \cdot \sin re + -1 \cdot \sin re\right) \cdot im \]
                                5. distribute-rgt-outN/A

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

                                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                                7. lift-sin.f64N/A

                                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot {im}^{2} + -1\right)\right) \cdot im \]
                                8. unpow2N/A

                                  \[\leadsto \left(\sin re \cdot \left(\frac{-1}{6} \cdot \left(im \cdot im\right) + -1\right)\right) \cdot im \]
                                9. associate-*r*N/A

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

                                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                                11. lower-*.f6481.8

                                  \[\leadsto \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                              5. Applied rewrites81.8%

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

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

                                  \[\leadsto \left(re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im \]
                                2. Step-by-step derivation
                                  1. lift-*.f64N/A

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

                                    \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                                  3. lift-*.f64N/A

                                    \[\leadsto \left(re \cdot \mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right)\right) \cdot im \]
                                  4. lift-fma.f64N/A

                                    \[\leadsto \left(re \cdot \left(\left(\frac{-1}{6} \cdot im\right) \cdot im + -1\right)\right) \cdot im \]
                                  5. associate-*l*N/A

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

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

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

                                    \[\leadsto re \cdot \left(\mathsf{fma}\left(\frac{-1}{6} \cdot im, im, -1\right) \cdot im\right) \]
                                  9. lift-*.f6455.2

                                    \[\leadsto re \cdot \left(\mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right) \cdot im\right) \]
                                3. Applied rewrites55.2%

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

                                Alternative 20: 33.5% accurate, 39.5× speedup?

                                \[\begin{array}{l} \\ \left(-re\right) \cdot im \end{array} \]
                                (FPCore (re im) :precision binary64 (* (- re) im))
                                double code(double re, double im) {
                                	return -re * 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 = -re * im
                                end function
                                
                                public static double code(double re, double im) {
                                	return -re * im;
                                }
                                
                                def code(re, im):
                                	return -re * im
                                
                                function code(re, im)
                                	return Float64(Float64(-re) * im)
                                end
                                
                                function tmp = code(re, im)
                                	tmp = -re * im;
                                end
                                
                                code[re_, im_] := N[((-re) * im), $MachinePrecision]
                                
                                \begin{array}{l}
                                
                                \\
                                \left(-re\right) \cdot im
                                \end{array}
                                
                                Derivation
                                1. Initial program 65.6%

                                  \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                                2. Add Preprocessing
                                3. Taylor expanded in im around 0

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

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

                                    \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                  3. lower-*.f64N/A

                                    \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                  4. mul-1-negN/A

                                    \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                                  5. lower-neg.f64N/A

                                    \[\leadsto \left(-\sin re\right) \cdot im \]
                                  6. lift-sin.f6454.8

                                    \[\leadsto \left(-\sin re\right) \cdot im \]
                                5. Applied rewrites54.8%

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

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

                                    \[\leadsto \left(-re\right) \cdot im \]
                                  2. Add Preprocessing

                                  Developer Target 1: 99.8% accurate, 1.0× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|im\right| < 1:\\ \;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \end{array} \end{array} \]
                                  (FPCore (re im)
                                   :precision binary64
                                   (if (< (fabs im) 1.0)
                                     (-
                                      (*
                                       (sin re)
                                       (+
                                        (+ im (* (* (* 0.16666666666666666 im) im) im))
                                        (* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
                                     (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
                                  double code(double re, double im) {
                                  	double tmp;
                                  	if (fabs(im) < 1.0) {
                                  		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                  	} else {
                                  		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  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
                                      real(8) :: tmp
                                      if (abs(im) < 1.0d0) then
                                          tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
                                      else
                                          tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double re, double im) {
                                  	double tmp;
                                  	if (Math.abs(im) < 1.0) {
                                  		tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                  	} else {
                                  		tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(re, im):
                                  	tmp = 0
                                  	if math.fabs(im) < 1.0:
                                  		tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)))
                                  	else:
                                  		tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
                                  	return tmp
                                  
                                  function code(re, im)
                                  	tmp = 0.0
                                  	if (abs(im) < 1.0)
                                  		tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im))));
                                  	else
                                  		tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)));
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(re, im)
                                  	tmp = 0.0;
                                  	if (abs(im) < 1.0)
                                  		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                  	else
                                  		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;\left|im\right| < 1:\\
                                  \;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  

                                  Reproduce

                                  ?
                                  herbie shell --seed 2025037 
                                  (FPCore (re im)
                                    :name "math.cos on complex, imaginary part"
                                    :precision binary64
                                  
                                    :alt
                                    (! :herbie-platform default (if (< (fabs im) 1) (- (* (sin re) (+ im (* 1/6 im im im) (* 1/120 im im im im im)))) (* (* 1/2 (sin re)) (- (exp (- im)) (exp im)))))
                                  
                                    (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))