math.cos on complex, imaginary part

Percentage Accurate: 66.2% → 99.7%
Time: 8.0s
Alternatives: 24
Speedup: 2.6×

Specification

?
\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(re, im)
use fmin_fmax_functions
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 24 alternatives:

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

Initial Program: 66.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))
double code(double re, double im) {
	return (0.5 * sin(re)) * (exp(-im) - exp(im));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(re, im)
use fmin_fmax_functions
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
end function
public static double code(double re, double im) {
	return (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
}
def code(re, im):
	return (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
function code(re, im)
	return Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)))
end
function tmp = code(re, im)
	tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
end
code[re_, im_] := N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

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

Alternative 1: 99.7% accurate, 1.0× speedup?

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

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

\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}:\\
\;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\


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

    1. Initial program 100.0%

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

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

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

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

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

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

    if -0.00115 < im < 2.2000000000000002

    1. Initial program 25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\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. Add Preprocessing
    3. Taylor expanded in im around 0

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

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

    Alternative 2: 99.7% accurate, 1.0× speedup?

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

      1. Initial program 100.0%

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

      if -0.00115 < im < 2.2000000000000002

      1. Initial program 25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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. Add Preprocessing
      3. Taylor expanded in im around 0

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

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

      Alternative 3: 98.7% accurate, 1.4× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -0.075:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \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}:\\ \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
      (FPCore (re im)
       :precision binary64
       (let* ((t_0 (* 0.5 (sin re))))
         (if (<= im -2e+44)
           (*
            t_0
            (*
             (-
              (*
               (-
                (*
                 (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                 im)
                0.3333333333333333)
               (* im im))
              2.0)
             im))
           (if (<= im -0.075)
             (* (* 0.5 re) (- (exp (- im)) (exp im)))
             (if (<= im 2.2)
               (* (* (sin re) (fma (* -0.16666666666666666 im) im -1.0)) im)
               (* t_0 (- 1.0 (exp im))))))))
      double code(double re, double im) {
      	double t_0 = 0.5 * sin(re);
      	double tmp;
      	if (im <= -2e+44) {
      		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
      	} else if (im <= -0.075) {
      		tmp = (0.5 * re) * (exp(-im) - exp(im));
      	} else if (im <= 2.2) {
      		tmp = (sin(re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
      	} else {
      		tmp = t_0 * (1.0 - exp(im));
      	}
      	return tmp;
      }
      
      function code(re, im)
      	t_0 = Float64(0.5 * sin(re))
      	tmp = 0.0
      	if (im <= -2e+44)
      		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
      	elseif (im <= -0.075)
      		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - exp(im)));
      	elseif (im <= 2.2)
      		tmp = Float64(Float64(sin(re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im);
      	else
      		tmp = Float64(t_0 * Float64(1.0 - exp(im)));
      	end
      	return tmp
      end
      
      code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+44], N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, -0.075], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $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[(t$95$0 * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := 0.5 \cdot \sin re\\
      \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\
      \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
      
      \mathbf{elif}\;im \leq -0.075:\\
      \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - e^{im}\right)\\
      
      \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}:\\
      \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if im < -2.0000000000000002e44

        1. Initial program 100.0%

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

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

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

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

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

        if -2.0000000000000002e44 < im < -0.0749999999999999972

        1. Initial program 99.9%

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

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

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

          if -0.0749999999999999972 < im < 2.2000000000000002

          1. Initial program 25.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\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. Add Preprocessing
          3. Taylor expanded in im around 0

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

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

          Alternative 4: 98.8% accurate, 1.4× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ t_1 := t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;im \leq -11.5:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 3.8:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
          (FPCore (re im)
           :precision binary64
           (let* ((t_0 (* 0.5 (sin re)))
                  (t_1
                   (*
                    t_0
                    (*
                     (-
                      (*
                       (-
                        (*
                         (*
                          (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666)
                          im)
                         im)
                        0.3333333333333333)
                       (* im im))
                      2.0)
                     im))))
             (if (<= im -2e+44)
               t_1
               (if (<= im -11.5)
                 (* (* 0.5 re) (- (exp (- im)) 1.0))
                 (if (<= im 3.8) t_1 (* t_0 (- 1.0 (exp im))))))))
          double code(double re, double im) {
          	double t_0 = 0.5 * sin(re);
          	double t_1 = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
          	double tmp;
          	if (im <= -2e+44) {
          		tmp = t_1;
          	} else if (im <= -11.5) {
          		tmp = (0.5 * re) * (exp(-im) - 1.0);
          	} else if (im <= 3.8) {
          		tmp = t_1;
          	} else {
          		tmp = t_0 * (1.0 - exp(im));
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(re, im)
          use fmin_fmax_functions
              real(8), intent (in) :: re
              real(8), intent (in) :: im
              real(8) :: t_0
              real(8) :: t_1
              real(8) :: tmp
              t_0 = 0.5d0 * sin(re)
              t_1 = t_0 * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
              if (im <= (-2d+44)) then
                  tmp = t_1
              else if (im <= (-11.5d0)) then
                  tmp = (0.5d0 * re) * (exp(-im) - 1.0d0)
              else if (im <= 3.8d0) then
                  tmp = t_1
              else
                  tmp = t_0 * (1.0d0 - exp(im))
              end if
              code = tmp
          end function
          
          public static double code(double re, double im) {
          	double t_0 = 0.5 * Math.sin(re);
          	double t_1 = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
          	double tmp;
          	if (im <= -2e+44) {
          		tmp = t_1;
          	} else if (im <= -11.5) {
          		tmp = (0.5 * re) * (Math.exp(-im) - 1.0);
          	} else if (im <= 3.8) {
          		tmp = t_1;
          	} else {
          		tmp = t_0 * (1.0 - Math.exp(im));
          	}
          	return tmp;
          }
          
          def code(re, im):
          	t_0 = 0.5 * math.sin(re)
          	t_1 = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
          	tmp = 0
          	if im <= -2e+44:
          		tmp = t_1
          	elif im <= -11.5:
          		tmp = (0.5 * re) * (math.exp(-im) - 1.0)
          	elif im <= 3.8:
          		tmp = t_1
          	else:
          		tmp = t_0 * (1.0 - math.exp(im))
          	return tmp
          
          function code(re, im)
          	t_0 = Float64(0.5 * sin(re))
          	t_1 = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im))
          	tmp = 0.0
          	if (im <= -2e+44)
          		tmp = t_1;
          	elseif (im <= -11.5)
          		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
          	elseif (im <= 3.8)
          		tmp = t_1;
          	else
          		tmp = Float64(t_0 * Float64(1.0 - exp(im)));
          	end
          	return tmp
          end
          
          function tmp_2 = code(re, im)
          	t_0 = 0.5 * sin(re);
          	t_1 = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
          	tmp = 0.0;
          	if (im <= -2e+44)
          		tmp = t_1;
          	elseif (im <= -11.5)
          		tmp = (0.5 * re) * (exp(-im) - 1.0);
          	elseif (im <= 3.8)
          		tmp = t_1;
          	else
          		tmp = t_0 * (1.0 - exp(im));
          	end
          	tmp_2 = tmp;
          end
          
          code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+44], t$95$1, If[LessEqual[im, -11.5], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8], t$95$1, N[(t$95$0 * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := 0.5 \cdot \sin re\\
          t_1 := t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
          \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\
          \;\;\;\;t\_1\\
          
          \mathbf{elif}\;im \leq -11.5:\\
          \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
          
          \mathbf{elif}\;im \leq 3.8:\\
          \;\;\;\;t\_1\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if im < -2.0000000000000002e44 or -11.5 < im < 3.7999999999999998

            1. Initial program 47.7%

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

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

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

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

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

            if -2.0000000000000002e44 < im < -11.5

            1. Initial program 100.0%

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

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

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

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

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

                if 3.7999999999999998 < im

                1. Initial program 100.0%

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

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

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

                Alternative 5: 99.7% accurate, 1.4× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \sin re\\ \mathbf{if}\;im \leq -3.7:\\ \;\;\;\;t\_0 \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 3.8:\\ \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (let* ((t_0 (* 0.5 (sin re))))
                   (if (<= im -3.7)
                     (* t_0 (- (exp (- im)) 1.0))
                     (if (<= im 3.8)
                       (*
                        t_0
                        (*
                         (-
                          (*
                           (-
                            (*
                             (*
                              (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666)
                              im)
                             im)
                            0.3333333333333333)
                           (* im im))
                          2.0)
                         im))
                       (* t_0 (- 1.0 (exp im)))))))
                double code(double re, double im) {
                	double t_0 = 0.5 * sin(re);
                	double tmp;
                	if (im <= -3.7) {
                		tmp = t_0 * (exp(-im) - 1.0);
                	} else if (im <= 3.8) {
                		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                	} else {
                		tmp = t_0 * (1.0 - exp(im));
                	}
                	return tmp;
                }
                
                module fmin_fmax_functions
                    implicit none
                    private
                    public fmax
                    public fmin
                
                    interface fmax
                        module procedure fmax88
                        module procedure fmax44
                        module procedure fmax84
                        module procedure fmax48
                    end interface
                    interface fmin
                        module procedure fmin88
                        module procedure fmin44
                        module procedure fmin84
                        module procedure fmin48
                    end interface
                contains
                    real(8) function fmax88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmax44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmax84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmax48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                    end function
                    real(8) function fmin88(x, y) result (res)
                        real(8), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(4) function fmin44(x, y) result (res)
                        real(4), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                    end function
                    real(8) function fmin84(x, y) result(res)
                        real(8), intent (in) :: x
                        real(4), intent (in) :: y
                        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                    end function
                    real(8) function fmin48(x, y) result(res)
                        real(4), intent (in) :: x
                        real(8), intent (in) :: y
                        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                    end function
                end module
                
                real(8) function code(re, im)
                use fmin_fmax_functions
                    real(8), intent (in) :: re
                    real(8), intent (in) :: im
                    real(8) :: t_0
                    real(8) :: tmp
                    t_0 = 0.5d0 * sin(re)
                    if (im <= (-3.7d0)) then
                        tmp = t_0 * (exp(-im) - 1.0d0)
                    else if (im <= 3.8d0) then
                        tmp = t_0 * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                    else
                        tmp = t_0 * (1.0d0 - exp(im))
                    end if
                    code = tmp
                end function
                
                public static double code(double re, double im) {
                	double t_0 = 0.5 * Math.sin(re);
                	double tmp;
                	if (im <= -3.7) {
                		tmp = t_0 * (Math.exp(-im) - 1.0);
                	} else if (im <= 3.8) {
                		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                	} else {
                		tmp = t_0 * (1.0 - Math.exp(im));
                	}
                	return tmp;
                }
                
                def code(re, im):
                	t_0 = 0.5 * math.sin(re)
                	tmp = 0
                	if im <= -3.7:
                		tmp = t_0 * (math.exp(-im) - 1.0)
                	elif im <= 3.8:
                		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
                	else:
                		tmp = t_0 * (1.0 - math.exp(im))
                	return tmp
                
                function code(re, im)
                	t_0 = Float64(0.5 * sin(re))
                	tmp = 0.0
                	if (im <= -3.7)
                		tmp = Float64(t_0 * Float64(exp(Float64(-im)) - 1.0));
                	elseif (im <= 3.8)
                		tmp = Float64(t_0 * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                	else
                		tmp = Float64(t_0 * Float64(1.0 - exp(im)));
                	end
                	return tmp
                end
                
                function tmp_2 = code(re, im)
                	t_0 = 0.5 * sin(re);
                	tmp = 0.0;
                	if (im <= -3.7)
                		tmp = t_0 * (exp(-im) - 1.0);
                	elseif (im <= 3.8)
                		tmp = t_0 * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                	else
                		tmp = t_0 * (1.0 - exp(im));
                	end
                	tmp_2 = tmp;
                end
                
                code[re_, im_] := Block[{t$95$0 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -3.7], N[(t$95$0 * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 3.8], N[(t$95$0 * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                t_0 := 0.5 \cdot \sin re\\
                \mathbf{if}\;im \leq -3.7:\\
                \;\;\;\;t\_0 \cdot \left(e^{-im} - 1\right)\\
                
                \mathbf{elif}\;im \leq 3.8:\\
                \;\;\;\;t\_0 \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;t\_0 \cdot \left(1 - e^{im}\right)\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if im < -3.7000000000000002

                  1. Initial program 100.0%

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

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

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

                    if -3.7000000000000002 < im < 3.7999999999999998

                    1. Initial program 26.1%

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

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

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

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

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

                    if 3.7999999999999998 < im

                    1. Initial program 100.0%

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

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

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

                    Alternative 6: 59.5% accurate, 1.7× speedup?

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

                      1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 7: 95.6% accurate, 1.9× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -2 \cdot 10^{+44} \lor \neg \left(im \leq -11.5\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \end{array} \end{array} \]
                    (FPCore (re im)
                     :precision binary64
                     (if (or (<= im -2e+44) (not (<= im -11.5)))
                       (*
                        (* 0.5 (sin re))
                        (*
                         (-
                          (*
                           (-
                            (*
                             (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                             im)
                            0.3333333333333333)
                           (* im im))
                          2.0)
                         im))
                       (* (* 0.5 re) (- (exp (- im)) 1.0))))
                    double code(double re, double im) {
                    	double tmp;
                    	if ((im <= -2e+44) || !(im <= -11.5)) {
                    		tmp = (0.5 * sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                    	} else {
                    		tmp = (0.5 * re) * (exp(-im) - 1.0);
                    	}
                    	return tmp;
                    }
                    
                    module fmin_fmax_functions
                        implicit none
                        private
                        public fmax
                        public fmin
                    
                        interface fmax
                            module procedure fmax88
                            module procedure fmax44
                            module procedure fmax84
                            module procedure fmax48
                        end interface
                        interface fmin
                            module procedure fmin88
                            module procedure fmin44
                            module procedure fmin84
                            module procedure fmin48
                        end interface
                    contains
                        real(8) function fmax88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmax44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmax84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmax48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                        end function
                        real(8) function fmin88(x, y) result (res)
                            real(8), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(4) function fmin44(x, y) result (res)
                            real(4), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                        end function
                        real(8) function fmin84(x, y) result(res)
                            real(8), intent (in) :: x
                            real(4), intent (in) :: y
                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                        end function
                        real(8) function fmin48(x, y) result(res)
                            real(4), intent (in) :: x
                            real(8), intent (in) :: y
                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                        end function
                    end module
                    
                    real(8) function code(re, im)
                    use fmin_fmax_functions
                        real(8), intent (in) :: re
                        real(8), intent (in) :: im
                        real(8) :: tmp
                        if ((im <= (-2d+44)) .or. (.not. (im <= (-11.5d0)))) then
                            tmp = (0.5d0 * sin(re)) * (((((((((-0.0003968253968253968d0) * (im * im)) - 0.016666666666666666d0) * im) * im) - 0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                        else
                            tmp = (0.5d0 * re) * (exp(-im) - 1.0d0)
                        end if
                        code = tmp
                    end function
                    
                    public static double code(double re, double im) {
                    	double tmp;
                    	if ((im <= -2e+44) || !(im <= -11.5)) {
                    		tmp = (0.5 * Math.sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                    	} else {
                    		tmp = (0.5 * re) * (Math.exp(-im) - 1.0);
                    	}
                    	return tmp;
                    }
                    
                    def code(re, im):
                    	tmp = 0
                    	if (im <= -2e+44) or not (im <= -11.5):
                    		tmp = (0.5 * math.sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im)
                    	else:
                    		tmp = (0.5 * re) * (math.exp(-im) - 1.0)
                    	return tmp
                    
                    function code(re, im)
                    	tmp = 0.0
                    	if ((im <= -2e+44) || !(im <= -11.5))
                    		tmp = Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * Float64(im * im)) - 2.0) * im));
                    	else
                    		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                    	end
                    	return tmp
                    end
                    
                    function tmp_2 = code(re, im)
                    	tmp = 0.0;
                    	if ((im <= -2e+44) || ~((im <= -11.5)))
                    		tmp = (0.5 * sin(re)) * ((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * (im * im)) - 2.0) * im);
                    	else
                    		tmp = (0.5 * re) * (exp(-im) - 1.0);
                    	end
                    	tmp_2 = tmp;
                    end
                    
                    code[re_, im_] := If[Or[LessEqual[im, -2e+44], N[Not[LessEqual[im, -11.5]], $MachinePrecision]], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.016666666666666666), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;im \leq -2 \cdot 10^{+44} \lor \neg \left(im \leq -11.5\right):\\
                    \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 2 regimes
                    2. if im < -2.0000000000000002e44 or -11.5 < im

                      1. Initial program 62.0%

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

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

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

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

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

                      if -2.0000000000000002e44 < im < -11.5

                      1. Initial program 100.0%

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

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

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

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2 \cdot 10^{+44} \lor \neg \left(im \leq -11.5\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \end{array} \]
                        6. Add Preprocessing

                        Alternative 8: 96.0% accurate, 1.9× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq -8.5:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 9 \lor \neg \left(im \leq 2.1 \cdot 10^{+59}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
                        (FPCore (re im)
                         :precision binary64
                         (let* ((t_0
                                 (*
                                  (* 0.5 (sin re))
                                  (*
                                   (-
                                    (*
                                     (* (- (* -0.016666666666666666 (* im im)) 0.3333333333333333) im)
                                     im)
                                    2.0)
                                   im))))
                           (if (<= im -2e+44)
                             t_0
                             (if (<= im -8.5)
                               (* (* 0.5 re) (- (exp (- im)) 1.0))
                               (if (or (<= im 9.0) (not (<= im 2.1e+59)))
                                 t_0
                                 (*
                                  (* (fma (* re re) -0.08333333333333333 0.5) re)
                                  (- 1.0 (exp im))))))))
                        double code(double re, double im) {
                        	double t_0 = (0.5 * sin(re)) * ((((((-0.016666666666666666 * (im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im);
                        	double tmp;
                        	if (im <= -2e+44) {
                        		tmp = t_0;
                        	} else if (im <= -8.5) {
                        		tmp = (0.5 * re) * (exp(-im) - 1.0);
                        	} else if ((im <= 9.0) || !(im <= 2.1e+59)) {
                        		tmp = t_0;
                        	} else {
                        		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (1.0 - exp(im));
                        	}
                        	return tmp;
                        }
                        
                        function code(re, im)
                        	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * Float64(im * im)) - 0.3333333333333333) * im) * im) - 2.0) * im))
                        	tmp = 0.0
                        	if (im <= -2e+44)
                        		tmp = t_0;
                        	elseif (im <= -8.5)
                        		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                        	elseif ((im <= 9.0) || !(im <= 2.1e+59))
                        		tmp = t_0;
                        	else
                        		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(1.0 - exp(im)));
                        	end
                        	return tmp
                        end
                        
                        code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(N[(N[(-0.016666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, -2e+44], t$95$0, If[LessEqual[im, -8.5], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 9.0], N[Not[LessEqual[im, 2.1e+59]], $MachinePrecision]], t$95$0, N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\
                        \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\
                        \;\;\;\;t\_0\\
                        
                        \mathbf{elif}\;im \leq -8.5:\\
                        \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                        
                        \mathbf{elif}\;im \leq 9 \lor \neg \left(im \leq 2.1 \cdot 10^{+59}\right):\\
                        \;\;\;\;t\_0\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(1 - e^{im}\right)\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if im < -2.0000000000000002e44 or -8.5 < im < 9 or 2.09999999999999984e59 < im

                          1. Initial program 59.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                          if -2.0000000000000002e44 < im < -8.5

                          1. Initial program 100.0%

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

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

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

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

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

                              if 9 < im < 2.09999999999999984e59

                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -2 \cdot 10^{+44}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{elif}\;im \leq -8.5:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 9 \lor \neg \left(im \leq 2.1 \cdot 10^{+59}\right):\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left(\left(\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \]
                              7. Add Preprocessing

                              Alternative 9: 59.4% accurate, 1.9× speedup?

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

                                1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                1. Initial program 63.4%

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

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

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

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

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

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

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

                                Alternative 10: 54.6% accurate, 2.0× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 5 \cdot 10^{-113}:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right) \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)) 5e-113)
                                   (*
                                    (* (fma (* re re) -0.08333333333333333 0.5) re)
                                    (* (- (* -0.3333333333333333 (* im im)) 2.0) im))
                                   (*
                                    (*
                                     (*
                                      (fma
                                       (- (* 0.008333333333333333 (* re re)) 0.16666666666666666)
                                       (* re re)
                                       1.0)
                                      re)
                                     (fma (* -0.16666666666666666 im) im -1.0))
                                    im)))
                                double code(double re, double im) {
                                	double tmp;
                                	if ((0.5 * sin(re)) <= 5e-113) {
                                		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                	} else {
                                		tmp = ((fma(((0.008333333333333333 * (re * re)) - 0.16666666666666666), (re * re), 1.0) * re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
                                	}
                                	return tmp;
                                }
                                
                                function code(re, im)
                                	tmp = 0.0
                                	if (Float64(0.5 * sin(re)) <= 5e-113)
                                		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                                	else
                                		tmp = Float64(Float64(Float64(fma(Float64(Float64(0.008333333333333333 * Float64(re * re)) - 0.16666666666666666), Float64(re * re), 1.0) * 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], 5e-113], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(N[(0.008333333333333333 * N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(re * re), $MachinePrecision] + 1.0), $MachinePrecision] * re), $MachinePrecision] * 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 5 \cdot 10^{-113}:\\
                                \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                
                                \mathbf{else}:\\
                                \;\;\;\;\left(\left(\mathsf{fma}\left(0.008333333333333333 \cdot \left(re \cdot re\right) - 0.16666666666666666, re \cdot re, 1\right) \cdot re\right) \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)) < 4.9999999999999997e-113

                                  1. Initial program 71.4%

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

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

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

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

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

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

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

                                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                  5. Applied rewrites80.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)} \]
                                  6. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                Alternative 11: 54.6% accurate, 2.0× speedup?

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

                                  1. Initial program 71.0%

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

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

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

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

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

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

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

                                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                  5. Applied rewrites78.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)} \]
                                  6. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

                                  1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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) \]
                                  8. Applied rewrites26.5%

                                    \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \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) \]
                                  9. Taylor expanded in im around inf

                                    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \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 {im}^{2}\right) \cdot im\right) \]
                                  10. Step-by-step derivation
                                    1. *-commutativeN/A

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

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

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

                                      \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                  11. Applied rewrites26.1%

                                    \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                  12. Taylor expanded in re around 0

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

                                      \[\leadsto \left(\mathsf{fma}\left(0.004166666666666667 \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                  14. Recombined 2 regimes into one program.
                                  15. Add Preprocessing

                                  Alternative 12: 94.2% accurate, 2.1× speedup?

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

                                    1. Initial program 42.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    if -4.3000000000000002e120 < im < -8.5

                                    1. Initial program 100.0%

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

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

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

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

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

                                        if 410 < im < 7.99999999999999982e102

                                        1. Initial program 100.0%

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

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

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

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

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

                                            if 7.99999999999999982e102 < im

                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

                                          Alternative 13: 54.2% accurate, 2.1× speedup?

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

                                            1. Initial program 71.0%

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

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

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

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

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

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

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

                                                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                            5. Applied rewrites78.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)} \]
                                            6. Taylor expanded in re around 0

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

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

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

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

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

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

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

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

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

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

                                            1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 14: 54.2% accurate, 2.1× speedup?

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

                                            1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                            1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

                                            Alternative 15: 54.2% accurate, 2.1× speedup?

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

                                              1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

                                                  \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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) \]
                                              8. Applied rewrites29.7%

                                                \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \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) \]
                                              9. Taylor expanded in im around inf

                                                \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \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 {im}^{2}\right) \cdot im\right) \]
                                              10. Step-by-step derivation
                                                1. *-commutativeN/A

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

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

                                                  \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right) \cdot im\right) \]
                                                4. lift-*.f6429.5

                                                  \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                              11. Applied rewrites29.5%

                                                \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                              12. Taylor expanded in re around 0

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

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

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

                                                1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

                                                Alternative 16: 93.1% accurate, 2.2× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{if}\;im \leq -4.3 \cdot 10^{+120}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq -8.5:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 410 \lor \neg \left(im \leq 3 \cdot 10^{+123}\right):\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \end{array} \]
                                                (FPCore (re im)
                                                 :precision binary64
                                                 (let* ((t_0 (* (* (sin re) (fma (* -0.16666666666666666 im) im -1.0)) im)))
                                                   (if (<= im -4.3e+120)
                                                     t_0
                                                     (if (<= im -8.5)
                                                       (* (* 0.5 re) (- (exp (- im)) 1.0))
                                                       (if (or (<= im 410.0) (not (<= im 3e+123)))
                                                         t_0
                                                         (* (* 0.5 re) (- 1.0 (exp im))))))))
                                                double code(double re, double im) {
                                                	double t_0 = (sin(re) * fma((-0.16666666666666666 * im), im, -1.0)) * im;
                                                	double tmp;
                                                	if (im <= -4.3e+120) {
                                                		tmp = t_0;
                                                	} else if (im <= -8.5) {
                                                		tmp = (0.5 * re) * (exp(-im) - 1.0);
                                                	} else if ((im <= 410.0) || !(im <= 3e+123)) {
                                                		tmp = t_0;
                                                	} else {
                                                		tmp = (0.5 * re) * (1.0 - exp(im));
                                                	}
                                                	return tmp;
                                                }
                                                
                                                function code(re, im)
                                                	t_0 = Float64(Float64(sin(re) * fma(Float64(-0.16666666666666666 * im), im, -1.0)) * im)
                                                	tmp = 0.0
                                                	if (im <= -4.3e+120)
                                                		tmp = t_0;
                                                	elseif (im <= -8.5)
                                                		tmp = Float64(Float64(0.5 * re) * Float64(exp(Float64(-im)) - 1.0));
                                                	elseif ((im <= 410.0) || !(im <= 3e+123))
                                                		tmp = t_0;
                                                	else
                                                		tmp = Float64(Float64(0.5 * re) * Float64(1.0 - exp(im)));
                                                	end
                                                	return tmp
                                                end
                                                
                                                code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * N[(N[(-0.16666666666666666 * im), $MachinePrecision] * im + -1.0), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]}, If[LessEqual[im, -4.3e+120], t$95$0, If[LessEqual[im, -8.5], N[(N[(0.5 * re), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[im, 410.0], N[Not[LessEqual[im, 3e+123]], $MachinePrecision]], t$95$0, N[(N[(0.5 * re), $MachinePrecision] * N[(1.0 - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                t_0 := \left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\
                                                \mathbf{if}\;im \leq -4.3 \cdot 10^{+120}:\\
                                                \;\;\;\;t\_0\\
                                                
                                                \mathbf{elif}\;im \leq -8.5:\\
                                                \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\
                                                
                                                \mathbf{elif}\;im \leq 410 \lor \neg \left(im \leq 3 \cdot 10^{+123}\right):\\
                                                \;\;\;\;t\_0\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 3 regimes
                                                2. if im < -4.3000000000000002e120 or -8.5 < im < 410 or 3.00000000000000008e123 < im

                                                  1. Initial program 53.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                  if -4.3000000000000002e120 < im < -8.5

                                                  1. Initial program 100.0%

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

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

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

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

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

                                                      if 410 < im < 3.00000000000000008e123

                                                      1. Initial program 100.0%

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

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

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

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

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

                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -4.3 \cdot 10^{+120}:\\ \;\;\;\;\left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{elif}\;im \leq -8.5:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(e^{-im} - 1\right)\\ \mathbf{elif}\;im \leq 410 \lor \neg \left(im \leq 3 \cdot 10^{+123}\right):\\ \;\;\;\;\left(\sin re \cdot \mathsf{fma}\left(-0.16666666666666666 \cdot im, im, -1\right)\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 - e^{im}\right)\\ \end{array} \]
                                                        6. Add Preprocessing

                                                        Alternative 17: 53.5% accurate, 2.3× speedup?

                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\ \end{array} \end{array} \]
                                                        (FPCore (re im)
                                                         :precision binary64
                                                         (if (<= (* 0.5 (sin re)) -0.01)
                                                           (* (- (* (* re re) (* 0.16666666666666666 im)) im) re)
                                                           (* (* 0.5 re) (* (- (* -0.3333333333333333 (* im im)) 2.0) im))))
                                                        double code(double re, double im) {
                                                        	double tmp;
                                                        	if ((0.5 * sin(re)) <= -0.01) {
                                                        		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                        	} else {
                                                        		tmp = (0.5 * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        module fmin_fmax_functions
                                                            implicit none
                                                            private
                                                            public fmax
                                                            public fmin
                                                        
                                                            interface fmax
                                                                module procedure fmax88
                                                                module procedure fmax44
                                                                module procedure fmax84
                                                                module procedure fmax48
                                                            end interface
                                                            interface fmin
                                                                module procedure fmin88
                                                                module procedure fmin44
                                                                module procedure fmin84
                                                                module procedure fmin48
                                                            end interface
                                                        contains
                                                            real(8) function fmax88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmax44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmax48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin88(x, y) result (res)
                                                                real(8), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(4) function fmin44(x, y) result (res)
                                                                real(4), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin84(x, y) result(res)
                                                                real(8), intent (in) :: x
                                                                real(4), intent (in) :: y
                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                            end function
                                                            real(8) function fmin48(x, y) result(res)
                                                                real(4), intent (in) :: x
                                                                real(8), intent (in) :: y
                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                            end function
                                                        end module
                                                        
                                                        real(8) function code(re, im)
                                                        use fmin_fmax_functions
                                                            real(8), intent (in) :: re
                                                            real(8), intent (in) :: im
                                                            real(8) :: tmp
                                                            if ((0.5d0 * sin(re)) <= (-0.01d0)) then
                                                                tmp = (((re * re) * (0.16666666666666666d0 * im)) - im) * re
                                                            else
                                                                tmp = (0.5d0 * re) * ((((-0.3333333333333333d0) * (im * im)) - 2.0d0) * im)
                                                            end if
                                                            code = tmp
                                                        end function
                                                        
                                                        public static double code(double re, double im) {
                                                        	double tmp;
                                                        	if ((0.5 * Math.sin(re)) <= -0.01) {
                                                        		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                        	} else {
                                                        		tmp = (0.5 * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                        	}
                                                        	return tmp;
                                                        }
                                                        
                                                        def code(re, im):
                                                        	tmp = 0
                                                        	if (0.5 * math.sin(re)) <= -0.01:
                                                        		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re
                                                        	else:
                                                        		tmp = (0.5 * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im)
                                                        	return tmp
                                                        
                                                        function code(re, im)
                                                        	tmp = 0.0
                                                        	if (Float64(0.5 * sin(re)) <= -0.01)
                                                        		tmp = Float64(Float64(Float64(Float64(re * re) * Float64(0.16666666666666666 * im)) - im) * re);
                                                        	else
                                                        		tmp = Float64(Float64(0.5 * re) * Float64(Float64(Float64(-0.3333333333333333 * Float64(im * im)) - 2.0) * im));
                                                        	end
                                                        	return tmp
                                                        end
                                                        
                                                        function tmp_2 = code(re, im)
                                                        	tmp = 0.0;
                                                        	if ((0.5 * sin(re)) <= -0.01)
                                                        		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                        	else
                                                        		tmp = (0.5 * re) * (((-0.3333333333333333 * (im * im)) - 2.0) * im);
                                                        	end
                                                        	tmp_2 = tmp;
                                                        end
                                                        
                                                        code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.01], N[(N[(N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * im), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] * re), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
                                                        
                                                        \begin{array}{l}
                                                        
                                                        \\
                                                        \begin{array}{l}
                                                        \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\
                                                        \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\
                                                        
                                                        \mathbf{else}:\\
                                                        \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)\\
                                                        
                                                        
                                                        \end{array}
                                                        \end{array}
                                                        
                                                        Derivation
                                                        1. Split input into 2 regimes
                                                        2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0100000000000000002

                                                          1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                          1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

                                                          Alternative 18: 50.7% accurate, 2.3× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \cdot re\right) \cdot im\\ \end{array} \end{array} \]
                                                          (FPCore (re im)
                                                           :precision binary64
                                                           (if (<= (* 0.5 (sin re)) -0.01)
                                                             (* (- (* (* re re) (* 0.16666666666666666 im)) im) re)
                                                             (* (* (- (* (* im im) -0.16666666666666666) 1.0) re) im)))
                                                          double code(double re, double im) {
                                                          	double tmp;
                                                          	if ((0.5 * sin(re)) <= -0.01) {
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	} else {
                                                          		tmp = ((((im * im) * -0.16666666666666666) - 1.0) * re) * im;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          module fmin_fmax_functions
                                                              implicit none
                                                              private
                                                              public fmax
                                                              public fmin
                                                          
                                                              interface fmax
                                                                  module procedure fmax88
                                                                  module procedure fmax44
                                                                  module procedure fmax84
                                                                  module procedure fmax48
                                                              end interface
                                                              interface fmin
                                                                  module procedure fmin88
                                                                  module procedure fmin44
                                                                  module procedure fmin84
                                                                  module procedure fmin48
                                                              end interface
                                                          contains
                                                              real(8) function fmax88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmax44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmin44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                              end function
                                                          end module
                                                          
                                                          real(8) function code(re, im)
                                                          use fmin_fmax_functions
                                                              real(8), intent (in) :: re
                                                              real(8), intent (in) :: im
                                                              real(8) :: tmp
                                                              if ((0.5d0 * sin(re)) <= (-0.01d0)) then
                                                                  tmp = (((re * re) * (0.16666666666666666d0 * im)) - im) * re
                                                              else
                                                                  tmp = ((((im * im) * (-0.16666666666666666d0)) - 1.0d0) * re) * im
                                                              end if
                                                              code = tmp
                                                          end function
                                                          
                                                          public static double code(double re, double im) {
                                                          	double tmp;
                                                          	if ((0.5 * Math.sin(re)) <= -0.01) {
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	} else {
                                                          		tmp = ((((im * im) * -0.16666666666666666) - 1.0) * re) * im;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          def code(re, im):
                                                          	tmp = 0
                                                          	if (0.5 * math.sin(re)) <= -0.01:
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re
                                                          	else:
                                                          		tmp = ((((im * im) * -0.16666666666666666) - 1.0) * re) * im
                                                          	return tmp
                                                          
                                                          function code(re, im)
                                                          	tmp = 0.0
                                                          	if (Float64(0.5 * sin(re)) <= -0.01)
                                                          		tmp = Float64(Float64(Float64(Float64(re * re) * Float64(0.16666666666666666 * im)) - im) * re);
                                                          	else
                                                          		tmp = Float64(Float64(Float64(Float64(Float64(im * im) * -0.16666666666666666) - 1.0) * re) * im);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          function tmp_2 = code(re, im)
                                                          	tmp = 0.0;
                                                          	if ((0.5 * sin(re)) <= -0.01)
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	else
                                                          		tmp = ((((im * im) * -0.16666666666666666) - 1.0) * re) * im;
                                                          	end
                                                          	tmp_2 = tmp;
                                                          end
                                                          
                                                          code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.01], N[(N[(N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * im), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] * re), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - 1.0), $MachinePrecision] * re), $MachinePrecision] * im), $MachinePrecision]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\
                                                          \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \cdot re\right) \cdot im\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0100000000000000002

                                                            1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                            1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \left(\left(\left(im \cdot im\right) \cdot -0.16666666666666666 - 1\right) \cdot re\right) \cdot im \]
                                                            8. Applied rewrites49.7%

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

                                                          Alternative 19: 35.2% accurate, 2.3× speedup?

                                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 2 \cdot 10^{-7}:\\ \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \end{array} \]
                                                          (FPCore (re im)
                                                           :precision binary64
                                                           (if (<= (* 0.5 (sin re)) 2e-7)
                                                             (* (- (* (* re re) (* 0.16666666666666666 im)) im) re)
                                                             (* (- re) im)))
                                                          double code(double re, double im) {
                                                          	double tmp;
                                                          	if ((0.5 * sin(re)) <= 2e-7) {
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	} else {
                                                          		tmp = -re * im;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          module fmin_fmax_functions
                                                              implicit none
                                                              private
                                                              public fmax
                                                              public fmin
                                                          
                                                              interface fmax
                                                                  module procedure fmax88
                                                                  module procedure fmax44
                                                                  module procedure fmax84
                                                                  module procedure fmax48
                                                              end interface
                                                              interface fmin
                                                                  module procedure fmin88
                                                                  module procedure fmin44
                                                                  module procedure fmin84
                                                                  module procedure fmin48
                                                              end interface
                                                          contains
                                                              real(8) function fmax88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmax44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmax48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin88(x, y) result (res)
                                                                  real(8), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(4) function fmin44(x, y) result (res)
                                                                  real(4), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin84(x, y) result(res)
                                                                  real(8), intent (in) :: x
                                                                  real(4), intent (in) :: y
                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                              end function
                                                              real(8) function fmin48(x, y) result(res)
                                                                  real(4), intent (in) :: x
                                                                  real(8), intent (in) :: y
                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                              end function
                                                          end module
                                                          
                                                          real(8) function code(re, im)
                                                          use fmin_fmax_functions
                                                              real(8), intent (in) :: re
                                                              real(8), intent (in) :: im
                                                              real(8) :: tmp
                                                              if ((0.5d0 * sin(re)) <= 2d-7) then
                                                                  tmp = (((re * re) * (0.16666666666666666d0 * im)) - im) * re
                                                              else
                                                                  tmp = -re * im
                                                              end if
                                                              code = tmp
                                                          end function
                                                          
                                                          public static double code(double re, double im) {
                                                          	double tmp;
                                                          	if ((0.5 * Math.sin(re)) <= 2e-7) {
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	} else {
                                                          		tmp = -re * im;
                                                          	}
                                                          	return tmp;
                                                          }
                                                          
                                                          def code(re, im):
                                                          	tmp = 0
                                                          	if (0.5 * math.sin(re)) <= 2e-7:
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re
                                                          	else:
                                                          		tmp = -re * im
                                                          	return tmp
                                                          
                                                          function code(re, im)
                                                          	tmp = 0.0
                                                          	if (Float64(0.5 * sin(re)) <= 2e-7)
                                                          		tmp = Float64(Float64(Float64(Float64(re * re) * Float64(0.16666666666666666 * im)) - im) * re);
                                                          	else
                                                          		tmp = Float64(Float64(-re) * im);
                                                          	end
                                                          	return tmp
                                                          end
                                                          
                                                          function tmp_2 = code(re, im)
                                                          	tmp = 0.0;
                                                          	if ((0.5 * sin(re)) <= 2e-7)
                                                          		tmp = (((re * re) * (0.16666666666666666 * im)) - im) * re;
                                                          	else
                                                          		tmp = -re * im;
                                                          	end
                                                          	tmp_2 = tmp;
                                                          end
                                                          
                                                          code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], 2e-7], N[(N[(N[(N[(re * re), $MachinePrecision] * N[(0.16666666666666666 * im), $MachinePrecision]), $MachinePrecision] - im), $MachinePrecision] * re), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                                                          
                                                          \begin{array}{l}
                                                          
                                                          \\
                                                          \begin{array}{l}
                                                          \mathbf{if}\;0.5 \cdot \sin re \leq 2 \cdot 10^{-7}:\\
                                                          \;\;\;\;\left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re\\
                                                          
                                                          \mathbf{else}:\\
                                                          \;\;\;\;\left(-re\right) \cdot im\\
                                                          
                                                          
                                                          \end{array}
                                                          \end{array}
                                                          
                                                          Derivation
                                                          1. Split input into 2 regimes
                                                          2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < 1.9999999999999999e-7

                                                            1. Initial program 71.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666 - im\right) \cdot re \]
                                                            11. Applied rewrites42.2%

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \left(\left(re \cdot re\right) \cdot \left(0.16666666666666666 \cdot im\right) - im\right) \cdot re \]
                                                            13. Applied rewrites42.2%

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

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

                                                            1. Initial program 47.1%

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

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

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

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

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

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

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

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

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

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

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

                                                            Alternative 20: 86.6% accurate, 2.4× speedup?

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

                                                              1. Initial program 100.0%

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

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

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

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

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

                                                                  if -8.5 < im < 410

                                                                  1. Initial program 26.7%

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

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

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

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

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

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

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

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

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

                                                                  if 410 < im < 1.9999999999999999e99

                                                                  1. Initial program 100.0%

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

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

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

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

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

                                                                      if 1.9999999999999999e99 < im

                                                                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                                          \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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) \]
                                                                      8. Applied rewrites81.0%

                                                                        \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \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) \]
                                                                      9. Taylor expanded in im around inf

                                                                        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \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 {im}^{2}\right) \cdot im\right) \]
                                                                      10. Step-by-step derivation
                                                                        1. *-commutativeN/A

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

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

                                                                          \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right) \cdot im\right) \]
                                                                        4. lift-*.f6481.0

                                                                          \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                      11. Applied rewrites81.0%

                                                                        \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                      12. Taylor expanded in re around inf

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

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

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

                                                                          \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot \frac{-1}{10080}\right) \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right) \cdot im\right) \]
                                                                        4. lift-*.f6481.0

                                                                          \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot -9.92063492063492 \cdot 10^{-5}\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                      14. Applied rewrites81.0%

                                                                        \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot -9.92063492063492 \cdot 10^{-5}\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                    4. Recombined 4 regimes into one program.
                                                                    5. Add Preprocessing

                                                                    Alternative 21: 84.9% accurate, 2.4× speedup?

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

                                                                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                      if -0.0210000000000000013 < im < 410

                                                                      1. Initial program 26.1%

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

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

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

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

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

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

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

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

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

                                                                      if 410 < im < 1.9999999999999999e99

                                                                      1. Initial program 100.0%

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

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

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

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

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

                                                                          if 1.9999999999999999e99 < im

                                                                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \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) \]
                                                                          8. Applied rewrites81.0%

                                                                            \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \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) \]
                                                                          9. Taylor expanded in im around inf

                                                                            \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \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 {im}^{2}\right) \cdot im\right) \]
                                                                          10. Step-by-step derivation
                                                                            1. *-commutativeN/A

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

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

                                                                              \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{-1}{10080}, re \cdot re, \frac{1}{240}\right) \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right) \cdot im\right) \]
                                                                            4. lift-*.f6481.0

                                                                              \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                          11. Applied rewrites81.0%

                                                                            \[\leadsto \left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                          12. Taylor expanded in re around inf

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

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

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

                                                                              \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot \frac{-1}{10080}\right) \cdot \left(re \cdot re\right) - \frac{1}{12}, re \cdot re, \frac{1}{2}\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot \frac{-1}{3}\right) \cdot im\right) \]
                                                                            4. lift-*.f6481.0

                                                                              \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot -9.92063492063492 \cdot 10^{-5}\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                          14. Applied rewrites81.0%

                                                                            \[\leadsto \left(\mathsf{fma}\left(\left(\left(re \cdot re\right) \cdot -9.92063492063492 \cdot 10^{-5}\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot \left(\left(\left(im \cdot im\right) \cdot -0.3333333333333333\right) \cdot im\right) \]
                                                                        4. Recombined 4 regimes into one program.
                                                                        5. Add Preprocessing

                                                                        Alternative 22: 35.1% accurate, 2.4× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\ \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \end{array} \]
                                                                        (FPCore (re im)
                                                                         :precision binary64
                                                                         (if (<= (* 0.5 (sin re)) -0.01)
                                                                           (* (* (* (* re re) im) 0.16666666666666666) re)
                                                                           (* (- re) im)))
                                                                        double code(double re, double im) {
                                                                        	double tmp;
                                                                        	if ((0.5 * sin(re)) <= -0.01) {
                                                                        		tmp = (((re * re) * im) * 0.16666666666666666) * re;
                                                                        	} else {
                                                                        		tmp = -re * im;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        module fmin_fmax_functions
                                                                            implicit none
                                                                            private
                                                                            public fmax
                                                                            public fmin
                                                                        
                                                                            interface fmax
                                                                                module procedure fmax88
                                                                                module procedure fmax44
                                                                                module procedure fmax84
                                                                                module procedure fmax48
                                                                            end interface
                                                                            interface fmin
                                                                                module procedure fmin88
                                                                                module procedure fmin44
                                                                                module procedure fmin84
                                                                                module procedure fmin48
                                                                            end interface
                                                                        contains
                                                                            real(8) function fmax88(x, y) result (res)
                                                                                real(8), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(4) function fmax44(x, y) result (res)
                                                                                real(4), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmax84(x, y) result(res)
                                                                                real(8), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmax48(x, y) result(res)
                                                                                real(4), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin88(x, y) result (res)
                                                                                real(8), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(4) function fmin44(x, y) result (res)
                                                                                real(4), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin84(x, y) result(res)
                                                                                real(8), intent (in) :: x
                                                                                real(4), intent (in) :: y
                                                                                res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                            end function
                                                                            real(8) function fmin48(x, y) result(res)
                                                                                real(4), intent (in) :: x
                                                                                real(8), intent (in) :: y
                                                                                res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                            end function
                                                                        end module
                                                                        
                                                                        real(8) function code(re, im)
                                                                        use fmin_fmax_functions
                                                                            real(8), intent (in) :: re
                                                                            real(8), intent (in) :: im
                                                                            real(8) :: tmp
                                                                            if ((0.5d0 * sin(re)) <= (-0.01d0)) then
                                                                                tmp = (((re * re) * im) * 0.16666666666666666d0) * re
                                                                            else
                                                                                tmp = -re * im
                                                                            end if
                                                                            code = tmp
                                                                        end function
                                                                        
                                                                        public static double code(double re, double im) {
                                                                        	double tmp;
                                                                        	if ((0.5 * Math.sin(re)) <= -0.01) {
                                                                        		tmp = (((re * re) * im) * 0.16666666666666666) * re;
                                                                        	} else {
                                                                        		tmp = -re * im;
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        def code(re, im):
                                                                        	tmp = 0
                                                                        	if (0.5 * math.sin(re)) <= -0.01:
                                                                        		tmp = (((re * re) * im) * 0.16666666666666666) * re
                                                                        	else:
                                                                        		tmp = -re * im
                                                                        	return tmp
                                                                        
                                                                        function code(re, im)
                                                                        	tmp = 0.0
                                                                        	if (Float64(0.5 * sin(re)) <= -0.01)
                                                                        		tmp = Float64(Float64(Float64(Float64(re * re) * im) * 0.16666666666666666) * re);
                                                                        	else
                                                                        		tmp = Float64(Float64(-re) * im);
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        function tmp_2 = code(re, im)
                                                                        	tmp = 0.0;
                                                                        	if ((0.5 * sin(re)) <= -0.01)
                                                                        		tmp = (((re * re) * im) * 0.16666666666666666) * re;
                                                                        	else
                                                                        		tmp = -re * im;
                                                                        	end
                                                                        	tmp_2 = tmp;
                                                                        end
                                                                        
                                                                        code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.01], N[(N[(N[(N[(re * re), $MachinePrecision] * im), $MachinePrecision] * 0.16666666666666666), $MachinePrecision] * re), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;0.5 \cdot \sin re \leq -0.01:\\
                                                                        \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666\right) \cdot re\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;\left(-re\right) \cdot im\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 2 regimes
                                                                        2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0100000000000000002

                                                                          1. Initial program 64.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            \[\leadsto \left(\left(\left(re \cdot re\right) \cdot im\right) \cdot 0.16666666666666666 - im\right) \cdot re \]
                                                                          12. Taylor expanded in re around inf

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

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

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

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

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

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

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

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

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

                                                                          1. Initial program 63.4%

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

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

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

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

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

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

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

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

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

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

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

                                                                          Alternative 23: 82.8% accurate, 2.6× speedup?

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

                                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            if -0.0210000000000000013 < im < 1.85000000000000006e23

                                                                            1. Initial program 28.9%

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

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

                                                                                \[\leadsto -1 \cdot \left(\sin re \cdot \color{blue}{im}\right) \]
                                                                              2. associate-*r*N/A

                                                                                \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                                                              3. lower-*.f64N/A

                                                                                \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                                                              4. mul-1-negN/A

                                                                                \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                                                                              5. lower-neg.f64N/A

                                                                                \[\leadsto \left(-\sin re\right) \cdot im \]
                                                                              6. lift-sin.f6495.1

                                                                                \[\leadsto \left(-\sin re\right) \cdot im \]
                                                                            5. Applied rewrites95.1%

                                                                              \[\leadsto \color{blue}{\left(-\sin re\right) \cdot im} \]

                                                                            if 1.85000000000000006e23 < im

                                                                            1. Initial program 100.0%

                                                                              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                                                                            2. Add Preprocessing
                                                                            3. Taylor expanded in im around 0

                                                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(im \cdot \left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right)\right)} \]
                                                                            4. Step-by-step derivation
                                                                              1. *-commutativeN/A

                                                                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                                                                              2. lower-*.f64N/A

                                                                                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
                                                                            5. Applied rewrites92.3%

                                                                              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right)} \]
                                                                            6. Taylor expanded in re around 0

                                                                              \[\leadsto \color{blue}{\left(re \cdot \left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right)\right)} \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                            7. Step-by-step derivation
                                                                              1. *-commutativeN/A

                                                                                \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                              2. lower-*.f64N/A

                                                                                \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot \left(\left(\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                            8. Applied rewrites74.0%

                                                                              \[\leadsto \color{blue}{\left(\mathsf{fma}\left(\mathsf{fma}\left(-9.92063492063492 \cdot 10^{-5}, re \cdot re, 0.004166666666666667\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right)} \cdot \left(\left(\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333\right) \cdot \left(im \cdot im\right) - 2\right) \cdot im\right) \]
                                                                          3. Recombined 3 regimes into one program.
                                                                          4. Add Preprocessing

                                                                          Alternative 24: 33.6% accurate, 39.5× speedup?

                                                                          \[\begin{array}{l} \\ \left(-re\right) \cdot im \end{array} \]
                                                                          (FPCore (re im) :precision binary64 (* (- re) im))
                                                                          double code(double re, double im) {
                                                                          	return -re * im;
                                                                          }
                                                                          
                                                                          module fmin_fmax_functions
                                                                              implicit none
                                                                              private
                                                                              public fmax
                                                                              public fmin
                                                                          
                                                                              interface fmax
                                                                                  module procedure fmax88
                                                                                  module procedure fmax44
                                                                                  module procedure fmax84
                                                                                  module procedure fmax48
                                                                              end interface
                                                                              interface fmin
                                                                                  module procedure fmin88
                                                                                  module procedure fmin44
                                                                                  module procedure fmin84
                                                                                  module procedure fmin48
                                                                              end interface
                                                                          contains
                                                                              real(8) function fmax88(x, y) result (res)
                                                                                  real(8), intent (in) :: x
                                                                                  real(8), intent (in) :: y
                                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                              end function
                                                                              real(4) function fmax44(x, y) result (res)
                                                                                  real(4), intent (in) :: x
                                                                                  real(4), intent (in) :: y
                                                                                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                                              end function
                                                                              real(8) function fmax84(x, y) result(res)
                                                                                  real(8), intent (in) :: x
                                                                                  real(4), intent (in) :: y
                                                                                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                                              end function
                                                                              real(8) function fmax48(x, y) result(res)
                                                                                  real(4), intent (in) :: x
                                                                                  real(8), intent (in) :: y
                                                                                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                                              end function
                                                                              real(8) function fmin88(x, y) result (res)
                                                                                  real(8), intent (in) :: x
                                                                                  real(8), intent (in) :: y
                                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                              end function
                                                                              real(4) function fmin44(x, y) result (res)
                                                                                  real(4), intent (in) :: x
                                                                                  real(4), intent (in) :: y
                                                                                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                                              end function
                                                                              real(8) function fmin84(x, y) result(res)
                                                                                  real(8), intent (in) :: x
                                                                                  real(4), intent (in) :: y
                                                                                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                                              end function
                                                                              real(8) function fmin48(x, y) result(res)
                                                                                  real(4), intent (in) :: x
                                                                                  real(8), intent (in) :: y
                                                                                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                                              end function
                                                                          end module
                                                                          
                                                                          real(8) function code(re, im)
                                                                          use fmin_fmax_functions
                                                                              real(8), intent (in) :: re
                                                                              real(8), intent (in) :: im
                                                                              code = -re * im
                                                                          end function
                                                                          
                                                                          public static double code(double re, double im) {
                                                                          	return -re * im;
                                                                          }
                                                                          
                                                                          def code(re, im):
                                                                          	return -re * im
                                                                          
                                                                          function code(re, im)
                                                                          	return Float64(Float64(-re) * im)
                                                                          end
                                                                          
                                                                          function tmp = code(re, im)
                                                                          	tmp = -re * im;
                                                                          end
                                                                          
                                                                          code[re_, im_] := N[((-re) * im), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          \left(-re\right) \cdot im
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Initial program 63.6%

                                                                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right) \]
                                                                          2. Add Preprocessing
                                                                          3. Taylor expanded in im around 0

                                                                            \[\leadsto \color{blue}{-1 \cdot \left(im \cdot \sin re\right)} \]
                                                                          4. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto -1 \cdot \left(\sin re \cdot \color{blue}{im}\right) \]
                                                                            2. associate-*r*N/A

                                                                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                                                            3. lower-*.f64N/A

                                                                              \[\leadsto \left(-1 \cdot \sin re\right) \cdot \color{blue}{im} \]
                                                                            4. mul-1-negN/A

                                                                              \[\leadsto \left(\mathsf{neg}\left(\sin re\right)\right) \cdot im \]
                                                                            5. lower-neg.f64N/A

                                                                              \[\leadsto \left(-\sin re\right) \cdot im \]
                                                                            6. lift-sin.f6451.0

                                                                              \[\leadsto \left(-\sin re\right) \cdot im \]
                                                                          5. Applied rewrites51.0%

                                                                            \[\leadsto \color{blue}{\left(-\sin re\right) \cdot im} \]
                                                                          6. Taylor expanded in re around 0

                                                                            \[\leadsto \left(-re\right) \cdot im \]
                                                                          7. Step-by-step derivation
                                                                            1. Applied rewrites29.4%

                                                                              \[\leadsto \left(-re\right) \cdot im \]
                                                                            2. Add Preprocessing

                                                                            Reproduce

                                                                            ?
                                                                            herbie shell --seed 2025085 
                                                                            (FPCore (re im)
                                                                              :name "math.cos on complex, imaginary part"
                                                                              :precision binary64
                                                                            
                                                                              :alt
                                                                              (! :herbie-platform default (if (< (fabs im) 1) (- (* (sin re) (+ im (* 1/6 im im im) (* 1/120 im im im im im)))) (* (* 1/2 (sin re)) (- (exp (- im)) (exp im)))))
                                                                            
                                                                              (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))