math.cos on complex, imaginary part

Percentage Accurate: 66.4% → 99.9%
Time: 8.1s
Alternatives: 21
Speedup: 2.5×

Specification

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

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

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 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.4% accurate, 1.0× speedup?

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

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

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

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

Alternative 1: 99.9% accurate, 1.5× speedup?

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

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

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

\\
\sinh \left(-im\right) \cdot \sin re
\end{array}
Derivation
  1. Initial program 61.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\color{blue}{\left(2 \cdot \sinh \left(-im\right)\right)} \cdot \sin re\right) \cdot \frac{1}{2} \]
    15. lower-sinh.f6499.9

      \[\leadsto \left(\left(2 \cdot \color{blue}{\sinh \left(-im\right)}\right) \cdot \sin re\right) \cdot 0.5 \]
  4. Applied rewrites99.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{1 \cdot \left(\sinh \left(-im\right) \cdot \sin re\right)} \]
    9. *-commutativeN/A

      \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
    10. lower-*.f6499.9

      \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
  6. Applied rewrites99.9%

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

      \[\leadsto \color{blue}{1 \cdot \left(\sin re \cdot \sinh \left(-im\right)\right)} \]
    2. *-lft-identity99.9

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

      \[\leadsto \color{blue}{\sin re \cdot \sinh \left(-im\right)} \]
    4. *-commutativeN/A

      \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
    5. lower-*.f6499.9

      \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
  8. Applied rewrites99.9%

    \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
  9. Add Preprocessing

Alternative 2: 83.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-im} - e^{im}\\ \mathbf{if}\;t\_0 \leq -0.002 \lor \neg \left(t\_0 \leq 2 \cdot 10^{-6}\right):\\ \;\;\;\;\left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), re, re\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \end{array} \end{array} \]
(FPCore (re im)
 :precision binary64
 (let* ((t_0 (- (exp (- im)) (exp im))))
   (if (or (<= t_0 -0.002) (not (<= t_0 2e-6)))
     (*
      (*
       0.5
       (fma
        (*
         (-
          (*
           (* (fma -0.0001984126984126984 (* re re) 0.008333333333333333) re)
           re)
          0.16666666666666666)
         (* re re))
        re
        re))
      (*
       (fma
        (fma
         (fma -0.0003968253968253968 (* im im) -0.016666666666666666)
         (* im im)
         -0.3333333333333333)
        (* im im)
        -2.0)
       im))
     (* (- (sin re)) im))))
double code(double re, double im) {
	double t_0 = exp(-im) - exp(im);
	double tmp;
	if ((t_0 <= -0.002) || !(t_0 <= 2e-6)) {
		tmp = (0.5 * fma(((((fma(-0.0001984126984126984, (re * re), 0.008333333333333333) * re) * re) - 0.16666666666666666) * (re * re)), re, re)) * (fma(fma(fma(-0.0003968253968253968, (im * im), -0.016666666666666666), (im * im), -0.3333333333333333), (im * im), -2.0) * im);
	} else {
		tmp = -sin(re) * im;
	}
	return tmp;
}
function code(re, im)
	t_0 = Float64(exp(Float64(-im)) - exp(im))
	tmp = 0.0
	if ((t_0 <= -0.002) || !(t_0 <= 2e-6))
		tmp = Float64(Float64(0.5 * fma(Float64(Float64(Float64(Float64(fma(-0.0001984126984126984, Float64(re * re), 0.008333333333333333) * re) * re) - 0.16666666666666666) * Float64(re * re)), re, re)) * Float64(fma(fma(fma(-0.0003968253968253968, Float64(im * im), -0.016666666666666666), Float64(im * im), -0.3333333333333333), Float64(im * im), -2.0) * im));
	else
		tmp = Float64(Float64(-sin(re)) * im);
	end
	return tmp
end
code[re_, im_] := Block[{t$95$0 = N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, -0.002], N[Not[LessEqual[t$95$0, 2e-6]], $MachinePrecision]], N[(N[(0.5 * N[(N[(N[(N[(N[(N[(-0.0001984126984126984 * N[(re * re), $MachinePrecision] + 0.008333333333333333), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] - 0.16666666666666666), $MachinePrecision] * N[(re * re), $MachinePrecision]), $MachinePrecision] * re + re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision] + -0.016666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[((-N[Sin[re], $MachinePrecision]) * im), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{-im} - e^{im}\\
\mathbf{if}\;t\_0 \leq -0.002 \lor \neg \left(t\_0 \leq 2 \cdot 10^{-6}\right):\\
\;\;\;\;\left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), re, re\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right)\\

\mathbf{else}:\\
\;\;\;\;\left(-\sin re\right) \cdot im\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < -2e-3 or 1.99999999999999991e-6 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))

    1. Initial program 99.9%

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\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 im\right)} \]
    5. Applied rewrites84.7%

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \left(re \cdot \color{blue}{\left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + 1\right)}\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      2. distribute-rgt-inN/A

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

        \[\leadsto \left(\frac{1}{2} \cdot \left(\color{blue}{re \cdot \left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right)\right)} + 1 \cdot re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      4. *-lft-identityN/A

        \[\leadsto \left(\frac{1}{2} \cdot \left(re \cdot \left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right)\right) + \color{blue}{re}\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      5. associate-*r*N/A

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

        \[\leadsto \left(\frac{1}{2} \cdot \left(\left(re \cdot \color{blue}{\left(re \cdot re\right)}\right) \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      7. cube-unmultN/A

        \[\leadsto \left(\frac{1}{2} \cdot \left(\color{blue}{{re}^{3}} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      8. metadata-evalN/A

        \[\leadsto \left(\frac{1}{2} \cdot \left({re}^{\color{blue}{\left(2 + 1\right)}} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      9. pow-plusN/A

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

        \[\leadsto \left(\frac{1}{2} \cdot \color{blue}{\mathsf{fma}\left({re}^{2} \cdot re, {re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}, re\right)}\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
    8. Applied rewrites72.8%

      \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{fma}\left({re}^{3}, \left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666, re\right)}\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right) \]
    9. Step-by-step derivation
      1. Applied rewrites72.8%

        \[\leadsto \left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), \color{blue}{re}, re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right) \]
      2. Taylor expanded in im around 0

        \[\leadsto \left(\frac{1}{2} \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(\frac{-1}{5040}, re \cdot re, \frac{1}{120}\right) \cdot re\right) \cdot re - \frac{1}{6}\right) \cdot \left(re \cdot re\right), re, re\right)\right) \cdot \left(\mathsf{fma}\left({im}^{2} \cdot \left(\frac{-1}{2520} \cdot {im}^{2} - \frac{1}{60}\right) - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
      3. Step-by-step derivation
        1. Applied rewrites72.8%

          \[\leadsto \left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), re, re\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right) \]

        if -2e-3 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1.99999999999999991e-6

        1. Initial program 28.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 \color{blue}{\left(\sin re \cdot im\right)} \]
          2. associate-*r*N/A

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

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

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

            \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
          6. lower-sin.f6499.8

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;e^{-im} - e^{im} \leq -0.002 \lor \neg \left(e^{-im} - e^{im} \leq 2 \cdot 10^{-6}\right):\\ \;\;\;\;\left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), re, re\right)\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(-\sin re\right) \cdot im\\ \end{array} \]
      6. Add Preprocessing

      Alternative 3: 84.6% accurate, 0.6× speedup?

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

        1. Initial program 99.8%

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
        6. Step-by-step derivation
          1. lower-*.f6480.8

            \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
        7. Applied rewrites80.8%

          \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
        8. Step-by-step derivation
          1. lift-*.f64N/A

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

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

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

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

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

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

            \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
          8. remove-double-divN/A

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

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

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

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

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

        if -2e-3 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im)) < 1.99999999999999991e-6

        1. Initial program 28.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 \color{blue}{\left(\sin re \cdot im\right)} \]
          2. associate-*r*N/A

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

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

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

            \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
          6. lower-sin.f6499.8

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

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

        if 1.99999999999999991e-6 < (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 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 \color{blue}{\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 im\right)} \]
          2. lower-*.f64N/A

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

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

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

            \[\leadsto \left(\frac{1}{2} \cdot \left(re \cdot \color{blue}{\left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + 1\right)}\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          2. distribute-rgt-inN/A

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

            \[\leadsto \left(\frac{1}{2} \cdot \left(\color{blue}{re \cdot \left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right)\right)} + 1 \cdot re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          4. *-lft-identityN/A

            \[\leadsto \left(\frac{1}{2} \cdot \left(re \cdot \left({re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right)\right) + \color{blue}{re}\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          5. associate-*r*N/A

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

            \[\leadsto \left(\frac{1}{2} \cdot \left(\left(re \cdot \color{blue}{\left(re \cdot re\right)}\right) \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          7. cube-unmultN/A

            \[\leadsto \left(\frac{1}{2} \cdot \left(\color{blue}{{re}^{3}} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          8. metadata-evalN/A

            \[\leadsto \left(\frac{1}{2} \cdot \left({re}^{\color{blue}{\left(2 + 1\right)}} \cdot \left({re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}\right) + re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
          9. pow-plusN/A

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

            \[\leadsto \left(\frac{1}{2} \cdot \color{blue}{\mathsf{fma}\left({re}^{2} \cdot re, {re}^{2} \cdot \left(\frac{1}{120} + \frac{-1}{5040} \cdot {re}^{2}\right) - \frac{1}{6}, re\right)}\right) \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
        8. Applied rewrites76.4%

          \[\leadsto \left(0.5 \cdot \color{blue}{\mathsf{fma}\left({re}^{3}, \left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666, re\right)}\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right) \]
        9. Step-by-step derivation
          1. Applied rewrites76.4%

            \[\leadsto \left(0.5 \cdot \mathsf{fma}\left(\left(\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right) \cdot re\right) \cdot re - 0.16666666666666666\right) \cdot \left(re \cdot re\right), \color{blue}{re}, re\right)\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right) \]
          2. Taylor expanded in im around 0

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

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

          Alternative 4: 59.4% accurate, 1.8× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \end{array} \end{array} \]
          (FPCore (re im)
           :precision binary64
           (if (<= (* 0.5 (sin re)) 1e-6)
             (*
              (* (fma (* re re) -0.08333333333333333 0.5) re)
              (*
               (fma
                (fma
                 (fma -0.0003968253968253968 (* im im) -0.016666666666666666)
                 (* im im)
                 -0.3333333333333333)
                (* im im)
                -2.0)
               im))
             (*
              (* 0.5 re)
              (*
               (fma
                (-
                 (*
                  (* (- (* -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)) <= 1e-6) {
          		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (fma(fma(fma(-0.0003968253968253968, (im * im), -0.016666666666666666), (im * im), -0.3333333333333333), (im * im), -2.0) * im);
          	} else {
          		tmp = (0.5 * re) * (fma((((((-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)) <= 1e-6)
          		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(fma(fma(fma(-0.0003968253968253968, Float64(im * im), -0.016666666666666666), Float64(im * im), -0.3333333333333333), Float64(im * im), -2.0) * im));
          	else
          		tmp = Float64(Float64(0.5 * re) * Float64(fma(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], 1e-6], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(N[(N[(-0.0003968253968253968 * N[(im * im), $MachinePrecision] + -0.016666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + -0.3333333333333333), $MachinePrecision] * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * 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] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\
          \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0003968253968253968, im \cdot im, -0.016666666666666666\right), im \cdot im, -0.3333333333333333\right), im \cdot im, -2\right) \cdot im\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < 9.99999999999999955e-7

            1. Initial program 67.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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
              2. lower-*.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
            5. Applied rewrites84.7%

              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
            7. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\mathsf{fma}\left(re \cdot re, \frac{-1}{12}, \frac{1}{2}\right) \cdot re\right) \cdot \color{blue}{\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 im\right)} \]
            11. Applied rewrites69.6%

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

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

            1. Initial program 43.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 \color{blue}{\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 im\right)} \]
              2. lower-*.f64N/A

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\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 im\right)} \]
            5. Applied rewrites91.9%

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

              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
            7. Step-by-step derivation
              1. lower-*.f6419.4

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

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

          Alternative 5: 52.2% accurate, 1.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 5 \cdot 10^{-295}:\\ \;\;\;\;\left(\left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \end{array} \end{array} \]
          (FPCore (re im)
           :precision binary64
           (if (<= (* 0.5 (sin re)) 5e-295)
             (*
              (* (* (* (- (/ 0.5 (* re re)) 0.08333333333333333) re) re) re)
              (* (fma -0.3333333333333333 (* im im) -2.0) im))
             (*
              (* 0.5 re)
              (*
               (fma
                (-
                 (*
                  (* (- (* -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)) <= 5e-295) {
          		tmp = (((((0.5 / (re * re)) - 0.08333333333333333) * re) * re) * re) * (fma(-0.3333333333333333, (im * im), -2.0) * im);
          	} else {
          		tmp = (0.5 * re) * (fma((((((-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)) <= 5e-295)
          		tmp = Float64(Float64(Float64(Float64(Float64(Float64(0.5 / Float64(re * re)) - 0.08333333333333333) * re) * re) * re) * Float64(fma(-0.3333333333333333, Float64(im * im), -2.0) * im));
          	else
          		tmp = Float64(Float64(0.5 * re) * Float64(fma(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], 5e-295], N[(N[(N[(N[(N[(N[(0.5 / N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * 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] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;0.5 \cdot \sin re \leq 5 \cdot 10^{-295}:\\
          \;\;\;\;\left(\left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < 5.00000000000000008e-295

            1. Initial program 62.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(\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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
              2. lower-*.f64N/A

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

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

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

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

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

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

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{3}, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
              9. lower-*.f6484.0

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
            5. Applied rewrites84.0%

              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
            7. Step-by-step derivation
              1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

              1. Initial program 60.6%

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

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

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

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

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

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
              7. Step-by-step derivation
                1. lower-*.f6455.7

                  \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right) \]
              8. Applied rewrites55.7%

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

            Alternative 6: 79.5% accurate, 1.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;re \leq 0.56:\\ \;\;\;\;\left(2 \cdot \sinh \left(-im\right)\right) \cdot \left(0.5 \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\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 im\right) \cdot im, im, -2 \cdot im\right)\\ \end{array} \end{array} \]
            (FPCore (re im)
             :precision binary64
             (if (<= re 0.56)
               (* (* 2.0 (sinh (- im))) (* 0.5 re))
               (*
                (* 0.5 (sin re))
                (fma
                 (*
                  (*
                   (-
                    (*
                     (* (- (* -0.0003968253968253968 (* im im)) 0.016666666666666666) im)
                     im)
                    0.3333333333333333)
                   im)
                  im)
                 im
                 (* -2.0 im)))))
            double code(double re, double im) {
            	double tmp;
            	if (re <= 0.56) {
            		tmp = (2.0 * sinh(-im)) * (0.5 * re);
            	} else {
            		tmp = (0.5 * sin(re)) * fma((((((((-0.0003968253968253968 * (im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * im) * im), im, (-2.0 * im));
            	}
            	return tmp;
            }
            
            function code(re, im)
            	tmp = 0.0
            	if (re <= 0.56)
            		tmp = Float64(Float64(2.0 * sinh(Float64(-im))) * Float64(0.5 * re));
            	else
            		tmp = Float64(Float64(0.5 * sin(re)) * fma(Float64(Float64(Float64(Float64(Float64(Float64(Float64(-0.0003968253968253968 * Float64(im * im)) - 0.016666666666666666) * im) * im) - 0.3333333333333333) * im) * im), im, Float64(-2.0 * im)));
            	end
            	return tmp
            end
            
            code[re_, im_] := If[LessEqual[re, 0.56], N[(N[(2.0 * N[Sinh[(-im)], $MachinePrecision]), $MachinePrecision] * N[(0.5 * re), $MachinePrecision]), $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] * im), $MachinePrecision] * im), $MachinePrecision] * im + N[(-2.0 * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;re \leq 0.56:\\
            \;\;\;\;\left(2 \cdot \sinh \left(-im\right)\right) \cdot \left(0.5 \cdot re\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\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 im\right) \cdot im, im, -2 \cdot im\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if re < 0.56000000000000005

              1. Initial program 66.9%

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
              6. Step-by-step derivation
                1. lower-*.f6460.8

                  \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
              7. Applied rewrites60.8%

                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
              8. Step-by-step derivation
                1. lift-*.f64N/A

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

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

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

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

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

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

                  \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                8. remove-double-divN/A

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

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

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

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

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

              if 0.56000000000000005 < re

              1. Initial program 45.9%

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

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

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

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

                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)} \]
              6. Step-by-step derivation
                1. Applied rewrites92.3%

                  \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \mathsf{fma}\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 im\right) \cdot im, \color{blue}{im}, -2 \cdot im\right) \]
              7. Recombined 2 regimes into one program.
              8. Add Preprocessing

              Alternative 7: 59.3% accurate, 1.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (if (<= (* 0.5 (sin re)) -0.002)
                 (*
                  (* (fma (* re re) -0.08333333333333333 0.5) re)
                  (* (fma -0.3333333333333333 (* im im) -2.0) im))
                 (*
                  (* 0.5 re)
                  (*
                   (fma
                    (-
                     (*
                      (* (- (* -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.002) {
              		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (fma(-0.3333333333333333, (im * im), -2.0) * im);
              	} else {
              		tmp = (0.5 * re) * (fma((((((-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.002)
              		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(fma(-0.3333333333333333, Float64(im * im), -2.0) * im));
              	else
              		tmp = Float64(Float64(0.5 * re) * Float64(fma(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.002], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * re), $MachinePrecision] * 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] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\
              \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\mathsf{fma}\left(\left(\left(-0.0003968253968253968 \cdot \left(im \cdot im\right) - 0.016666666666666666\right) \cdot im\right) \cdot im - 0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -2e-3

                1. Initial program 46.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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
                  2. lower-*.f64N/A

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

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

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

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

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

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

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

                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                5. Applied rewrites83.7%

                  \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                7. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                1. Initial program 67.3%

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

                  \[\leadsto \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 \color{blue}{\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 im\right)} \]
                  2. lower-*.f64N/A

                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\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 im\right)} \]
                5. Applied rewrites93.2%

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

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\mathsf{fma}\left(\left(\left(\frac{-1}{2520} \cdot \left(im \cdot im\right) - \frac{1}{60}\right) \cdot im\right) \cdot im - \frac{1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                7. Step-by-step derivation
                  1. lower-*.f6470.4

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

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

              Alternative 8: 79.4% accurate, 2.1× speedup?

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

                1. Initial program 66.9%

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                6. Step-by-step derivation
                  1. lower-*.f6460.8

                    \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                7. Applied rewrites60.8%

                  \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                8. Step-by-step derivation
                  1. lift-*.f64N/A

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

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

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

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

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

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

                    \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                  8. remove-double-divN/A

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

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

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

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

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

                if 0.56000000000000005 < re

                1. Initial program 45.9%

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\left(\left(e^{-im} - e^{im}\right) \cdot \sin re\right)} \cdot \frac{1}{2} \]
                  7. lower-*.f6445.9

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

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

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

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

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

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

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

                    \[\leadsto \left(\color{blue}{\left(2 \cdot \sinh \left(-im\right)\right)} \cdot \sin re\right) \cdot \frac{1}{2} \]
                  15. lower-sinh.f6499.8

                    \[\leadsto \left(\left(2 \cdot \color{blue}{\sinh \left(-im\right)}\right) \cdot \sin re\right) \cdot 0.5 \]
                4. Applied rewrites99.8%

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{1 \cdot \left(\sinh \left(-im\right) \cdot \sin re\right)} \]
                  9. *-commutativeN/A

                    \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                  10. lower-*.f6499.8

                    \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                6. Applied rewrites99.8%

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

                    \[\leadsto \color{blue}{1 \cdot \left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                  2. *-lft-identity99.8

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

                    \[\leadsto \color{blue}{\sin re \cdot \sinh \left(-im\right)} \]
                  4. *-commutativeN/A

                    \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
                  5. lower-*.f6499.8

                    \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
                8. Applied rewrites99.8%

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

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

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

                    \[\leadsto \color{blue}{\left(\left({im}^{2} \cdot \left({im}^{2} \cdot \left(\frac{-1}{5040} \cdot {im}^{2} - \frac{1}{120}\right) - \frac{1}{6}\right) - 1\right) \cdot im\right)} \cdot \sin re \]
                11. Applied rewrites92.3%

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

              Alternative 9: 57.8% accurate, 2.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot im\right) \cdot re\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (if (<= (* 0.5 (sin re)) -0.002)
                 (*
                  (* (fma (* re re) -0.08333333333333333 0.5) re)
                  (* (fma -0.3333333333333333 (* im im) -2.0) im))
                 (*
                  (*
                   (fma
                    (fma (* im im) -0.008333333333333333 -0.16666666666666666)
                    (* im im)
                    -1.0)
                   im)
                  re)))
              double code(double re, double im) {
              	double tmp;
              	if ((0.5 * sin(re)) <= -0.002) {
              		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * (fma(-0.3333333333333333, (im * im), -2.0) * im);
              	} else {
              		tmp = (fma(fma((im * im), -0.008333333333333333, -0.16666666666666666), (im * im), -1.0) * im) * re;
              	}
              	return tmp;
              }
              
              function code(re, im)
              	tmp = 0.0
              	if (Float64(0.5 * sin(re)) <= -0.002)
              		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * Float64(fma(-0.3333333333333333, Float64(im * im), -2.0) * im));
              	else
              		tmp = Float64(Float64(fma(fma(Float64(im * im), -0.008333333333333333, -0.16666666666666666), Float64(im * im), -1.0) * im) * re);
              	end
              	return tmp
              end
              
              code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision] + -2.0), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * -0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + -1.0), $MachinePrecision] * im), $MachinePrecision] * re), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\
              \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -2\right) \cdot im\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot 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)) < -2e-3

                1. Initial program 46.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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
                  2. lower-*.f64N/A

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

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

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

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

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

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

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

                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                5. Applied rewrites83.7%

                  \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                7. Step-by-step derivation
                  1. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                1. Initial program 67.3%

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

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

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

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

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

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

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

                Alternative 10: 57.6% accurate, 2.1× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\ \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot im\right) \cdot re\\ \end{array} \end{array} \]
                (FPCore (re im)
                 :precision binary64
                 (if (<= (* 0.5 (sin re)) -0.002)
                   (*
                    (* (* (* re re) -0.08333333333333333) re)
                    (* (* -0.3333333333333333 (* im im)) im))
                   (*
                    (*
                     (fma
                      (fma (* im im) -0.008333333333333333 -0.16666666666666666)
                      (* im im)
                      -1.0)
                     im)
                    re)))
                double code(double re, double im) {
                	double tmp;
                	if ((0.5 * sin(re)) <= -0.002) {
                		tmp = (((re * re) * -0.08333333333333333) * re) * ((-0.3333333333333333 * (im * im)) * im);
                	} else {
                		tmp = (fma(fma((im * im), -0.008333333333333333, -0.16666666666666666), (im * im), -1.0) * im) * re;
                	}
                	return tmp;
                }
                
                function code(re, im)
                	tmp = 0.0
                	if (Float64(0.5 * sin(re)) <= -0.002)
                		tmp = Float64(Float64(Float64(Float64(re * re) * -0.08333333333333333) * re) * Float64(Float64(-0.3333333333333333 * Float64(im * im)) * im));
                	else
                		tmp = Float64(Float64(fma(fma(Float64(im * im), -0.008333333333333333, -0.16666666666666666), Float64(im * im), -1.0) * im) * re);
                	end
                	return tmp
                end
                
                code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * -0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + -1.0), $MachinePrecision] * im), $MachinePrecision] * re), $MachinePrecision]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\
                \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\
                
                \mathbf{else}:\\
                \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot 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)) < -2e-3

                  1. Initial program 46.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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
                    2. lower-*.f64N/A

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

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

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

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

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

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

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

                      \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                  5. Applied rewrites83.7%

                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                  7. Step-by-step derivation
                    1. *-commutativeN/A

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

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

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

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

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

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

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

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

                    \[\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 {im}^{2}\right) \cdot im\right) \]
                  10. Step-by-step derivation
                    1. Applied rewrites22.2%

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

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

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

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

                      1. Initial program 67.3%

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

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

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

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

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

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

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

                      Alternative 11: 78.8% accurate, 2.2× speedup?

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

                        1. Initial program 66.9%

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

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

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

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

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

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

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

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

                          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                        6. Step-by-step derivation
                          1. lower-*.f6460.8

                            \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                        7. Applied rewrites60.8%

                          \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                        8. Step-by-step derivation
                          1. lift-*.f64N/A

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

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

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

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

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

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

                            \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                          8. remove-double-divN/A

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

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

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

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

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

                        if 0.56000000000000005 < re

                        1. Initial program 45.9%

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot im\right)} \]
                          3. metadata-evalN/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) - \color{blue}{2 \cdot 1}\right) \cdot im\right) \]
                          4. fp-cancel-sub-sign-invN/A

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

                            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\left(\color{blue}{\left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) \cdot {im}^{2}} + \left(\mathsf{neg}\left(2\right)\right) \cdot 1\right) \cdot im\right) \]
                          6. metadata-evalN/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} + \color{blue}{-2} \cdot 1\right) \cdot im\right) \]
                          7. metadata-evalN/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} + \color{blue}{-2}\right) \cdot im\right) \]
                          8. lower-fma.f64N/A

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

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

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

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{60} \cdot \left(im \cdot im\right) - \frac{1}{3}, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                          14. lower-*.f6488.9

                            \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.016666666666666666 \cdot \left(im \cdot im\right) - 0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                        5. Applied rewrites88.9%

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

                      Alternative 12: 56.8% accurate, 2.2× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot im\right) \cdot re\\ \end{array} \end{array} \]
                      (FPCore (re im)
                       :precision binary64
                       (if (<= (* 0.5 (sin re)) -0.002)
                         (* (fma (* (* re im) re) 0.16666666666666666 (- im)) re)
                         (*
                          (*
                           (fma
                            (fma (* im im) -0.008333333333333333 -0.16666666666666666)
                            (* im im)
                            -1.0)
                           im)
                          re)))
                      double code(double re, double im) {
                      	double tmp;
                      	if ((0.5 * sin(re)) <= -0.002) {
                      		tmp = fma(((re * im) * re), 0.16666666666666666, -im) * re;
                      	} else {
                      		tmp = (fma(fma((im * im), -0.008333333333333333, -0.16666666666666666), (im * im), -1.0) * im) * re;
                      	}
                      	return tmp;
                      }
                      
                      function code(re, im)
                      	tmp = 0.0
                      	if (Float64(0.5 * sin(re)) <= -0.002)
                      		tmp = Float64(fma(Float64(Float64(re * im) * re), 0.16666666666666666, Float64(-im)) * re);
                      	else
                      		tmp = Float64(Float64(fma(fma(Float64(im * im), -0.008333333333333333, -0.16666666666666666), Float64(im * im), -1.0) * im) * re);
                      	end
                      	return tmp
                      end
                      
                      code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(N[(N[(re * im), $MachinePrecision] * re), $MachinePrecision] * 0.16666666666666666 + (-im)), $MachinePrecision] * re), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * -0.008333333333333333 + -0.16666666666666666), $MachinePrecision] * N[(im * im), $MachinePrecision] + -1.0), $MachinePrecision] * im), $MachinePrecision] * re), $MachinePrecision]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\
                      \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -im\right) \cdot re\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;\left(\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, -0.008333333333333333, -0.16666666666666666\right), im \cdot im, -1\right) \cdot 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)) < -2e-3

                        1. Initial program 46.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                          2. associate-*r*N/A

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

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

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

                            \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                          6. lower-sin.f6460.0

                            \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                        5. Applied rewrites60.0%

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

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

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

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

                          1. Initial program 67.3%

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

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

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

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

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

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

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

                          Alternative 13: 78.7% accurate, 2.3× speedup?

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

                            1. Initial program 66.9%

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

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

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

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

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

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

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

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

                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                            6. Step-by-step derivation
                              1. lower-*.f6460.8

                                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                            7. Applied rewrites60.8%

                              \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                            8. Step-by-step derivation
                              1. lift-*.f64N/A

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

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

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

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

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

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

                                \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                              8. remove-double-divN/A

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

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

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

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

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

                            if 0.56000000000000005 < re

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

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

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

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

                          Alternative 14: 53.1% accurate, 2.3× speedup?

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

                            1. Initial program 46.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                              2. associate-*r*N/A

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

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

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

                                \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                              6. lower-sin.f6460.0

                                \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                            5. Applied rewrites60.0%

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

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

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

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

                              1. Initial program 67.3%

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

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

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

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

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

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

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

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

                                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(\frac{-1}{3}, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                                9. lower-*.f6484.8

                                  \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                              5. Applied rewrites84.8%

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

                                \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                              7. Step-by-step derivation
                                1. lower-*.f6464.0

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

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

                            Alternative 15: 34.9% accurate, 2.3× speedup?

                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -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)) 1e-6)
                               (* (fma (* (* re im) re) 0.16666666666666666 (- im)) re)
                               (* (- re) im)))
                            double code(double re, double im) {
                            	double tmp;
                            	if ((0.5 * sin(re)) <= 1e-6) {
                            		tmp = fma(((re * im) * re), 0.16666666666666666, -im) * re;
                            	} else {
                            		tmp = -re * im;
                            	}
                            	return tmp;
                            }
                            
                            function code(re, im)
                            	tmp = 0.0
                            	if (Float64(0.5 * sin(re)) <= 1e-6)
                            		tmp = Float64(fma(Float64(Float64(re * im) * re), 0.16666666666666666, Float64(-im)) * re);
                            	else
                            		tmp = Float64(Float64(-re) * im);
                            	end
                            	return tmp
                            end
                            
                            code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], 1e-6], N[(N[(N[(N[(re * im), $MachinePrecision] * re), $MachinePrecision] * 0.16666666666666666 + (-im)), $MachinePrecision] * re), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                            
                            \begin{array}{l}
                            
                            \\
                            \begin{array}{l}
                            \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\
                            \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -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)) < 9.99999999999999955e-7

                              1. Initial program 67.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                2. associate-*r*N/A

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

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

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

                                  \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                6. lower-sin.f6453.3

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

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

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

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

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

                                1. Initial program 43.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                  2. associate-*r*N/A

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

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

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

                                    \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                  6. lower-sin.f6462.5

                                    \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                5. Applied rewrites62.5%

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

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

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

                                Alternative 16: 34.9% accurate, 2.4× speedup?

                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\ \;\;\;\;\left(\mathsf{fma}\left(0.16666666666666666, re \cdot re, -1\right) \cdot re\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \end{array} \]
                                (FPCore (re im)
                                 :precision binary64
                                 (if (<= (* 0.5 (sin re)) 1e-6)
                                   (* (* (fma 0.16666666666666666 (* re re) -1.0) re) im)
                                   (* (- re) im)))
                                double code(double re, double im) {
                                	double tmp;
                                	if ((0.5 * sin(re)) <= 1e-6) {
                                		tmp = (fma(0.16666666666666666, (re * re), -1.0) * re) * im;
                                	} else {
                                		tmp = -re * im;
                                	}
                                	return tmp;
                                }
                                
                                function code(re, im)
                                	tmp = 0.0
                                	if (Float64(0.5 * sin(re)) <= 1e-6)
                                		tmp = Float64(Float64(fma(0.16666666666666666, Float64(re * re), -1.0) * re) * im);
                                	else
                                		tmp = Float64(Float64(-re) * im);
                                	end
                                	return tmp
                                end
                                
                                code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], 1e-6], N[(N[(N[(0.16666666666666666 * N[(re * re), $MachinePrecision] + -1.0), $MachinePrecision] * re), $MachinePrecision] * im), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                                
                                \begin{array}{l}
                                
                                \\
                                \begin{array}{l}
                                \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-6}:\\
                                \;\;\;\;\left(\mathsf{fma}\left(0.16666666666666666, re \cdot re, -1\right) \cdot re\right) \cdot im\\
                                
                                \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)) < 9.99999999999999955e-7

                                  1. Initial program 67.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                    2. associate-*r*N/A

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

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

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

                                      \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                    6. lower-sin.f6453.3

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

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

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

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

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

                                    1. Initial program 43.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                      2. associate-*r*N/A

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

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

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

                                        \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                      6. lower-sin.f6462.5

                                        \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                    5. Applied rewrites62.5%

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

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

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

                                    Alternative 17: 34.8% accurate, 2.4× speedup?

                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\ \;\;\;\;\left(\left(0.16666666666666666 \cdot \left(re \cdot re\right)\right) \cdot re\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(-re\right) \cdot im\\ \end{array} \end{array} \]
                                    (FPCore (re im)
                                     :precision binary64
                                     (if (<= (* 0.5 (sin re)) -0.002)
                                       (* (* (* 0.16666666666666666 (* re re)) re) im)
                                       (* (- re) im)))
                                    double code(double re, double im) {
                                    	double tmp;
                                    	if ((0.5 * sin(re)) <= -0.002) {
                                    		tmp = ((0.16666666666666666 * (re * re)) * re) * im;
                                    	} else {
                                    		tmp = -re * im;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    module fmin_fmax_functions
                                        implicit none
                                        private
                                        public fmax
                                        public fmin
                                    
                                        interface fmax
                                            module procedure fmax88
                                            module procedure fmax44
                                            module procedure fmax84
                                            module procedure fmax48
                                        end interface
                                        interface fmin
                                            module procedure fmin88
                                            module procedure fmin44
                                            module procedure fmin84
                                            module procedure fmin48
                                        end interface
                                    contains
                                        real(8) function fmax88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmax44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmax84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmax48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin88(x, y) result (res)
                                            real(8), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(4) function fmin44(x, y) result (res)
                                            real(4), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                        end function
                                        real(8) function fmin84(x, y) result(res)
                                            real(8), intent (in) :: x
                                            real(4), intent (in) :: y
                                            res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                        end function
                                        real(8) function fmin48(x, y) result(res)
                                            real(4), intent (in) :: x
                                            real(8), intent (in) :: y
                                            res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                        end function
                                    end module
                                    
                                    real(8) function code(re, im)
                                    use fmin_fmax_functions
                                        real(8), intent (in) :: re
                                        real(8), intent (in) :: im
                                        real(8) :: tmp
                                        if ((0.5d0 * sin(re)) <= (-0.002d0)) then
                                            tmp = ((0.16666666666666666d0 * (re * re)) * re) * im
                                        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.002) {
                                    		tmp = ((0.16666666666666666 * (re * re)) * re) * im;
                                    	} else {
                                    		tmp = -re * im;
                                    	}
                                    	return tmp;
                                    }
                                    
                                    def code(re, im):
                                    	tmp = 0
                                    	if (0.5 * math.sin(re)) <= -0.002:
                                    		tmp = ((0.16666666666666666 * (re * re)) * re) * im
                                    	else:
                                    		tmp = -re * im
                                    	return tmp
                                    
                                    function code(re, im)
                                    	tmp = 0.0
                                    	if (Float64(0.5 * sin(re)) <= -0.002)
                                    		tmp = Float64(Float64(Float64(0.16666666666666666 * Float64(re * re)) * re) * im);
                                    	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.002)
                                    		tmp = ((0.16666666666666666 * (re * re)) * re) * im;
                                    	else
                                    		tmp = -re * im;
                                    	end
                                    	tmp_2 = tmp;
                                    end
                                    
                                    code[re_, im_] := If[LessEqual[N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision], -0.002], N[(N[(N[(0.16666666666666666 * N[(re * re), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * im), $MachinePrecision], N[((-re) * im), $MachinePrecision]]
                                    
                                    \begin{array}{l}
                                    
                                    \\
                                    \begin{array}{l}
                                    \mathbf{if}\;0.5 \cdot \sin re \leq -0.002:\\
                                    \;\;\;\;\left(\left(0.16666666666666666 \cdot \left(re \cdot re\right)\right) \cdot re\right) \cdot im\\
                                    
                                    \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)) < -2e-3

                                      1. Initial program 46.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                        2. associate-*r*N/A

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

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

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

                                          \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                        6. lower-sin.f6460.0

                                          \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                      5. Applied rewrites60.0%

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

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

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

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

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

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

                                          1. Initial program 67.3%

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

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

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

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

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

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

                                              \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                            6. lower-sin.f6453.8

                                              \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                          5. Applied rewrites53.8%

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

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

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

                                          Alternative 18: 77.0% accurate, 2.5× speedup?

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

                                            1. Initial program 66.9%

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

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

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

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

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

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

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

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

                                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            6. Step-by-step derivation
                                              1. lower-*.f6460.8

                                                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            7. Applied rewrites60.8%

                                              \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            8. Step-by-step derivation
                                              1. lift-*.f64N/A

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

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

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

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

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

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

                                                \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                                              8. remove-double-divN/A

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

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

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

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

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

                                            if 2.5 < re

                                            1. Initial program 45.9%

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

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

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

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

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

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

                                                \[\leadsto \color{blue}{\left(\left(e^{-im} - e^{im}\right) \cdot \sin re\right)} \cdot \frac{1}{2} \]
                                              7. lower-*.f6445.9

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

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

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

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

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

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

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

                                                \[\leadsto \left(\color{blue}{\left(2 \cdot \sinh \left(-im\right)\right)} \cdot \sin re\right) \cdot \frac{1}{2} \]
                                              15. lower-sinh.f6499.8

                                                \[\leadsto \left(\left(2 \cdot \color{blue}{\sinh \left(-im\right)}\right) \cdot \sin re\right) \cdot 0.5 \]
                                            4. Applied rewrites99.8%

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

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

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

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

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

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

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

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

                                                \[\leadsto \color{blue}{1 \cdot \left(\sinh \left(-im\right) \cdot \sin re\right)} \]
                                              9. *-commutativeN/A

                                                \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                                              10. lower-*.f6499.8

                                                \[\leadsto 1 \cdot \color{blue}{\left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                                            6. Applied rewrites99.8%

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

                                                \[\leadsto \color{blue}{1 \cdot \left(\sin re \cdot \sinh \left(-im\right)\right)} \]
                                              2. *-lft-identity99.8

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

                                                \[\leadsto \color{blue}{\sin re \cdot \sinh \left(-im\right)} \]
                                              4. *-commutativeN/A

                                                \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
                                              5. lower-*.f6499.8

                                                \[\leadsto \color{blue}{\sinh \left(-im\right) \cdot \sin re} \]
                                            8. Applied rewrites99.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          Alternative 19: 76.9% accurate, 2.5× speedup?

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

                                            1. Initial program 66.9%

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

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

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

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

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

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

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

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

                                              \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            6. Step-by-step derivation
                                              1. lower-*.f6460.8

                                                \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            7. Applied rewrites60.8%

                                              \[\leadsto \color{blue}{\left(0.5 \cdot re\right)} \cdot \left(e^{-im} - \frac{1}{e^{-im}}\right) \]
                                            8. Step-by-step derivation
                                              1. lift-*.f64N/A

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

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

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

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

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

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

                                                \[\leadsto \left(e^{-im} - \frac{1}{\color{blue}{\frac{1}{e^{im}}}}\right) \cdot \left(\frac{1}{2} \cdot re\right) \]
                                              8. remove-double-divN/A

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

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

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

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

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

                                            if 2.5 < re

                                            1. Initial program 45.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}{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 im \cdot \color{blue}{\left(\frac{-1}{6} \cdot \left({im}^{2} \cdot \sin re\right) + -1 \cdot \sin re\right)} \]
                                              2. *-commutativeN/A

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

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

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

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

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

                                                \[\leadsto im \cdot \left({im}^{2} \cdot \left(\frac{-1}{6} \cdot \sin re\right)\right) + \color{blue}{\left(\mathsf{neg}\left(im \cdot \sin re\right)\right)} \]
                                              8. mul-1-negN/A

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

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

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

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

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

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

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

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

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

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

                                          Alternative 20: 51.4% accurate, 8.3× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq -3.9 \cdot 10^{+153} \lor \neg \left(im \leq 1.5 \cdot 10^{+80}\right):\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -im\right) \cdot re\\ \end{array} \end{array} \]
                                          (FPCore (re im)
                                           :precision binary64
                                           (if (or (<= im -3.9e+153) (not (<= im 1.5e+80)))
                                             (* (* 0.5 re) (* (* -0.3333333333333333 (* im im)) im))
                                             (* (fma (* (* re im) re) 0.16666666666666666 (- im)) re)))
                                          double code(double re, double im) {
                                          	double tmp;
                                          	if ((im <= -3.9e+153) || !(im <= 1.5e+80)) {
                                          		tmp = (0.5 * re) * ((-0.3333333333333333 * (im * im)) * im);
                                          	} else {
                                          		tmp = fma(((re * im) * re), 0.16666666666666666, -im) * re;
                                          	}
                                          	return tmp;
                                          }
                                          
                                          function code(re, im)
                                          	tmp = 0.0
                                          	if ((im <= -3.9e+153) || !(im <= 1.5e+80))
                                          		tmp = Float64(Float64(0.5 * re) * Float64(Float64(-0.3333333333333333 * Float64(im * im)) * im));
                                          	else
                                          		tmp = Float64(fma(Float64(Float64(re * im) * re), 0.16666666666666666, Float64(-im)) * re);
                                          	end
                                          	return tmp
                                          end
                                          
                                          code[re_, im_] := If[Or[LessEqual[im, -3.9e+153], N[Not[LessEqual[im, 1.5e+80]], $MachinePrecision]], N[(N[(0.5 * re), $MachinePrecision] * N[(N[(-0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(re * im), $MachinePrecision] * re), $MachinePrecision] * 0.16666666666666666 + (-im)), $MachinePrecision] * re), $MachinePrecision]]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          \begin{array}{l}
                                          \mathbf{if}\;im \leq -3.9 \cdot 10^{+153} \lor \neg \left(im \leq 1.5 \cdot 10^{+80}\right):\\
                                          \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\
                                          
                                          \mathbf{else}:\\
                                          \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -im\right) \cdot re\\
                                          
                                          
                                          \end{array}
                                          \end{array}
                                          
                                          Derivation
                                          1. Split input into 2 regimes
                                          2. if im < -3.89999999999999983e153 or 1.49999999999999993e80 < 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 \color{blue}{\left(\left(\frac{-1}{3} \cdot {im}^{2} - 2\right) \cdot im\right)} \]
                                              2. lower-*.f64N/A

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

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

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

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

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

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

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

                                                \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(\mathsf{fma}\left(-0.3333333333333333, \color{blue}{im \cdot im}, -2\right) \cdot im\right) \]
                                            5. Applied rewrites96.1%

                                              \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{\left(\mathsf{fma}\left(-0.3333333333333333, im \cdot im, -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(\mathsf{fma}\left(\frac{-1}{3}, im \cdot im, -2\right) \cdot im\right) \]
                                            7. Step-by-step derivation
                                              1. *-commutativeN/A

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

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

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

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

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

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

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

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

                                              \[\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 {im}^{2}\right) \cdot im\right) \]
                                            10. Step-by-step derivation
                                              1. Applied rewrites79.2%

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

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

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

                                                if -3.89999999999999983e153 < im < 1.49999999999999993e80

                                                1. Initial program 46.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 \color{blue}{\left(\sin re \cdot im\right)} \]
                                                  2. associate-*r*N/A

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

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

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

                                                    \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                                  6. lower-sin.f6475.2

                                                    \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                                5. Applied rewrites75.2%

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

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

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

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq -3.9 \cdot 10^{+153} \lor \neg \left(im \leq 1.5 \cdot 10^{+80}\right):\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(\left(-0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\left(re \cdot im\right) \cdot re, 0.16666666666666666, -im\right) \cdot re\\ \end{array} \]
                                                10. Add Preprocessing

                                                Alternative 21: 33.0% 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 61.7%

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

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

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

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

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

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

                                                    \[\leadsto \color{blue}{\left(-\sin re\right)} \cdot im \]
                                                  6. lower-sin.f6455.4

                                                    \[\leadsto \left(-\color{blue}{\sin re}\right) \cdot im \]
                                                5. Applied rewrites55.4%

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

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

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

                                                  Developer Target 1: 99.8% accurate, 1.0× speedup?

                                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|im\right| < 1:\\ \;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\ \end{array} \end{array} \]
                                                  (FPCore (re im)
                                                   :precision binary64
                                                   (if (< (fabs im) 1.0)
                                                     (-
                                                      (*
                                                       (sin re)
                                                       (+
                                                        (+ im (* (* (* 0.16666666666666666 im) im) im))
                                                        (* (* (* (* (* 0.008333333333333333 im) im) im) im) im))))
                                                     (* (* 0.5 (sin re)) (- (exp (- im)) (exp im)))))
                                                  double code(double re, double im) {
                                                  	double tmp;
                                                  	if (fabs(im) < 1.0) {
                                                  		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                                  	} else {
                                                  		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  module fmin_fmax_functions
                                                      implicit none
                                                      private
                                                      public fmax
                                                      public fmin
                                                  
                                                      interface fmax
                                                          module procedure fmax88
                                                          module procedure fmax44
                                                          module procedure fmax84
                                                          module procedure fmax48
                                                      end interface
                                                      interface fmin
                                                          module procedure fmin88
                                                          module procedure fmin44
                                                          module procedure fmin84
                                                          module procedure fmin48
                                                      end interface
                                                  contains
                                                      real(8) function fmax88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmax44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmin44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                      end function
                                                  end module
                                                  
                                                  real(8) function code(re, im)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: re
                                                      real(8), intent (in) :: im
                                                      real(8) :: tmp
                                                      if (abs(im) < 1.0d0) then
                                                          tmp = -(sin(re) * ((im + (((0.16666666666666666d0 * im) * im) * im)) + (((((0.008333333333333333d0 * im) * im) * im) * im) * im)))
                                                      else
                                                          tmp = (0.5d0 * sin(re)) * (exp(-im) - exp(im))
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  public static double code(double re, double im) {
                                                  	double tmp;
                                                  	if (Math.abs(im) < 1.0) {
                                                  		tmp = -(Math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                                  	} else {
                                                  		tmp = (0.5 * Math.sin(re)) * (Math.exp(-im) - Math.exp(im));
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  def code(re, im):
                                                  	tmp = 0
                                                  	if math.fabs(im) < 1.0:
                                                  		tmp = -(math.sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)))
                                                  	else:
                                                  		tmp = (0.5 * math.sin(re)) * (math.exp(-im) - math.exp(im))
                                                  	return tmp
                                                  
                                                  function code(re, im)
                                                  	tmp = 0.0
                                                  	if (abs(im) < 1.0)
                                                  		tmp = Float64(-Float64(sin(re) * Float64(Float64(im + Float64(Float64(Float64(0.16666666666666666 * im) * im) * im)) + Float64(Float64(Float64(Float64(Float64(0.008333333333333333 * im) * im) * im) * im) * im))));
                                                  	else
                                                  		tmp = Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) - exp(im)));
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  function tmp_2 = code(re, im)
                                                  	tmp = 0.0;
                                                  	if (abs(im) < 1.0)
                                                  		tmp = -(sin(re) * ((im + (((0.16666666666666666 * im) * im) * im)) + (((((0.008333333333333333 * im) * im) * im) * im) * im)));
                                                  	else
                                                  		tmp = (0.5 * sin(re)) * (exp(-im) - exp(im));
                                                  	end
                                                  	tmp_2 = tmp;
                                                  end
                                                  
                                                  code[re_, im_] := If[Less[N[Abs[im], $MachinePrecision], 1.0], (-N[(N[Sin[re], $MachinePrecision] * N[(N[(im + N[(N[(N[(0.16666666666666666 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(N[(N[(0.008333333333333333 * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[(-im)], $MachinePrecision] - N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                                  
                                                  \begin{array}{l}
                                                  
                                                  \\
                                                  \begin{array}{l}
                                                  \mathbf{if}\;\left|im\right| < 1:\\
                                                  \;\;\;\;-\sin re \cdot \left(\left(im + \left(\left(0.16666666666666666 \cdot im\right) \cdot im\right) \cdot im\right) + \left(\left(\left(\left(0.008333333333333333 \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right) \cdot im\right)\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} - e^{im}\right)\\
                                                  
                                                  
                                                  \end{array}
                                                  \end{array}
                                                  

                                                  Reproduce

                                                  ?
                                                  herbie shell --seed 2025017 
                                                  (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))))