math.cos on complex, imaginary part

Percentage Accurate: 66.3% → 99.8%
Time: 6.2s
Alternatives: 25
Speedup: 2.3×

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}

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 25 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: 66.3% 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.8% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -0.065:\\ \;\;\;\;t\_0 \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{elif}\;im \leq 3.7:\\ \;\;\;\;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 -0.065)
     (* t_0 (- (exp (- im)) (exp im)))
     (if (<= im 3.7)
       (*
        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 <= -0.065) {
		tmp = t_0 * (exp(-im) - exp(im));
	} else if (im <= 3.7) {
		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 <= (-0.065d0)) then
        tmp = t_0 * (exp(-im) - exp(im))
    else if (im <= 3.7d0) 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 <= -0.065) {
		tmp = t_0 * (Math.exp(-im) - Math.exp(im));
	} else if (im <= 3.7) {
		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 <= -0.065:
		tmp = t_0 * (math.exp(-im) - math.exp(im))
	elif im <= 3.7:
		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 <= -0.065)
		tmp = Float64(t_0 * Float64(exp(Float64(-im)) - exp(im)));
	elseif (im <= 3.7)
		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 <= -0.065)
		tmp = t_0 * (exp(-im) - exp(im));
	elseif (im <= 3.7)
		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, -0.065], N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.7], 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 -0.065:\\
\;\;\;\;t\_0 \cdot \left(e^{-im} - e^{im}\right)\\

\mathbf{elif}\;im \leq 3.7:\\
\;\;\;\;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 < -0.065000000000000002

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Add Preprocessing

    if -0.065000000000000002 < im < 3.7000000000000002

    1. Initial program 31.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 rewrites99.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)} \]

    if 3.7000000000000002 < im

    1. Initial program 99.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 \left(\color{blue}{1} - e^{im}\right) \]
    4. Step-by-step derivation
      1. Applied rewrites99.9%

        \[\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: 73.5% accurate, 0.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \mathbf{if}\;t\_0 \leq -\infty:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(-1, im, 1\right) - \mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)\right)\\ \mathbf{elif}\;t\_0 \leq 0:\\ \;\;\;\;\left(-\sin re\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
     (let* ((t_0 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
       (if (<= t_0 (- INFINITY))
         (* (* 0.5 re) (- (fma -1.0 im 1.0) (fma (fma im 0.5 1.0) im 1.0)))
         (if (<= t_0 0.0)
           (* (- (sin re)) 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 t_0 = (0.5 * sin(re)) * (exp(-im) - exp(im));
    	double tmp;
    	if (t_0 <= -((double) INFINITY)) {
    		tmp = (0.5 * re) * (fma(-1.0, im, 1.0) - fma(fma(im, 0.5, 1.0), im, 1.0));
    	} else if (t_0 <= 0.0) {
    		tmp = -sin(re) * 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)
    	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)))
    	tmp = 0.0
    	if (t_0 <= Float64(-Inf))
    		tmp = Float64(Float64(0.5 * re) * Float64(fma(-1.0, im, 1.0) - fma(fma(im, 0.5, 1.0), im, 1.0)));
    	elseif (t_0 <= 0.0)
    		tmp = Float64(Float64(-sin(re)) * 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_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, (-Infinity)], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(-1.0 * im + 1.0), $MachinePrecision] - N[(N[(im * 0.5 + 1.0), $MachinePrecision] * im + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 0.0], N[((-N[Sin[re], $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}
    t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
    \mathbf{if}\;t\_0 \leq -\infty:\\
    \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(-1, im, 1\right) - \mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)\right)\\
    
    \mathbf{elif}\;t\_0 \leq 0:\\
    \;\;\;\;\left(-\sin re\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 3 regimes
    2. if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -inf.0

      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 rewrites49.8%

          \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
        3. Step-by-step derivation
          1. Applied rewrites38.5%

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \left(\frac{1}{2} \cdot re\right) \cdot \left(\left(-1 \cdot im + 1\right) - \mathsf{fma}\left(\mathsf{fma}\left(im, \frac{1}{2}, 1\right), im, 1\right)\right) \]
            4. lower-fma.f6432.7

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

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

          if -inf.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < 0.0

          1. Initial program 30.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.f6499.0

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

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

          if 0.0 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)))

          1. Initial program 98.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 rewrites87.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-*.f6466.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 rewrites66.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) \]
        4. Recombined 3 regimes into one program.
        5. Add Preprocessing

        Alternative 3: 39.6% accurate, 0.9× speedup?

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

          1. Initial program 99.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 \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\color{blue}{1} - e^{im}\right) \]
          4. Step-by-step derivation
            1. Applied rewrites49.5%

              \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
            3. Step-by-step derivation
              1. Applied rewrites38.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -4.9999999999999998e-8 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)))

              1. Initial program 54.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 \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.f6466.3

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

                \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
              7. Step-by-step derivation
                1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                15. lift-neg.f6441.6

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

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

                \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
              10. Step-by-step derivation
                1. lift-*.f6442.1

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

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

            Alternative 4: 39.6% accurate, 0.9× speedup?

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

              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 rewrites49.8%

                  \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                3. Step-by-step derivation
                  1. Applied rewrites38.4%

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

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

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

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

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

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

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

                      \[\leadsto \left(0.5 \cdot re\right) \cdot \left(1 - \mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)\right) \]
                  4. Applied rewrites32.6%

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

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

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

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

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

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

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

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

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

                      \[\leadsto \left(0.5 \cdot re\right) \cdot \left(1 - \mathsf{fma}\left(im \cdot im, 0.5, im\right)\right) \]
                  7. Applied rewrites32.6%

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

                  if -2e6 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)))

                  1. Initial program 55.1%

                    \[\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.f6466.3

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

                    \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                  7. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                    15. lift-neg.f6441.5

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

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

                    \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
                  10. Step-by-step derivation
                    1. lift-*.f6441.9

                      \[\leadsto \mathsf{fma}\left(0.16666666666666666 \cdot im, re \cdot re, -im\right) \cdot re \]
                  11. Applied rewrites41.9%

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

                Alternative 5: 39.6% accurate, 0.9× speedup?

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

                  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 rewrites49.8%

                      \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                    3. Step-by-step derivation
                      1. Applied rewrites38.4%

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

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

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

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

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

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

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

                          \[\leadsto \left(0.5 \cdot re\right) \cdot \left(1 - \mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)\right) \]
                      4. Applied rewrites32.6%

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

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

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

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

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

                          \[\leadsto \left(0.5 \cdot re\right) \cdot \left(1 - \left(im \cdot im\right) \cdot 0.5\right) \]
                      7. Applied rewrites32.6%

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

                      if -2e6 < (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)))

                      1. Initial program 55.1%

                        \[\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.f6466.3

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

                        \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                      7. Step-by-step derivation
                        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                        15. lift-neg.f6441.5

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
                      10. Step-by-step derivation
                        1. lift-*.f6441.9

                          \[\leadsto \mathsf{fma}\left(0.16666666666666666 \cdot im, re \cdot re, -im\right) \cdot re \]
                      11. Applied rewrites41.9%

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

                    Alternative 6: 53.4% accurate, 1.2× speedup?

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

                      1. Initial program 55.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 \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.f6450.4

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

                        \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                      7. Step-by-step derivation
                        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                        15. lift-neg.f6423.8

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

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

                        \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
                      10. Step-by-step derivation
                        1. lift-*.f6423.1

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

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

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

                      1. Initial program 73.1%

                        \[\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-*.f6484.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 rewrites84.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)} \]
                      6. Taylor expanded in re around 0

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

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

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

                        1. Initial program 56.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 \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.f6449.9

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

                          \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                        7. Step-by-step derivation
                          1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                          15. lift-neg.f6423.4

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot \frac{-1}{120}, re \cdot re, -im\right) \cdot re \]
                          6. lift-*.f6423.4

                            \[\leadsto \mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot -0.008333333333333333, re \cdot re, -im\right) \cdot re \]
                        11. Applied rewrites23.4%

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

                      Alternative 7: 99.0% accurate, 1.4× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -3.3 \cdot 10^{+44}:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -15.6:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 3.7:\\ \;\;\;\;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.3e+44)
                           (*
                            t_0
                            (*
                             (-
                              (*
                               (-
                                (* (* (* (* -0.0003968253968253968 im) im) im) im)
                                0.3333333333333333)
                               (* im im))
                              2.0)
                             im))
                           (if (<= im -15.6)
                             (* (* 0.5 re) (- (exp (- im)) 1.0))
                             (if (<= im 3.7)
                               (*
                                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.3e+44) {
                      		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                      	} else if (im <= -15.6) {
                      		tmp = (0.5 * re) * (exp(-im) - 1.0);
                      	} else if (im <= 3.7) {
                      		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.3d+44)) then
                              tmp = t_0 * (((((((((-0.0003968253968253968d0) * im) * im) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                          else if (im <= (-15.6d0)) then
                              tmp = (0.5d0 * re) * (exp(-im) - 1.0d0)
                          else if (im <= 3.7d0) 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.3e+44) {
                      		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                      	} else if (im <= -15.6) {
                      		tmp = (0.5 * re) * (Math.exp(-im) - 1.0);
                      	} else if (im <= 3.7) {
                      		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.3e+44:
                      		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
                      	elif im <= -15.6:
                      		tmp = (0.5 * re) * (math.exp(-im) - 1.0)
                      	elif im <= 3.7:
                      		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.3e+44)
                      		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                      	elseif (im <= -15.6)
                      		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                      	elseif (im <= 3.7)
                      		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.3e+44)
                      		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                      	elseif (im <= -15.6)
                      		tmp = (0.5 * re) * (exp(-im) - 1.0);
                      	elseif (im <= 3.7)
                      		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.3e+44], N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -15.6], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.7], 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.3 \cdot 10^{+44}:\\
                      \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                      
                      \mathbf{elif}\;im \leq -15.6:\\
                      \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                      
                      \mathbf{elif}\;im \leq 3.7:\\
                      \;\;\;\;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 4 regimes
                      2. if im < -3.30000000000000013e44

                        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 rewrites100.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 im around inf

                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

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

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

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

                        if -3.30000000000000013e44 < im < -15.5999999999999996

                        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 rewrites99.8%

                            \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                          3. Step-by-step derivation
                            1. Applied rewrites77.8%

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

                            if -15.5999999999999996 < im < 3.7000000000000002

                            1. Initial program 31.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 rewrites99.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)} \]

                            if 3.7000000000000002 < im

                            1. Initial program 99.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 \left(\color{blue}{1} - e^{im}\right) \]
                            4. Step-by-step derivation
                              1. Applied rewrites99.9%

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

                            Alternative 8: 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.7:\\ \;\;\;\;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.7)
                                   (*
                                    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.7) {
                            		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.7d0) 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.7) {
                            		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.7:
                            		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.7)
                            		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.7)
                            		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.7], 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.7:\\
                            \;\;\;\;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 rewrites99.9%

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

                                if -3.7999999999999998 < im < 3.7000000000000002

                                1. Initial program 31.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 rewrites99.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)} \]

                                if 3.7000000000000002 < im

                                1. Initial program 99.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 \left(\color{blue}{1} - e^{im}\right) \]
                                4. Step-by-step derivation
                                  1. Applied rewrites99.9%

                                    \[\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 9: 59.6% accurate, 1.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.005:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \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.005)
                                   (*
                                    (* (fma (* re re) -0.08333333333333333 0.5) re)
                                    (* (- (* -0.3333333333333333 (* im im)) 2.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.005) {
                                		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (((-0.3333333333333333 * (im * im)) - 2.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.005)
                                		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.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.005], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $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.005:\\
                                \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                
                                \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.0050000000000000001

                                  1. Initial program 55.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(\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-*.f6483.8

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

                                    \[\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)} \]
                                  6. Taylor expanded in re around 0

                                    \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right)\right)} \cdot \left(\left(\frac{-1}{3} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                    2. lower-*.f64N/A

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

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

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

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

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

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

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

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

                                  1. Initial program 69.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 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-*.f6470.9

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

                                    \[\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 10: 58.5% accurate, 1.7× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 2 \cdot 10^{-49}:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \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(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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)) 2e-49)
                                   (*
                                    (* (fma (* re re) -0.08333333333333333 0.5) re)
                                    (*
                                     (-
                                      (* (- (* (* -0.016666666666666666 im) im) 0.3333333333333333) (* im im))
                                      2.0)
                                     im))
                                   (*
                                    (*
                                     (fma
                                      (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
                                      (* re re)
                                      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)) <= 2e-49) {
                                		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * ((((((-0.016666666666666666 * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                	} else {
                                		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 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)) <= 2e-49)
                                		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.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 * im) * im) * 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], 2e-49], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $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 * im), $MachinePrecision] * im), $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 2 \cdot 10^{-49}:\\
                                \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                
                                \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(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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)) < 1.99999999999999987e-49

                                  1. Initial program 70.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 rewrites92.7%

                                    \[\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 im around 0

                                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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. Applied rewrites90.1%

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

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

                                        \[\leadsto \left(\left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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(\frac{-1}{12} \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2} \cdot \frac{-1}{12} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2}, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                      6. unpow2N/A

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

                                        \[\leadsto \left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                    4. Applied rewrites67.7%

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

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

                                    1. Initial program 55.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 rewrites93.4%

                                      \[\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 im around inf

                                      \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

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

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

                                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                    9. 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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                    10. 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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                      8. pow2N/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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                      9. lift-*.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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                      10. pow2N/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(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                      11. lift-*.f6435.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(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                    11. Applied rewrites35.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(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                  8. Recombined 2 regimes into one program.
                                  9. Add Preprocessing

                                  Alternative 11: 95.4% accurate, 1.9× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -3.3 \cdot 10^{+44}:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -15.6:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{else}:\\ \;\;\;\;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)\\ \end{array} \end{array} \]
                                  (FPCore (re im)
                                   :precision binary64
                                   (let* ((t_0 (* 0.5 (sin re))))
                                     (if (<= im -3.3e+44)
                                       (*
                                        t_0
                                        (*
                                         (-
                                          (*
                                           (-
                                            (* (* (* (* -0.0003968253968253968 im) im) im) im)
                                            0.3333333333333333)
                                           (* im im))
                                          2.0)
                                         im))
                                       (if (<= im -15.6)
                                         (* (* 0.5 re) (- (exp (- im)) 1.0))
                                         (*
                                          t_0
                                          (*
                                           (-
                                            (*
                                             (-
                                              (*
                                               (*
                                                (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666)
                                                im)
                                               im)
                                              0.3333333333333333)
                                             (* im im))
                                            2.0)
                                           im))))))
                                  double code(double re, double im) {
                                  	double t_0 = 0.5 * sin(re);
                                  	double tmp;
                                  	if (im <= -3.3e+44) {
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                  	} else if (im <= -15.6) {
                                  		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                  	} else {
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * 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.3d+44)) then
                                          tmp = t_0 * (((((((((-0.0003968253968253968d0) * im) * im) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                                      else if (im <= (-15.6d0)) then
                                          tmp = (0.5d0 * re) * (exp(-im) - 1.0d0)
                                      else
                                          tmp = t_0 * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * 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.3e+44) {
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                  	} else if (im <= -15.6) {
                                  		tmp = (0.5 * re) * (Math.exp(-im) - 1.0);
                                  	} else {
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(re, im):
                                  	t_0 = 0.5 * math.sin(re)
                                  	tmp = 0
                                  	if im <= -3.3e+44:
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
                                  	elif im <= -15.6:
                                  		tmp = (0.5 * re) * (math.exp(-im) - 1.0)
                                  	else:
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
                                  	return tmp
                                  
                                  function code(re, im)
                                  	t_0 = Float64(0.5 * sin(re))
                                  	tmp = 0.0
                                  	if (im <= -3.3e+44)
                                  		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                                  	elseif (im <= -15.6)
                                  		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                                  	else
                                  		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));
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(re, im)
                                  	t_0 = 0.5 * sin(re);
                                  	tmp = 0.0;
                                  	if (im <= -3.3e+44)
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * im) * im) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                  	elseif (im <= -15.6)
                                  		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                  	else
                                  		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * 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.3e+44], N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -15.6], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], 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]]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := 0.5 \cdot \sin re\\
                                  \mathbf{if}\;im \leq -3.3 \cdot 10^{+44}:\\
                                  \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                  
                                  \mathbf{elif}\;im \leq -15.6:\\
                                  \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;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)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if im < -3.30000000000000013e44

                                    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 rewrites100.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 im around inf

                                      \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

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

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

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

                                    if -3.30000000000000013e44 < im < -15.5999999999999996

                                    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 rewrites99.8%

                                        \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites77.8%

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

                                        if -15.5999999999999996 < im

                                        1. Initial program 54.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 \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.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)} \]
                                      4. Recombined 3 regimes into one program.
                                      5. Add Preprocessing

                                      Alternative 12: 58.3% accurate, 1.9× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 0.004:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \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.004)
                                         (*
                                          (* (fma (* re re) -0.08333333333333333 0.5) re)
                                          (*
                                           (-
                                            (* (- (* (* -0.016666666666666666 im) im) 0.3333333333333333) (* im im))
                                            2.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.004) {
                                      		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * ((((((-0.016666666666666666 * im) * im) - 0.3333333333333333) * (im * im)) - 2.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.004)
                                      		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                                      	else
                                      		tmp = Float64(Float64(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.004], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * 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.004:\\
                                      \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\left(0.5 \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.0040000000000000001

                                        1. Initial program 69.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 rewrites92.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)} \]
                                        6. Taylor expanded in im around 0

                                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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. Applied rewrites90.2%

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

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

                                              \[\leadsto \left(\left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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(\frac{-1}{12} \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2} \cdot \frac{-1}{12} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2}, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                            6. unpow2N/A

                                              \[\leadsto \left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                            7. lower-*.f6468.8

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

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

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

                                          1. Initial program 55.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 rewrites93.2%

                                            \[\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 \left(\frac{1}{2} \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) \]
                                          7. Step-by-step derivation
                                            1. Applied rewrites25.8%

                                              \[\leadsto \left(0.5 \cdot \color{blue}{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. Recombined 2 regimes into one program.
                                          9. Add Preprocessing

                                          Alternative 13: 95.3% accurate, 1.9× speedup?

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

                                            1. Initial program 65.1%

                                              \[\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 rewrites96.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 im around inf

                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

                                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                              4. lower-*.f6495.9

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

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

                                            if -3.30000000000000013e44 < im < -15.5999999999999996

                                            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 rewrites99.8%

                                                \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites77.8%

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

                                              Alternative 14: 58.3% accurate, 1.9× speedup?

                                              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 0.004:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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.004)
                                                 (*
                                                  (* (fma (* re re) -0.08333333333333333 0.5) re)
                                                  (*
                                                   (-
                                                    (* (- (* (* -0.016666666666666666 im) im) 0.3333333333333333) (* im im))
                                                    2.0)
                                                   im))
                                                 (*
                                                  (* re 0.5)
                                                  (*
                                                   (-
                                                    (*
                                                     (-
                                                      (* (* (* (* -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.004) {
                                              		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * ((((((-0.016666666666666666 * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                              	} else {
                                              		tmp = (re * 0.5) * ((((((((-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.004)
                                              		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                                              	else
                                              		tmp = Float64(Float64(re * 0.5) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * im) * im) * 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.004], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(re * 0.5), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * im), $MachinePrecision] * im), $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.004:\\
                                              \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                              
                                              \mathbf{else}:\\
                                              \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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.0040000000000000001

                                                1. Initial program 69.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 rewrites92.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)} \]
                                                6. Taylor expanded in im around 0

                                                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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. Applied rewrites90.2%

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

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

                                                      \[\leadsto \left(\left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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(\frac{-1}{12} \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2} \cdot \frac{-1}{12} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2}, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                    6. unpow2N/A

                                                      \[\leadsto \left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                    7. lower-*.f6468.8

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

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

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

                                                  1. Initial program 55.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 rewrites93.2%

                                                    \[\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 im around inf

                                                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

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

                                                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                  8. Applied rewrites93.1%

                                                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                  9. Taylor expanded in re around 0

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

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

                                                      \[\leadsto \left(re \cdot \color{blue}{0.5}\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                  11. Applied rewrites25.8%

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

                                                Alternative 15: 59.3% accurate, 1.9× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.005:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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.005)
                                                   (*
                                                    (* (fma (* re re) -0.08333333333333333 0.5) re)
                                                    (* (- (* -0.3333333333333333 (* im im)) 2.0) im))
                                                   (*
                                                    (* re 0.5)
                                                    (*
                                                     (-
                                                      (*
                                                       (-
                                                        (* (* (* (* -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.005) {
                                                		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                	} else {
                                                		tmp = (re * 0.5) * ((((((((-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.005)
                                                		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                                                	else
                                                		tmp = Float64(Float64(re * 0.5) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * im) * im) * 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.005], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(re * 0.5), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * im), $MachinePrecision] * im), $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.005:\\
                                                \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left(re \cdot 0.5\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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.0050000000000000001

                                                  1. Initial program 55.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(\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-*.f6483.8

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

                                                    \[\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)} \]
                                                  6. Taylor expanded in re around 0

                                                    \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right)\right)} \cdot \left(\left(\frac{-1}{3} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                    2. lower-*.f64N/A

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

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

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

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

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

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

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

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

                                                  1. Initial program 69.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 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 im around inf

                                                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot {im}^{2}\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. pow2N/A

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

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

                                                      \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(\frac{-1}{2520} \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                    4. lower-*.f6492.8

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

                                                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                  9. Taylor expanded in re around 0

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

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

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

                                                    \[\leadsto \color{blue}{\left(re \cdot 0.5\right)} \cdot \left(\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot im\right) \cdot im\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 16: 92.8% accurate, 2.1× speedup?

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

                                                  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 rewrites99.9%

                                                      \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites74.9%

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

                                                      if -15.5999999999999996 < im

                                                      1. Initial program 54.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 \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-*.f6493.0

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

                                                        \[\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)} \]
                                                    4. Recombined 3 regimes into one program.
                                                    5. Add Preprocessing

                                                    Alternative 17: 95.5% 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 -15.6:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 9.2:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;\left(0.5 \cdot re\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 -15.6)
                                                           (* (* 0.5 re) (- (exp (- im)) 1.0))
                                                           (if (<= im 9.2)
                                                             t_0
                                                             (if (<= im 8.2e+102) (* (* 0.5 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 <= -15.6) {
                                                    		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                                    	} else if (im <= 9.2) {
                                                    		tmp = t_0;
                                                    	} else if (im <= 8.2e+102) {
                                                    		tmp = (0.5 * re) * (1.0 - exp(im));
                                                    	} else {
                                                    		tmp = t_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) :: t_0
                                                        real(8) :: tmp
                                                        t_0 = (0.5d0 * sin(re)) * ((((-0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                                                        if (im <= (-8d+102)) then
                                                            tmp = t_0
                                                        else if (im <= (-15.6d0)) then
                                                            tmp = (0.5d0 * re) * (exp(-im) - 1.0d0)
                                                        else if (im <= 9.2d0) then
                                                            tmp = t_0
                                                        else if (im <= 8.2d+102) then
                                                            tmp = (0.5d0 * re) * (1.0d0 - exp(im))
                                                        else
                                                            tmp = t_0
                                                        end if
                                                        code = tmp
                                                    end function
                                                    
                                                    public static double code(double re, double im) {
                                                    	double t_0 = (0.5 * Math.sin(re)) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                    	double tmp;
                                                    	if (im <= -8e+102) {
                                                    		tmp = t_0;
                                                    	} else if (im <= -15.6) {
                                                    		tmp = (0.5 * re) * (Math.exp(-im) - 1.0);
                                                    	} else if (im <= 9.2) {
                                                    		tmp = t_0;
                                                    	} else if (im <= 8.2e+102) {
                                                    		tmp = (0.5 * re) * (1.0 - Math.exp(im));
                                                    	} else {
                                                    		tmp = t_0;
                                                    	}
                                                    	return tmp;
                                                    }
                                                    
                                                    def code(re, im):
                                                    	t_0 = (0.5 * math.sin(re)) * (((-0.3333333333333333 * (im * im)) - 2.0) * im)
                                                    	tmp = 0
                                                    	if im <= -8e+102:
                                                    		tmp = t_0
                                                    	elif im <= -15.6:
                                                    		tmp = (0.5 * re) * (math.exp(-im) - 1.0)
                                                    	elif im <= 9.2:
                                                    		tmp = t_0
                                                    	elif im <= 8.2e+102:
                                                    		tmp = (0.5 * re) * (1.0 - math.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 <= -15.6)
                                                    		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                                                    	elseif (im <= 9.2)
                                                    		tmp = t_0;
                                                    	elseif (im <= 8.2e+102)
                                                    		tmp = Float64(Float64(0.5 * re) * Float64(1.0 - exp(im)));
                                                    	else
                                                    		tmp = t_0;
                                                    	end
                                                    	return tmp
                                                    end
                                                    
                                                    function tmp_2 = code(re, im)
                                                    	t_0 = (0.5 * sin(re)) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                    	tmp = 0.0;
                                                    	if (im <= -8e+102)
                                                    		tmp = t_0;
                                                    	elseif (im <= -15.6)
                                                    		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                                    	elseif (im <= 9.2)
                                                    		tmp = t_0;
                                                    	elseif (im <= 8.2e+102)
                                                    		tmp = (0.5 * re) * (1.0 - exp(im));
                                                    	else
                                                    		tmp = t_0;
                                                    	end
                                                    	tmp_2 = 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, -15.6], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 9.2], t$95$0, If[LessEqual[im, 8.2e+102], N[(N[(0.5 * re), $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 -15.6:\\
                                                    \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                                                    
                                                    \mathbf{elif}\;im \leq 9.2:\\
                                                    \;\;\;\;t\_0\\
                                                    
                                                    \mathbf{elif}\;im \leq 8.2 \cdot 10^{+102}:\\
                                                    \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\
                                                    
                                                    \mathbf{else}:\\
                                                    \;\;\;\;t\_0\\
                                                    
                                                    
                                                    \end{array}
                                                    \end{array}
                                                    
                                                    Derivation
                                                    1. Split input into 3 regimes
                                                    2. if im < -7.99999999999999982e102 or -15.5999999999999996 < im < 9.1999999999999993 or 8.1999999999999999e102 < im

                                                      1. Initial program 59.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(\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-*.f6499.5

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

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

                                                      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 rewrites99.9%

                                                          \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                                        3. Step-by-step derivation
                                                          1. Applied rewrites74.9%

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

                                                          if 9.1999999999999993 < im < 8.1999999999999999e102

                                                          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 \left(\color{blue}{1} - e^{im}\right) \]
                                                          4. Step-by-step derivation
                                                            1. Applied rewrites99.6%

                                                              \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                                                            3. Step-by-step derivation
                                                              1. Applied rewrites75.3%

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

                                                            Alternative 18: 54.3% accurate, 2.1× speedup?

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

                                                              1. Initial program 70.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-*.f6483.7

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

                                                                \[\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)} \]
                                                              6. Taylor expanded in re around 0

                                                                \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right)\right)} \cdot \left(\left(\frac{-1}{3} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                2. lower-*.f64N/A

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

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

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

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

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

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

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

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

                                                              1. Initial program 55.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.f6451.1

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

                                                                \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                                                              7. Step-by-step derivation
                                                                1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                                                                15. lift-neg.f6424.1

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

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

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

                                                            Alternative 19: 93.0% accurate, 2.2× speedup?

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

                                                              1. Initial program 57.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 \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-*.f6497.6

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

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

                                                              if -8.5e146 < im < -15.5999999999999996

                                                              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 rewrites99.9%

                                                                  \[\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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites75.0%

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

                                                                  if 9.1999999999999993 < im < 5.6e104

                                                                  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 \left(\color{blue}{1} - e^{im}\right) \]
                                                                  4. Step-by-step derivation
                                                                    1. Applied rewrites99.6%

                                                                      \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites75.3%

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

                                                                    Alternative 20: 53.3% accurate, 2.3× speedup?

                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.005:\\ \;\;\;\;\mathsf{fma}\left(0.16666666666666666 \cdot im, re \cdot re, -im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot 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 (<= (* 0.5 (sin re)) -0.005)
                                                                       (* (fma (* 0.16666666666666666 im) (* re re) (- im)) re)
                                                                       (* (* 0.5 re) (* (- (* -0.3333333333333333 (* im im)) 2.0) im))))
                                                                    double code(double re, double im) {
                                                                    	double tmp;
                                                                    	if ((0.5 * sin(re)) <= -0.005) {
                                                                    		tmp = fma((0.16666666666666666 * im), (re * re), -im) * re;
                                                                    	} else {
                                                                    		tmp = (0.5 * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    function code(re, im)
                                                                    	tmp = 0.0
                                                                    	if (Float64(0.5 * sin(re)) <= -0.005)
                                                                    		tmp = Float64(fma(Float64(0.16666666666666666 * im), Float64(re * re), Float64(-im)) * re);
                                                                    	else
                                                                    		tmp = Float64(Float64(0.5 * re) * Float64(Float64(Float64(-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.005], N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * N[(re * re), $MachinePrecision] + (-im)), $MachinePrecision] * re), $MachinePrecision], N[(N[(0.5 * re), $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}\;0.5 \cdot \sin re \leq -0.005:\\
                                                                    \;\;\;\;\mathsf{fma}\left(0.16666666666666666 \cdot im, re \cdot re, -im\right) \cdot re\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;\left(0.5 \cdot 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 2 regimes
                                                                    2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0050000000000000001

                                                                      1. Initial program 55.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 \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.f6450.4

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

                                                                        \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                                                                      7. Step-by-step derivation
                                                                        1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                                                                        15. lift-neg.f6423.8

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

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

                                                                        \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
                                                                      10. Step-by-step derivation
                                                                        1. lift-*.f6423.1

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

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

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

                                                                      1. Initial program 69.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(\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-*.f6483.7

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

                                                                        \[\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)} \]
                                                                      6. Taylor expanded in re around 0

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

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

                                                                      Alternative 21: 86.6% accurate, 2.3× speedup?

                                                                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\\ \mathbf{if}\;im \leq -2.15 \cdot 10^{+176}:\\ \;\;\;\;t\_0 \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -15.6:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 6.2:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+64}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(-0.016666666666666666 \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
                                                                       (let* ((t_0 (* (fma (* re re) -0.08333333333333333 0.5) re)))
                                                                         (if (<= im -2.15e+176)
                                                                           (* t_0 (* (- (* -0.3333333333333333 (* im im)) 2.0) im))
                                                                           (if (<= im -15.6)
                                                                             (* (* 0.5 re) (- (exp (- im)) 1.0))
                                                                             (if (<= im 6.2)
                                                                               (* (- (sin re)) im)
                                                                               (if (<= im 2e+64)
                                                                                 (* (* 0.5 re) (- 1.0 (exp im)))
                                                                                 (*
                                                                                  t_0
                                                                                  (*
                                                                                   (-
                                                                                    (*
                                                                                     (- (* (* -0.016666666666666666 im) im) 0.3333333333333333)
                                                                                     (* im im))
                                                                                    2.0)
                                                                                   im))))))))
                                                                      double code(double re, double im) {
                                                                      	double t_0 = fma((re * re), -0.08333333333333333, 0.5) * re;
                                                                      	double tmp;
                                                                      	if (im <= -2.15e+176) {
                                                                      		tmp = t_0 * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                                      	} else if (im <= -15.6) {
                                                                      		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                                                      	} else if (im <= 6.2) {
                                                                      		tmp = -sin(re) * im;
                                                                      	} else if (im <= 2e+64) {
                                                                      		tmp = (0.5 * re) * (1.0 - exp(im));
                                                                      	} else {
                                                                      		tmp = t_0 * ((((((-0.016666666666666666 * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                                                      	}
                                                                      	return tmp;
                                                                      }
                                                                      
                                                                      function code(re, im)
                                                                      	t_0 = Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re)
                                                                      	tmp = 0.0
                                                                      	if (im <= -2.15e+176)
                                                                      		tmp = Float64(t_0 * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                                                                      	elseif (im <= -15.6)
                                                                      		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                                                                      	elseif (im <= 6.2)
                                                                      		tmp = Float64(Float64(-sin(re)) * im);
                                                                      	elseif (im <= 2e+64)
                                                                      		tmp = Float64(Float64(0.5 * re) * Float64(1.0 - exp(im)));
                                                                      	else
                                                                      		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                                                                      	end
                                                                      	return tmp
                                                                      end
                                                                      
                                                                      code[re_, im_] := Block[{t$95$0 = N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision]}, If[LessEqual[im, -2.15e+176], N[(t$95$0 * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -15.6], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 6.2], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision], If[LessEqual[im, 2e+64], N[(N[(0.5 * re), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]]]]
                                                                      
                                                                      \begin{array}{l}
                                                                      
                                                                      \\
                                                                      \begin{array}{l}
                                                                      t_0 := \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\\
                                                                      \mathbf{if}\;im \leq -2.15 \cdot 10^{+176}:\\
                                                                      \;\;\;\;t\_0 \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                                                      
                                                                      \mathbf{elif}\;im \leq -15.6:\\
                                                                      \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                                                                      
                                                                      \mathbf{elif}\;im \leq 6.2:\\
                                                                      \;\;\;\;\left(-\sin re\right) \cdot im\\
                                                                      
                                                                      \mathbf{elif}\;im \leq 2 \cdot 10^{+64}:\\
                                                                      \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\
                                                                      
                                                                      \mathbf{else}:\\
                                                                      \;\;\;\;t\_0 \cdot \left(\left(\left(\left(-0.016666666666666666 \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 5 regimes
                                                                      2. if im < -2.15000000000000013e176

                                                                        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)} \]
                                                                        6. Taylor expanded in re around 0

                                                                          \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right)\right)} \cdot \left(\left(\frac{-1}{3} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                          2. lower-*.f64N/A

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

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

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

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

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

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

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

                                                                        if -2.15000000000000013e176 < im < -15.5999999999999996

                                                                        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}{re}\right) \cdot \left(e^{-im} - 1\right) \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites74.1%

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

                                                                            if -15.5999999999999996 < im < 6.20000000000000018

                                                                            1. Initial program 31.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.f6498.6

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

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

                                                                            if 6.20000000000000018 < im < 2.00000000000000004e64

                                                                            1. Initial program 99.5%

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

                                                                                \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                                                                              3. Step-by-step derivation
                                                                                1. Applied rewrites75.4%

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

                                                                                if 2.00000000000000004e64 < 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 rewrites100.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 im around 0

                                                                                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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. Applied rewrites100.0%

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

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

                                                                                      \[\leadsto \left(\left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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(\frac{-1}{12} \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2} \cdot \frac{-1}{12} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2}, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                                    6. unpow2N/A

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

                                                                                      \[\leadsto \left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                                  4. Applied rewrites74.3%

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

                                                                                Alternative 22: 84.8% accurate, 2.3× speedup?

                                                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\\ \mathbf{if}\;im \leq -2.15 \cdot 10^{+176}:\\ \;\;\;\;t\_0 \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -0.0068:\\ \;\;\;\;\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 6.2:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \mathbf{elif}\;im \leq 2 \cdot 10^{+64}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(-0.016666666666666666 \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
                                                                                 (let* ((t_0 (* (fma (* re re) -0.08333333333333333 0.5) re)))
                                                                                   (if (<= im -2.15e+176)
                                                                                     (* t_0 (* (- (* -0.3333333333333333 (* im im)) 2.0) im))
                                                                                     (if (<= im -0.0068)
                                                                                       (*
                                                                                        (*
                                                                                         (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 6.2)
                                                                                         (* (- (sin re)) im)
                                                                                         (if (<= im 2e+64)
                                                                                           (* (* 0.5 re) (- 1.0 (exp im)))
                                                                                           (*
                                                                                            t_0
                                                                                            (*
                                                                                             (-
                                                                                              (*
                                                                                               (- (* (* -0.016666666666666666 im) im) 0.3333333333333333)
                                                                                               (* im im))
                                                                                              2.0)
                                                                                             im))))))))
                                                                                double code(double re, double im) {
                                                                                	double t_0 = fma((re * re), -0.08333333333333333, 0.5) * re;
                                                                                	double tmp;
                                                                                	if (im <= -2.15e+176) {
                                                                                		tmp = t_0 * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                                                	} else if (im <= -0.0068) {
                                                                                		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 <= 6.2) {
                                                                                		tmp = -sin(re) * im;
                                                                                	} else if (im <= 2e+64) {
                                                                                		tmp = (0.5 * re) * (1.0 - exp(im));
                                                                                	} else {
                                                                                		tmp = t_0 * ((((((-0.016666666666666666 * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                                                                                	}
                                                                                	return tmp;
                                                                                }
                                                                                
                                                                                function code(re, im)
                                                                                	t_0 = Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re)
                                                                                	tmp = 0.0
                                                                                	if (im <= -2.15e+176)
                                                                                		tmp = Float64(t_0 * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                                                                                	elseif (im <= -0.0068)
                                                                                		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 <= 6.2)
                                                                                		tmp = Float64(Float64(-sin(re)) * im);
                                                                                	elseif (im <= 2e+64)
                                                                                		tmp = Float64(Float64(0.5 * re) * Float64(1.0 - exp(im)));
                                                                                	else
                                                                                		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                                                                                	end
                                                                                	return tmp
                                                                                end
                                                                                
                                                                                code[re_, im_] := Block[{t$95$0 = N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision]}, If[LessEqual[im, -2.15e+176], N[(t$95$0 * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.0068], 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, 6.2], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision], If[LessEqual[im, 2e+64], N[(N[(0.5 * re), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]]]]]
                                                                                
                                                                                \begin{array}{l}
                                                                                
                                                                                \\
                                                                                \begin{array}{l}
                                                                                t_0 := \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\\
                                                                                \mathbf{if}\;im \leq -2.15 \cdot 10^{+176}:\\
                                                                                \;\;\;\;t\_0 \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                                                                
                                                                                \mathbf{elif}\;im \leq -0.0068:\\
                                                                                \;\;\;\;\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 6.2:\\
                                                                                \;\;\;\;\left(-\sin re\right) \cdot im\\
                                                                                
                                                                                \mathbf{elif}\;im \leq 2 \cdot 10^{+64}:\\
                                                                                \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\
                                                                                
                                                                                \mathbf{else}:\\
                                                                                \;\;\;\;t\_0 \cdot \left(\left(\left(\left(-0.016666666666666666 \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 5 regimes
                                                                                2. if im < -2.15000000000000013e176

                                                                                  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)} \]
                                                                                  6. Taylor expanded in re around 0

                                                                                    \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right)\right)} \cdot \left(\left(\frac{-1}{3} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                                    2. lower-*.f64N/A

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

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

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

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

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

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

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

                                                                                  if -2.15000000000000013e176 < im < -0.00679999999999999962

                                                                                  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 rewrites77.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-*.f6461.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 rewrites61.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 -0.00679999999999999962 < im < 6.20000000000000018

                                                                                  1. Initial program 31.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.f6498.9

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

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

                                                                                  if 6.20000000000000018 < im < 2.00000000000000004e64

                                                                                  1. Initial program 99.5%

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

                                                                                      \[\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}{re}\right) \cdot \left(1 - e^{im}\right) \]
                                                                                    3. Step-by-step derivation
                                                                                      1. Applied rewrites75.4%

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

                                                                                      if 2.00000000000000004e64 < 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 rewrites100.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 im around 0

                                                                                        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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. Applied rewrites100.0%

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

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

                                                                                            \[\leadsto \left(\left(\frac{1}{2} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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} + \frac{-1}{12} \cdot {re}^{2}\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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(\frac{-1}{12} \cdot {re}^{2} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2} \cdot \frac{-1}{12} + \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \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({re}^{2}, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(\left(\frac{-1}{60} \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                                          6. unpow2N/A

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

                                                                                            \[\leadsto \left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                                        4. Applied rewrites74.3%

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

                                                                                      Alternative 23: 35.1% accurate, 2.3× speedup?

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

                                                                                        1. Initial program 69.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 \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.f6450.7

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

                                                                                          \[\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 + {re}^{2} \cdot \left(\frac{-1}{120} \cdot \left(im \cdot {re}^{2}\right) + \frac{1}{6} \cdot im\right)\right)} \]
                                                                                        7. Step-by-step derivation
                                                                                          1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{120}, \left(re \cdot re\right) \cdot im, \frac{1}{6} \cdot im\right), re \cdot re, \mathsf{neg}\left(im\right)\right) \cdot re \]
                                                                                          15. lift-neg.f6441.6

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

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

                                                                                          \[\leadsto \mathsf{fma}\left(\frac{1}{6} \cdot im, re \cdot re, -im\right) \cdot re \]
                                                                                        10. Step-by-step derivation
                                                                                          1. lift-*.f6441.4

                                                                                            \[\leadsto \mathsf{fma}\left(0.16666666666666666 \cdot im, re \cdot re, -im\right) \cdot re \]
                                                                                        11. Applied rewrites41.4%

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

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

                                                                                        1. Initial program 55.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 \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.f6451.0

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

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

                                                                                            \[\leadsto \left(-re\right) \cdot im \]
                                                                                        8. Recombined 2 regimes into one program.
                                                                                        9. Add Preprocessing

                                                                                        Alternative 24: 32.9% 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 66.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.f6450.7

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

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

                                                                                            \[\leadsto \left(-re\right) \cdot im \]
                                                                                          2. Add Preprocessing

                                                                                          Alternative 25: 14.7% accurate, 52.7× speedup?

                                                                                          \[\begin{array}{l} \\ 0 \cdot im \end{array} \]
                                                                                          (FPCore (re im) :precision binary64 (* 0.0 im))
                                                                                          double code(double re, double im) {
                                                                                          	return 0.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.0d0 * im
                                                                                          end function
                                                                                          
                                                                                          public static double code(double re, double im) {
                                                                                          	return 0.0 * im;
                                                                                          }
                                                                                          
                                                                                          def code(re, im):
                                                                                          	return 0.0 * im
                                                                                          
                                                                                          function code(re, im)
                                                                                          	return Float64(0.0 * im)
                                                                                          end
                                                                                          
                                                                                          function tmp = code(re, im)
                                                                                          	tmp = 0.0 * im;
                                                                                          end
                                                                                          
                                                                                          code[re_, im_] := N[(0.0 * im), $MachinePrecision]
                                                                                          
                                                                                          \begin{array}{l}
                                                                                          
                                                                                          \\
                                                                                          0 \cdot im
                                                                                          \end{array}
                                                                                          
                                                                                          Derivation
                                                                                          1. Initial program 66.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.f6450.7

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

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

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

                                                                                              \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                                                                                            3. sin-+PI-revN/A

                                                                                              \[\leadsto \sin \left(re + \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            4. sin-sumN/A

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

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \mathsf{PI}\left(\right), \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            6. lift-sin.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \mathsf{PI}\left(\right), \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            7. lower-cos.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \mathsf{PI}\left(\right), \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            8. lower-PI.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            9. lower-*.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            10. lower-cos.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            11. lower-sin.f64N/A

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \mathsf{PI}\left(\right)\right) \cdot im \]
                                                                                            12. lower-PI.f6428.2

                                                                                              \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \pi\right) \cdot im \]
                                                                                          7. Applied rewrites28.2%

                                                                                            \[\leadsto \mathsf{fma}\left(\sin re, \cos \pi, \cos re \cdot \sin \pi\right) \cdot im \]
                                                                                          8. Taylor expanded in re around 0

                                                                                            \[\leadsto \sin \mathsf{PI}\left(\right) \cdot im \]
                                                                                          9. Step-by-step derivation
                                                                                            1. sin-PI14.7

                                                                                              \[\leadsto 0 \cdot im \]
                                                                                          10. Applied rewrites14.7%

                                                                                            \[\leadsto 0 \cdot im \]
                                                                                          11. 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 2025089 
                                                                                          (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))))