math.cos on complex, imaginary part

Percentage Accurate: 65.4% → 99.9%
Time: 5.7s
Alternatives: 19
Speedup: 1.4×

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 19 alternatives:

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

Initial Program: 65.4% 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.9% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(e^{-im} - e^{im}\right) \cdot \left(\sin re \cdot 0.5\right)\\ \mathbf{if}\;im \leq -0.0155:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 0.014:\\ \;\;\;\;\mathsf{fma}\left(\left(\sin re \cdot \mathsf{fma}\left(-0.008333333333333333, im \cdot im, -0.16666666666666666\right)\right) \cdot im, im, -\sin re\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (- (exp (- im)) (exp im)) (* (sin re) 0.5))))
   (if (<= im -0.0155)
     t_0
     (if (<= im 0.014)
       (*
        (fma
         (*
          (*
           (sin re)
           (fma -0.008333333333333333 (* im im) -0.16666666666666666))
          im)
         im
         (- (sin re)))
        im)
       t_0))))
double code(double re, double im) {
	double t_0 = (exp(-im) - exp(im)) * (sin(re) * 0.5);
	double tmp;
	if (im <= -0.0155) {
		tmp = t_0;
	} else if (im <= 0.014) {
		tmp = fma(((sin(re) * fma(-0.008333333333333333, (im * im), -0.16666666666666666)) * im), im, -sin(re)) * im;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(Float64(exp(Float64(-im)) - exp(im)) * Float64(sin(re) * 0.5))
	tmp = 0.0
	if (im <= -0.0155)
		tmp = t_0;
	elseif (im <= 0.014)
		tmp = Float64(fma(Float64(Float64(sin(re) * fma(-0.008333333333333333, Float64(im * im), -0.16666666666666666)) * im), im, Float64(-sin(re))) * im);
	else
		tmp = t_0;
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -0.0155], t$95$0, If[LessEqual[im, 0.014], N[(N[(N[(N[(N[Sin[re], $MachinePrecision] * N[(-0.008333333333333333 * N[(im * im), $MachinePrecision] + -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision] * im + (-N[Sin[re], $MachinePrecision])), $MachinePrecision] * im), $MachinePrecision], t$95$0]]]
\begin{array}{l}

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

\mathbf{elif}\;im \leq 0.014:\\
\;\;\;\;\mathsf{fma}\left(\left(\sin re \cdot \mathsf{fma}\left(-0.008333333333333333, im \cdot im, -0.16666666666666666\right)\right) \cdot im, im, -\sin re\right) \cdot im\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -0.0155 or 0.0140000000000000003 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{\color{blue}{\mathsf{neg}\left(im\right)}} - e^{im}\right) \]
      7. lift-exp.f64N/A

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

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

        \[\leadsto \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)} \]
      10. lift-neg.f64N/A

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

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

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

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

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

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \]
      16. lift-sin.f64100.0

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{\sin re} \cdot 0.5\right) \]
    3. Applied rewrites100.0%

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

    if -0.0155 < im < 0.0140000000000000003

    1. Initial program 31.0%

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

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

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

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

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

Alternative 2: 99.9% accurate, 0.9× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < -0.0155 or 0.0140000000000000003 < im

    1. Initial program 100.0%

      \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{\color{blue}{\mathsf{neg}\left(im\right)}} - e^{im}\right) \]
      7. lift-exp.f64N/A

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

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

        \[\leadsto \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)} \]
      10. lift-neg.f64N/A

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

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

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

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

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

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \]
      16. lift-sin.f64100.0

        \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{\sin re} \cdot 0.5\right) \]
    3. Applied rewrites100.0%

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

    if -0.0155 < im < 0.0140000000000000003

    1. Initial program 31.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\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) \]
      2. lift-sin.f64N/A

        \[\leadsto \left(\frac{1}{2} \cdot \color{blue}{\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) \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\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) \]
      4. lift-sin.f64N/A

        \[\leadsto \left(\color{blue}{\sin re} \cdot \frac{1}{2}\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) \]
      5. lift-*.f6499.8

        \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\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) \]
      6. lift-*.f64N/A

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\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. *-commutativeN/A

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

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

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

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

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

Alternative 3: 98.5% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin re \cdot 0.5\\ t_1 := t\_0 \cdot \left(\left(\left(\left(\left(im \cdot im\right) \cdot -0.016666666666666666 - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{if}\;im \leq -2.4 \cdot 10^{+68}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;im \leq -4.6:\\ \;\;\;\;\left(\left(e^{-im} - 1\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\ \mathbf{elif}\;im \leq 3:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(1 - e^{im}\right) \cdot t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (* (sin re) 0.5))
        (t_1
         (*
          t_0
          (*
           (-
            (*
             (* (- (* (* im im) -0.016666666666666666) 0.3333333333333333) im)
             im)
            2.0)
           im))))
   (if (<= im -2.4e+68)
     t_1
     (if (<= im -4.6)
       (* (* (- (exp (- im)) 1.0) (fma (* re re) -0.08333333333333333 0.5)) re)
       (if (<= im 3.0) t_1 (* (- 1.0 (exp im)) t_0))))))
double code(double re, double im) {
	double t_0 = sin(re) * 0.5;
	double t_1 = t_0 * (((((((im * im) * -0.016666666666666666) - 0.3333333333333333) * im) * im) - 2.0) * im);
	double tmp;
	if (im <= -2.4e+68) {
		tmp = t_1;
	} else if (im <= -4.6) {
		tmp = ((exp(-im) - 1.0) * fma((re * re), -0.08333333333333333, 0.5)) * re;
	} else if (im <= 3.0) {
		tmp = t_1;
	} else {
		tmp = (1.0 - exp(im)) * t_0;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(sin(re) * 0.5)
	t_1 = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(im * im) * -0.016666666666666666) - 0.3333333333333333) * im) * im) - 2.0) * im))
	tmp = 0.0
	if (im <= -2.4e+68)
		tmp = t_1;
	elseif (im <= -4.6)
		tmp = Float64(Float64(Float64(exp(Float64(-im)) - 1.0) * fma(Float64(re * re), -0.08333333333333333, 0.5)) * re);
	elseif (im <= 3.0)
		tmp = t_1;
	else
		tmp = Float64(Float64(1.0 - exp(im)) * t_0);
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(im * im), $MachinePrecision] * -0.016666666666666666), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2.4e+68], t$95$1, If[LessEqual[im, -4.6], N[(N[(N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision], If[LessEqual[im, 3.0], t$95$1, N[(N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin re \cdot 0.5\\
t_1 := t\_0 \cdot \left(\left(\left(\left(\left(im \cdot im\right) \cdot -0.016666666666666666 - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\
\mathbf{if}\;im \leq -2.4 \cdot 10^{+68}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;im \leq -4.6:\\
\;\;\;\;\left(\left(e^{-im} - 1\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\

\mathbf{elif}\;im \leq 3:\\
\;\;\;\;t\_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if im < -2.40000000000000008e68 or -4.5999999999999996 < im < 3

    1. Initial program 50.6%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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) \]
    4. Applied rewrites99.6%

      \[\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)} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \color{blue}{\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) \]
      2. lift-sin.f64N/A

        \[\leadsto \left(\frac{1}{2} \cdot \color{blue}{\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) \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\left(\sin re \cdot \frac{1}{2}\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) \]
      4. lift-sin.f64N/A

        \[\leadsto \left(\color{blue}{\sin re} \cdot \frac{1}{2}\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) \]
      5. lift-*.f6499.6

        \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\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) \]
      6. lift-*.f64N/A

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\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. *-commutativeN/A

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

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

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

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

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

    if -2.40000000000000008e68 < im < -4.5999999999999996

    1. Initial program 99.8%

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

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

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

        \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
    4. Applied rewrites76.8%

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

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

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

      if 3 < im

      1. Initial program 100.0%

        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
      2. Step-by-step derivation
        1. lift-*.f64N/A

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{\color{blue}{\mathsf{neg}\left(im\right)}} - e^{im}\right) \]
        7. lift-exp.f64N/A

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

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

          \[\leadsto \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)} \]
        10. lift-neg.f64N/A

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

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

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

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

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

          \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \]
        16. lift-sin.f64100.0

          \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{\sin re} \cdot 0.5\right) \]
      3. Applied rewrites100.0%

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

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

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

      Alternative 4: 97.0% accurate, 1.0× speedup?

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

        1. Initial program 100.0%

          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
        2. 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)} \]
        3. 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-*.f6488.1

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sin re \cdot \left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666\right) \cdot im\right) \]
        9. Applied rewrites95.3%

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

        if -6.8000000000000001e93 < im < -4.5

        1. Initial program 99.8%

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

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

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

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

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

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

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

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

            \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
          8. lift-exp.f64N/A

            \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
          9. lift--.f6476.1

            \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
        4. Applied rewrites76.1%

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

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

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

          if -4.5 < im < 2.2000000000000002

          1. Initial program 31.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if 2.2000000000000002 < im

          1. Initial program 100.0%

            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

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

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

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

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

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

              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{\color{blue}{\mathsf{neg}\left(im\right)}} - e^{im}\right) \]
            7. lift-exp.f64N/A

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

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

              \[\leadsto \color{blue}{\left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right) \cdot \left(\frac{1}{2} \cdot \sin re\right)} \]
            10. lift-neg.f64N/A

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

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

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

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

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

              \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \color{blue}{\left(\sin re \cdot \frac{1}{2}\right)} \]
            16. lift-sin.f64100.0

              \[\leadsto \left(e^{-im} - e^{im}\right) \cdot \left(\color{blue}{\sin re} \cdot 0.5\right) \]
          3. Applied rewrites100.0%

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

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

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

          Alternative 5: 94.8% accurate, 1.0× speedup?

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

            1. Initial program 100.0%

              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
            2. 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)} \]
            3. 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-*.f6489.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \sin re \cdot \left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666\right) \cdot im\right) \]
            9. Applied rewrites97.6%

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

            if -6.8000000000000001e93 < im < -4.5

            1. Initial program 99.8%

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

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

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

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

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

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

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

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

                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
              8. lift-exp.f64N/A

                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
              9. lift--.f6476.1

                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
            4. Applied rewrites76.1%

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

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

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

              if -4.5 < im < 13.800000000000001

              1. Initial program 31.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

              if 13.800000000000001 < im < 1.0500000000000001e103

              1. Initial program 100.0%

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

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

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

                  \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
              4. Applied rewrites73.6%

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

            Alternative 6: 94.5% accurate, 1.0× speedup?

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

              1. Initial program 100.0%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
              2. 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)} \]
              3. 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-*.f6489.7

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \sin re \cdot \left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666\right) \cdot im\right) \]
              9. Applied rewrites97.6%

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

              if -6.8000000000000001e93 < im < -4.5

              1. Initial program 99.8%

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                8. lift-exp.f64N/A

                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                9. lift--.f6476.1

                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
              4. Applied rewrites76.1%

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

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

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

                if -4.5 < im < 13.800000000000001

                1. Initial program 31.4%

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

                  \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \sin re\right)} \]
                3. 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 \]
                4. Applied rewrites98.6%

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

                if 13.800000000000001 < im < 1.0500000000000001e103

                1. Initial program 100.0%

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

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

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

                    \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                4. Applied rewrites73.6%

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

              Alternative 7: 92.3% accurate, 1.0× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im}\\ t_1 := \left(\sin re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im\\ \mathbf{if}\;im \leq -3.4 \cdot 10^{+169}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;im \leq -4.5:\\ \;\;\;\;\left(\left(t\_0 - 1\right) \cdot 0.5\right) \cdot re\\ \mathbf{elif}\;im \leq 13.8:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \mathbf{elif}\;im \leq 1.55 \cdot 10^{+106}:\\ \;\;\;\;\left(\left(t\_0 - e^{im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (let* ((t_0 (exp (- im)))
                      (t_1 (* (* (sin re) (* (* im im) -0.16666666666666666)) im)))
                 (if (<= im -3.4e+169)
                   t_1
                   (if (<= im -4.5)
                     (* (* (- t_0 1.0) 0.5) re)
                     (if (<= im 13.8)
                       (* (- (sin re)) im)
                       (if (<= im 1.55e+106)
                         (* (* (- t_0 (exp im)) (fma (* re re) -0.08333333333333333 0.5)) re)
                         t_1))))))
              double code(double re, double im) {
              	double t_0 = exp(-im);
              	double t_1 = (sin(re) * ((im * im) * -0.16666666666666666)) * im;
              	double tmp;
              	if (im <= -3.4e+169) {
              		tmp = t_1;
              	} else if (im <= -4.5) {
              		tmp = ((t_0 - 1.0) * 0.5) * re;
              	} else if (im <= 13.8) {
              		tmp = -sin(re) * im;
              	} else if (im <= 1.55e+106) {
              		tmp = ((t_0 - exp(im)) * fma((re * re), -0.08333333333333333, 0.5)) * re;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(re, im)
              	t_0 = exp(Float64(-im))
              	t_1 = Float64(Float64(sin(re) * Float64(Float64(im * im) * -0.16666666666666666)) * im)
              	tmp = 0.0
              	if (im <= -3.4e+169)
              		tmp = t_1;
              	elseif (im <= -4.5)
              		tmp = Float64(Float64(Float64(t_0 - 1.0) * 0.5) * re);
              	elseif (im <= 13.8)
              		tmp = Float64(Float64(-sin(re)) * im);
              	elseif (im <= 1.55e+106)
              		tmp = Float64(Float64(Float64(t_0 - exp(im)) * fma(Float64(re * re), -0.08333333333333333, 0.5)) * re);
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[re_, im_] := Block[{t$95$0 = N[Exp[(-im)], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[Sin[re], $MachinePrecision] * N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[im, -3.4e+169], t$95$1, If[LessEqual[im, -4.5], N[(N[(N[(t$95$0 - 1.0), $MachinePrecision] * 0.5), $MachinePrecision] * re), $MachinePrecision], If[LessEqual[im, 13.8], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision], If[LessEqual[im, 1.55e+106], N[(N[(N[(t$95$0 - N[Exp[im], $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision], t$95$1]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := e^{-im}\\
              t_1 := \left(\sin re \cdot \left(\left(im \cdot im\right) \cdot -0.16666666666666666\right)\right) \cdot im\\
              \mathbf{if}\;im \leq -3.4 \cdot 10^{+169}:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;im \leq -4.5:\\
              \;\;\;\;\left(\left(t\_0 - 1\right) \cdot 0.5\right) \cdot re\\
              
              \mathbf{elif}\;im \leq 13.8:\\
              \;\;\;\;\left(-\sin re\right) \cdot im\\
              
              \mathbf{elif}\;im \leq 1.55 \cdot 10^{+106}:\\
              \;\;\;\;\left(\left(t\_0 - e^{im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if im < -3.40000000000000028e169 or 1.55e106 < im

                1. Initial program 100.0%

                  \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                2. 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)} \]
                3. 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-*.f6495.4

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

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

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

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

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

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

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

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

                if -3.40000000000000028e169 < im < -4.5

                1. Initial program 99.9%

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

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

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

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

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

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

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

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

                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                  8. lift-exp.f64N/A

                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                  9. lift--.f6474.3

                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                4. Applied rewrites74.3%

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

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

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

                  if -4.5 < im < 13.800000000000001

                  1. Initial program 31.4%

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

                    \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \sin re\right)} \]
                  3. 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 \]
                  4. Applied rewrites98.6%

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

                  if 13.800000000000001 < im < 1.55e106

                  1. Initial program 100.0%

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

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

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

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

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

                Alternative 8: 87.0% accurate, 1.4× speedup?

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

                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                    8. lift-exp.f64N/A

                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                    9. lift--.f6475.6

                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                  4. Applied rewrites75.6%

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

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

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

                    if -4.5 < im < 13.800000000000001

                    1. Initial program 31.4%

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

                      \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \sin re\right)} \]
                    3. 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 \]
                    4. Applied rewrites98.6%

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

                    if 13.800000000000001 < im

                    1. Initial program 100.0%

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

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

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

                        \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                    4. Applied rewrites74.8%

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

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

                        \[\leadsto \left(\left(1 - e^{im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re \]
                    7. Recombined 3 regimes into one program.
                    8. Add Preprocessing

                    Alternative 9: 87.0% accurate, 1.4× speedup?

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

                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                        8. lift-exp.f64N/A

                          \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                        9. lift--.f6475.6

                          \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                      4. Applied rewrites75.6%

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

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

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

                        if -4.5 < im < 13.800000000000001

                        1. Initial program 31.4%

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

                          \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \sin re\right)} \]
                        3. 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 \]
                        4. Applied rewrites98.6%

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

                        if 13.800000000000001 < im

                        1. Initial program 100.0%

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

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

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

                            \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                        4. Applied rewrites74.8%

                          \[\leadsto \color{blue}{\left(\left(e^{-im} - e^{im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re} \]
                      7. Recombined 3 regimes into one program.
                      8. Add Preprocessing

                      Alternative 10: 62.4% accurate, 0.6× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ t_1 := \left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\\ \mathbf{if}\;t\_0 \leq -0.1:\\ \;\;\;\;\left(t\_1 \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\ \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-230}:\\ \;\;\;\;\left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re\\ \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 t\_1\\ \end{array} \end{array} \]
                      (FPCore (re im)
                       :precision binary64
                       (let* ((t_0 (* 0.5 (sin re)))
                              (t_1 (* (- (* -0.3333333333333333 (* im im)) 2.0) im)))
                         (if (<= t_0 -0.1)
                           (* (* t_1 (fma (* re re) -0.08333333333333333 0.5)) re)
                           (if (<= t_0 2e-230)
                             (* (* (- (exp (- im)) (exp im)) 0.5) re)
                             (*
                              (*
                               (fma
                                (- (* 0.004166666666666667 (* re re)) 0.08333333333333333)
                                (* re re)
                                0.5)
                               re)
                              t_1)))))
                      double code(double re, double im) {
                      	double t_0 = 0.5 * sin(re);
                      	double t_1 = ((-0.3333333333333333 * (im * im)) - 2.0) * im;
                      	double tmp;
                      	if (t_0 <= -0.1) {
                      		tmp = (t_1 * fma((re * re), -0.08333333333333333, 0.5)) * re;
                      	} else if (t_0 <= 2e-230) {
                      		tmp = ((exp(-im) - exp(im)) * 0.5) * re;
                      	} else {
                      		tmp = (fma(((0.004166666666666667 * (re * re)) - 0.08333333333333333), (re * re), 0.5) * re) * t_1;
                      	}
                      	return tmp;
                      }
                      
                      function code(re, im)
                      	t_0 = Float64(0.5 * sin(re))
                      	t_1 = Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im)
                      	tmp = 0.0
                      	if (t_0 <= -0.1)
                      		tmp = Float64(Float64(t_1 * fma(Float64(re * re), -0.08333333333333333, 0.5)) * re);
                      	elseif (t_0 <= 2e-230)
                      		tmp = Float64(Float64(Float64(exp(Float64(-im)) - exp(im)) * 0.5) * re);
                      	else
                      		tmp = Float64(Float64(fma(Float64(Float64(0.004166666666666667 * Float64(re * re)) - 0.08333333333333333), Float64(re * re), 0.5) * re) * t_1);
                      	end
                      	return tmp
                      end
                      
                      code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[t$95$0, -0.1], N[(N[(t$95$1 * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision], If[LessEqual[t$95$0, 2e-230], N[(N[(N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision] * 0.5), $MachinePrecision] * re), $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] * t$95$1), $MachinePrecision]]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := 0.5 \cdot \sin re\\
                      t_1 := \left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\\
                      \mathbf{if}\;t\_0 \leq -0.1:\\
                      \;\;\;\;\left(t\_1 \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re\\
                      
                      \mathbf{elif}\;t\_0 \leq 2 \cdot 10^{-230}:\\
                      \;\;\;\;\left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re\\
                      
                      \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 t\_1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.10000000000000001

                        1. Initial program 53.9%

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

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

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

                            \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                        4. Applied rewrites25.8%

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

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

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

                            \[\leadsto \left(\left(1 - 1\right) \cdot \mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right)\right) \cdot re \]
                          3. Step-by-step derivation
                            1. Applied rewrites1.8%

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

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

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

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

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

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

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

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

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

                            if -0.10000000000000001 < (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < 2.00000000000000009e-230

                            1. Initial program 78.7%

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                              8. lift-exp.f64N/A

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                              9. lift--.f6476.1

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                            4. Applied rewrites76.1%

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

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

                            1. Initial program 61.0%

                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                            2. 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)} \]
                            3. 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.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) \]
                            4. Applied rewrites83.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)} \]
                            5. 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(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            6. 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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \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(\frac{-1}{3} \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                              11. lift-*.f6449.7

                                \[\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(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                            7. Applied rewrites49.7%

                              \[\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(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                          4. Recombined 3 regimes into one program.
                          5. Add Preprocessing

                          Alternative 11: 54.3% accurate, 1.8× speedup?

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

                            1. Initial program 99.7%

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

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

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

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

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

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

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

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

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                              8. lift-exp.f64N/A

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                              9. lift--.f6474.9

                                \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                            4. Applied rewrites74.9%

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

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

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

                              if -3.35e-6 < im < 13.800000000000001

                              1. Initial program 30.7%

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                8. lift-exp.f64N/A

                                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                9. lift--.f6429.4

                                  \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                              4. Applied rewrites29.4%

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

                                \[\leadsto \left(-1 \cdot im\right) \cdot re \]
                              6. Step-by-step derivation
                                1. mul-1-negN/A

                                  \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot re \]
                                2. lift-neg.f6450.2

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

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

                              if 13.800000000000001 < im

                              1. Initial program 100.0%

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

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

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

                                  \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                              4. Applied rewrites74.8%

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

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

                                  \[\leadsto \left(\left(1 - e^{im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\right) \cdot re \]
                              7. Recombined 3 regimes into one program.
                              8. Add Preprocessing

                              Alternative 12: 53.2% accurate, 0.9× speedup?

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

                                1. Initial program 69.4%

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

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

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

                                    \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                4. Applied rewrites59.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 53.3%

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

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

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

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

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

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

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

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

                                        \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                      8. lift-exp.f64N/A

                                        \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                      9. lift--.f6426.7

                                        \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                                    4. Applied rewrites26.7%

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

                                  Alternative 13: 53.1% accurate, 1.0× speedup?

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

                                    1. Initial program 69.4%

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

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

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

                                        \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                    4. Applied rewrites59.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                        1. Initial program 53.3%

                                          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                                        2. 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)} \]
                                        3. 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-*.f6483.7

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

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

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

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

                                        Alternative 14: 53.1% accurate, 1.0× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\\ \mathbf{if}\;0.5 \cdot \sin re \leq 0.015:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \left(t\_0 \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(re \cdot t\_0\right) \cdot im\\ \end{array} \end{array} \]
                                        (FPCore (re im)
                                         :precision binary64
                                         (let* ((t_0 (fma (* -0.16666666666666666 im) im -1.0)))
                                           (if (<= (* 0.5 (sin re)) 0.015)
                                             (* (* (fma (* re re) -0.16666666666666666 1.0) re) (* t_0 im))
                                             (* (* re t_0) im))))
                                        double code(double re, double im) {
                                        	double t_0 = fma((-0.16666666666666666 * im), im, -1.0);
                                        	double tmp;
                                        	if ((0.5 * sin(re)) <= 0.015) {
                                        		tmp = (fma((re * re), -0.16666666666666666, 1.0) * re) * (t_0 * im);
                                        	} else {
                                        		tmp = (re * t_0) * im;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        function code(re, im)
                                        	t_0 = fma(Float64(-0.16666666666666666 * im), im, -1.0)
                                        	tmp = 0.0
                                        	if (Float64(0.5 * sin(re)) <= 0.015)
                                        		tmp = Float64(Float64(fma(Float64(re * re), -0.16666666666666666, 1.0) * re) * Float64(t_0 * im));
                                        	else
                                        		tmp = Float64(Float64(re * t_0) * im);
                                        	end
                                        	return tmp
                                        end
                                        
                                        code[re_, im_] := Block[{t$95$0 = N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]}, If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], 0.015], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.16666666666666666 + 1.0), $MachinePrecision] * re), $MachinePrecision] * N[(t$95$0 * im), $MachinePrecision]), $MachinePrecision], N[(N[(re * t$95$0), $MachinePrecision] * im), $MachinePrecision]]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        t_0 := \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\\
                                        \mathbf{if}\;0.5 \cdot \sin re \leq 0.015:\\
                                        \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.16666666666666666, 1\right) \cdot re\right) \cdot \left(t\_0 \cdot im\right)\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\left(re \cdot t\_0\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.014999999999999999

                                          1. Initial program 69.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          1. Initial program 53.3%

                                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                                          2. 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)} \]
                                          3. 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-*.f6483.7

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

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

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

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

                                          Alternative 15: 52.3% accurate, 1.1× speedup?

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

                                            1. Initial program 53.9%

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

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

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

                                                \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                            4. Applied rewrites25.8%

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

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

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

                                                \[\leadsto \left(\left(1 - \left(1 + im\right)\right) \cdot \mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right)\right) \cdot re \]
                                              3. Step-by-step derivation
                                                1. lower-+.f6422.1

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

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

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

                                              1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                              Alternative 16: 52.3% accurate, 1.2× speedup?

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

                                                1. Initial program 53.9%

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

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

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

                                                    \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                                4. Applied rewrites25.8%

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot im\right) \cdot -2\right) \cdot re \]
                                                  9. lift-*.f6422.1

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

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

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

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

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

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

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

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

                                                    \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                10. Applied rewrites22.0%

                                                  \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                11. Step-by-step derivation
                                                  1. lift-*.f64N/A

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

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

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

                                                    \[\leadsto \left(\left(re \cdot \left(re \cdot im\right)\right) \cdot \frac{1}{6}\right) \cdot re \]
                                                  5. lower-*.f6422.0

                                                    \[\leadsto \left(\left(re \cdot \left(re \cdot im\right)\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                12. Applied rewrites22.0%

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

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

                                                1. Initial program 68.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                Alternative 17: 34.0% accurate, 1.2× speedup?

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

                                                  1. Initial program 53.9%

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

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

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

                                                      \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                                  4. Applied rewrites25.8%

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot im\right) \cdot -2\right) \cdot re \]
                                                    9. lift-*.f6422.1

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                  10. Applied rewrites22.0%

                                                    \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                  11. Step-by-step derivation
                                                    1. lift-*.f64N/A

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

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

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

                                                      \[\leadsto \left(\left(re \cdot \left(re \cdot im\right)\right) \cdot \frac{1}{6}\right) \cdot re \]
                                                    5. lower-*.f6422.0

                                                      \[\leadsto \left(\left(re \cdot \left(re \cdot im\right)\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                  12. Applied rewrites22.0%

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

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

                                                  1. Initial program 68.7%

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                    8. lift-exp.f64N/A

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                    9. lift--.f6459.0

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                                                  4. Applied rewrites59.0%

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

                                                    \[\leadsto \left(-1 \cdot im\right) \cdot re \]
                                                  6. Step-by-step derivation
                                                    1. mul-1-negN/A

                                                      \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot re \]
                                                    2. lift-neg.f6437.4

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

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

                                                Alternative 18: 34.0% accurate, 1.2× speedup?

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

                                                  1. Initial program 53.9%

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

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

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

                                                      \[\leadsto \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) + \frac{1}{2} \cdot \left(e^{\mathsf{neg}\left(im\right)} - e^{im}\right)\right) \cdot \color{blue}{re} \]
                                                  4. Applied rewrites25.8%

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot im\right) \cdot -2\right) \cdot re \]
                                                    9. lift-*.f6422.1

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                  10. Applied rewrites22.0%

                                                    \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re \]
                                                  11. Step-by-step derivation
                                                    1. lift-*.f64N/A

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(re \cdot re\right) \cdot \left(\frac{1}{6} \cdot im\right)\right) \cdot re \]
                                                    10. lower-*.f6422.0

                                                      \[\leadsto \left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right)\right) \cdot re \]
                                                  12. Applied rewrites22.0%

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

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

                                                  1. Initial program 68.7%

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                    8. lift-exp.f64N/A

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                    9. lift--.f6459.0

                                                      \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                                                  4. Applied rewrites59.0%

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

                                                    \[\leadsto \left(-1 \cdot im\right) \cdot re \]
                                                  6. Step-by-step derivation
                                                    1. mul-1-negN/A

                                                      \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot re \]
                                                    2. lift-neg.f6437.4

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

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

                                                Alternative 19: 32.3% accurate, 12.7× speedup?

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                  8. lift-exp.f64N/A

                                                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot \frac{1}{2}\right) \cdot re \]
                                                  9. lift--.f6452.1

                                                    \[\leadsto \left(\left(e^{-im} - e^{im}\right) \cdot 0.5\right) \cdot re \]
                                                4. Applied rewrites52.1%

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

                                                  \[\leadsto \left(-1 \cdot im\right) \cdot re \]
                                                6. Step-by-step derivation
                                                  1. mul-1-negN/A

                                                    \[\leadsto \left(\mathsf{neg}\left(im\right)\right) \cdot re \]
                                                  2. lift-neg.f6432.3

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

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

                                                Reproduce

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