math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 6.4s
Alternatives: 18
Speedup: 1.5×

Specification

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

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

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

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

Alternative 1: 100.0% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \mathsf{fma}\left(\sin re \cdot 0.5, e^{-im}, \left(e^{im} \cdot 0.5\right) \cdot \sin re\right) \end{array} \]
(FPCore (re im)
 :precision binary64
 (fma (* (sin re) 0.5) (exp (- im)) (* (* (exp im) 0.5) (sin re))))
double code(double re, double im) {
	return fma((sin(re) * 0.5), exp(-im), ((exp(im) * 0.5) * sin(re)));
}
function code(re, im)
	return fma(Float64(sin(re) * 0.5), exp(Float64(-im)), Float64(Float64(exp(im) * 0.5) * sin(re)))
end
code[re_, im_] := N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[Exp[(-im)], $MachinePrecision] + N[(N[(N[Exp[im], $MachinePrecision] * 0.5), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\mathsf{fma}\left(\sin re \cdot 0.5, e^{-im}, \left(e^{im} \cdot 0.5\right) \cdot \sin re\right)
\end{array}
Derivation
  1. Initial program 100.0%

    \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
    2. lift-+.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
    10. sub0-negN/A

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
    15. lower-*.f64100.0

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

    \[\leadsto \color{blue}{\mathsf{fma}\left(\sin re \cdot 0.5, e^{-im}, \left(e^{im} \cdot 0.5\right) \cdot \sin re\right)} \]
  5. Add Preprocessing

Alternative 2: 73.2% accurate, 0.4× speedup?

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

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

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889, im \cdot im, 0.041666666666666664\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\

\mathbf{else}:\\
\;\;\;\;re \cdot \cosh im\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (+.f64 (exp.f64 (-.f64 #s(literal 0 binary64) im)) (exp.f64 im))) < -inf.0

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

            1. Initial program 100.0%

              \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
              2. lift-+.f64N/A

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

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

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

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
              10. sub0-negN/A

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

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

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

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

                \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
              15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
              17. cosh-undef-revN/A

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

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

                \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
            6. Applied rewrites100.0%

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

                \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
              2. *-lft-identity100.0

                \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
              3. lift-*.f64N/A

                \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
              4. *-commutativeN/A

                \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
              5. lower-*.f64100.0

                \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
            8. Applied rewrites100.0%

              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
            9. Taylor expanded in im around 0

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

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

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

              1. Initial program 100.0%

                \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                2. lift-+.f64N/A

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                10. sub0-negN/A

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

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

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

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

                  \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                17. cosh-undef-revN/A

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

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

                  \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
              6. Applied rewrites100.0%

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

                  \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                2. *-lft-identity100.0

                  \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                3. lift-*.f64N/A

                  \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                5. lower-*.f64100.0

                  \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
              8. Applied rewrites100.0%

                \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
              9. Taylor expanded in re around 0

                \[\leadsto \color{blue}{re} \cdot \cosh im \]
              10. Step-by-step derivation
                1. Applied rewrites72.5%

                  \[\leadsto \color{blue}{re} \cdot \cosh im \]
              11. Recombined 3 regimes into one program.
              12. Final simplification73.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \left(1 + e^{im}\right)\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889, im \cdot im, 0.041666666666666664\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \]
              13. Add Preprocessing

              Alternative 3: 73.2% accurate, 0.4× speedup?

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

                1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                        1. Initial program 100.0%

                          \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                          2. lift-+.f64N/A

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                          10. sub0-negN/A

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                          15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                          17. cosh-undef-revN/A

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

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

                            \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                        6. Applied rewrites100.0%

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

                            \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                          2. *-lft-identity100.0

                            \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                          3. lift-*.f64N/A

                            \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                          4. *-commutativeN/A

                            \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                          5. lower-*.f64100.0

                            \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                        8. Applied rewrites100.0%

                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                        9. Taylor expanded in im around 0

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

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

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

                          1. Initial program 100.0%

                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                            2. lift-+.f64N/A

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                            10. sub0-negN/A

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

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

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

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

                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                            15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                            17. cosh-undef-revN/A

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

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

                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                          6. Applied rewrites100.0%

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

                              \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                            2. *-lft-identity100.0

                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                            3. lift-*.f64N/A

                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                            4. *-commutativeN/A

                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                            5. lower-*.f64100.0

                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                          8. Applied rewrites100.0%

                            \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                          9. Taylor expanded in re around 0

                            \[\leadsto \color{blue}{re} \cdot \cosh im \]
                          10. Step-by-step derivation
                            1. Applied rewrites72.5%

                              \[\leadsto \color{blue}{re} \cdot \cosh im \]
                          11. Recombined 3 regimes into one program.
                          12. Final simplification73.8%

                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \left(1 + e^{im}\right)\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \]
                          13. Add Preprocessing

                          Alternative 4: 73.1% accurate, 0.4× speedup?

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

                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

                                    1. Initial program 100.0%

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

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

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

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

                                      1. Initial program 100.0%

                                        \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                                        2. lift-+.f64N/A

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

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

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

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                                        10. sub0-negN/A

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

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

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

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

                                          \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                                        15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                                        17. cosh-undef-revN/A

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

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

                                          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                                      6. Applied rewrites100.0%

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

                                          \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                                        2. *-lft-identity100.0

                                          \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                        3. lift-*.f64N/A

                                          \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                        4. *-commutativeN/A

                                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                        5. lower-*.f64100.0

                                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                      8. Applied rewrites100.0%

                                        \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                      9. Taylor expanded in re around 0

                                        \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                      10. Step-by-step derivation
                                        1. Applied rewrites72.5%

                                          \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                      11. Recombined 3 regimes into one program.
                                      12. Final simplification73.7%

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\left(\left(re \cdot re\right) \cdot -0.08333333333333333\right) \cdot re\right) \cdot \left(1 + e^{im}\right)\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \]
                                      13. Add Preprocessing

                                      Alternative 5: 80.2% accurate, 0.4× speedup?

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

                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                              1. Initial program 100.0%

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

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

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

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

                                                1. Initial program 100.0%

                                                  \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                                                  2. lift-+.f64N/A

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

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

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

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

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

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

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

                                                    \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                                                  10. sub0-negN/A

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

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

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

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

                                                    \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                                                  15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                                                  17. cosh-undef-revN/A

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

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

                                                    \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                                                6. Applied rewrites100.0%

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

                                                    \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                                                  2. *-lft-identity100.0

                                                    \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                  3. lift-*.f64N/A

                                                    \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                  4. *-commutativeN/A

                                                    \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                  5. lower-*.f64100.0

                                                    \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                8. Applied rewrites100.0%

                                                  \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                9. Taylor expanded in re around 0

                                                  \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                                10. Step-by-step derivation
                                                  1. Applied rewrites72.5%

                                                    \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                                11. Recombined 3 regimes into one program.
                                                12. Final simplification80.1%

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right)\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot \left(im \cdot im\right)\right) \cdot re\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \]
                                                13. Add Preprocessing

                                                Alternative 6: 79.9% accurate, 0.4× speedup?

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

                                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                        1. Initial program 100.0%

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

                                                          \[\leadsto \color{blue}{\sin re} \]
                                                        4. Step-by-step derivation
                                                          1. Applied rewrites99.3%

                                                            \[\leadsto \color{blue}{\sin re} \]

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

                                                          1. Initial program 100.0%

                                                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                                                            2. lift-+.f64N/A

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

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

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

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                                                            10. sub0-negN/A

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

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

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

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

                                                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                                                            15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                                                            17. cosh-undef-revN/A

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

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

                                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                                                          6. Applied rewrites100.0%

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

                                                              \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                                                            2. *-lft-identity100.0

                                                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                            3. lift-*.f64N/A

                                                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                            4. *-commutativeN/A

                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                            5. lower-*.f64100.0

                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                          8. Applied rewrites100.0%

                                                            \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                          9. Taylor expanded in re around 0

                                                            \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                                          10. Step-by-step derivation
                                                            1. Applied rewrites72.5%

                                                              \[\leadsto \color{blue}{re} \cdot \cosh im \]
                                                          11. Recombined 3 regimes into one program.
                                                          12. Final simplification80.0%

                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right)\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot \left(im \cdot im\right)\right) \cdot re\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \]
                                                          13. Add Preprocessing

                                                          Alternative 7: 77.5% accurate, 0.4× speedup?

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

                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                  1. Initial program 100.0%

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

                                                                    \[\leadsto \color{blue}{\sin re} \]
                                                                  4. Step-by-step derivation
                                                                    1. Applied rewrites99.3%

                                                                      \[\leadsto \color{blue}{\sin re} \]

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

                                                                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.002777777777777778, im \cdot im, 0.08333333333333333\right), im \cdot im, 1\right), im \cdot im, 2\right)} \]
                                                                          4. Recombined 3 regimes into one program.
                                                                          5. Final simplification78.5%

                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -\infty:\\ \;\;\;\;\left(\mathsf{fma}\left(\left(0.5 \cdot \mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right)\right) \cdot \left(re \cdot re\right) - 0.08333333333333333, re \cdot re, 0.5\right) \cdot \left(im \cdot im\right)\right) \cdot re\\ \mathbf{elif}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 1:\\ \;\;\;\;\sin re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.002777777777777778, im \cdot im, 0.08333333333333333\right), im \cdot im, 1\right), im \cdot im, 2\right)\\ \end{array} \]
                                                                          6. Add Preprocessing

                                                                          Alternative 8: 46.8% accurate, 0.9× speedup?

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

                                                                            1. Initial program 100.0%

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

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

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

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

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

                                                                                  \[\leadsto \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) \cdot re \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites46.5%

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

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

                                                                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.002777777777777778, im \cdot im, 0.08333333333333333\right), im \cdot im, 1\right), im \cdot im, 2\right)} \]
                                                                                        4. Recombined 2 regimes into one program.
                                                                                        5. Final simplification46.1%

                                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.2:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right), re \cdot re, -0.16666666666666666\right), re \cdot re, 1\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.002777777777777778, im \cdot im, 0.08333333333333333\right), im \cdot im, 1\right), im \cdot im, 2\right)\\ \end{array} \]
                                                                                        6. Add Preprocessing

                                                                                        Alternative 9: 45.8% accurate, 0.9× speedup?

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

                                                                                          1. Initial program 100.0%

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

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

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

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

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

                                                                                                \[\leadsto \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) \cdot re \]
                                                                                              3. Step-by-step derivation
                                                                                                1. Applied rewrites46.5%

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

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

                                                                                                1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                          \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, 0.08333333333333333, 1\right), im \cdot im, 2\right)} \]
                                                                                                      4. Recombined 2 regimes into one program.
                                                                                                      5. Final simplification45.7%

                                                                                                        \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.2:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(-0.0001984126984126984, re \cdot re, 0.008333333333333333\right), re \cdot re, -0.16666666666666666\right), re \cdot re, 1\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, 0.08333333333333333, 1\right), im \cdot im, 2\right)\\ \end{array} \]
                                                                                                      6. Add Preprocessing

                                                                                                      Alternative 10: 52.4% accurate, 0.9× speedup?

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

                                                                                                        1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                              1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                        \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, 0.08333333333333333, 1\right), im \cdot im, 2\right)} \]
                                                                                                                    4. Recombined 2 regimes into one program.
                                                                                                                    5. Final simplification50.8%

                                                                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.1:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot im\right) \cdot im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \mathsf{fma}\left(\mathsf{fma}\left(im \cdot im, 0.08333333333333333, 1\right), im \cdot im, 2\right)\\ \end{array} \]
                                                                                                                    6. Add Preprocessing

                                                                                                                    Alternative 11: 46.5% accurate, 0.9× speedup?

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

                                                                                                                      1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                            1. Initial program 100.0%

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

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

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

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

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

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

                                                                                                                                    \[\leadsto \left(0.5 \cdot re\right) \cdot \left(1 + \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, im, 0.5\right), im, 1\right), im, 1\right)}\right) \]
                                                                                                                                4. Recombined 2 regimes into one program.
                                                                                                                                5. Final simplification45.8%

                                                                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq -0.1:\\ \;\;\;\;\left(\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot im\right) \cdot im\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot re\right) \cdot \left(1 + \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, im, 0.5\right), im, 1\right), im, 1\right)\right)\\ \end{array} \]
                                                                                                                                6. Add Preprocessing

                                                                                                                                Alternative 12: 40.9% accurate, 0.9× speedup?

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

                                                                                                                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                                        1. Initial program 100.0%

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

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

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

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

                                                                                                                                              \[\leadsto \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot re \]
                                                                                                                                          4. Recombined 2 regimes into one program.
                                                                                                                                          5. Final simplification39.6%

                                                                                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{-im} + e^{im}\right) \leq 0.2:\\ \;\;\;\;\mathsf{fma}\left(-0.16666666666666666, re \cdot re, 1\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot re\\ \end{array} \]
                                                                                                                                          6. Add Preprocessing

                                                                                                                                          Alternative 13: 100.0% accurate, 1.5× speedup?

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

                                                                                                                                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - 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^{0 - im} + e^{im}\right)} \]
                                                                                                                                            2. lift-+.f64N/A

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

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

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

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

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

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

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

                                                                                                                                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{\color{blue}{0 - im}}, e^{im} \cdot \left(\frac{1}{2} \cdot \sin re\right)\right) \]
                                                                                                                                            10. sub0-negN/A

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

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

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

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

                                                                                                                                              \[\leadsto \mathsf{fma}\left(\sin re \cdot \frac{1}{2}, e^{-im}, \color{blue}{\left(e^{im} \cdot \frac{1}{2}\right) \cdot \sin re}\right) \]
                                                                                                                                            15. lower-*.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(e^{im} + e^{\color{blue}{\mathsf{neg}\left(im\right)}}\right) \]
                                                                                                                                            17. cosh-undef-revN/A

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

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

                                                                                                                                              \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{\left(2 \cdot \cosh im\right)} \]
                                                                                                                                          6. Applied rewrites100.0%

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

                                                                                                                                              \[\leadsto \color{blue}{1 \cdot \left(\cosh im \cdot \sin re\right)} \]
                                                                                                                                            2. *-lft-identity100.0

                                                                                                                                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                                                                                                            3. lift-*.f64N/A

                                                                                                                                              \[\leadsto \color{blue}{\cosh im \cdot \sin re} \]
                                                                                                                                            4. *-commutativeN/A

                                                                                                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                                                            5. lower-*.f64100.0

                                                                                                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                                                          8. Applied rewrites100.0%

                                                                                                                                            \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                                                          9. Add Preprocessing

                                                                                                                                          Alternative 14: 57.3% accurate, 1.9× speedup?

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

                                                                                                                                            1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                                                  1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                                                            \[\leadsto \left(0.5 \cdot re\right) \cdot \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.002777777777777778, im \cdot im, 0.08333333333333333\right), im \cdot im, 1\right), im \cdot im, 2\right)} \]
                                                                                                                                                        4. Recombined 2 regimes into one program.
                                                                                                                                                        5. Add Preprocessing

                                                                                                                                                        Alternative 15: 48.6% accurate, 2.3× speedup?

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

                                                                                                                                                          1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                                                                1. Initial program 100.0%

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

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

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

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

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

                                                                                                                                                                  Alternative 16: 48.5% accurate, 2.3× speedup?

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

                                                                                                                                                                    1. Initial program 100.0%

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

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

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

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

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

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

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

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

                                                                                                                                                                          1. Initial program 100.0%

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

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

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

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

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

                                                                                                                                                                            Alternative 17: 34.5% accurate, 18.6× speedup?

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

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

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

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

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

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

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

                                                                                                                                                                                    \[\leadsto \mathsf{fma}\left(-0.16666666666666666, re \cdot re, 1\right) \cdot re \]
                                                                                                                                                                                  2. Add Preprocessing

                                                                                                                                                                                  Alternative 18: 26.6% accurate, 317.0× speedup?

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

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

                                                                                                                                                                                    \[\leadsto \color{blue}{\sin re} \]
                                                                                                                                                                                  4. Step-by-step derivation
                                                                                                                                                                                    1. Applied rewrites49.9%

                                                                                                                                                                                      \[\leadsto \color{blue}{\sin re} \]
                                                                                                                                                                                    2. Taylor expanded in re around 0

                                                                                                                                                                                      \[\leadsto re \]
                                                                                                                                                                                    3. Step-by-step derivation
                                                                                                                                                                                      1. Applied rewrites23.3%

                                                                                                                                                                                        \[\leadsto re \]
                                                                                                                                                                                      2. Add Preprocessing

                                                                                                                                                                                      Reproduce

                                                                                                                                                                                      ?
                                                                                                                                                                                      herbie shell --seed 2025019 
                                                                                                                                                                                      (FPCore (re im)
                                                                                                                                                                                        :name "math.sin on complex, real part"
                                                                                                                                                                                        :precision binary64
                                                                                                                                                                                        (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))