math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 8.7s
Alternatives: 24
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 24 alternatives:

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

Initial Program: 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, 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
    3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
    14. cosh-0N/A

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

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

      \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
    17. cosh-0N/A

      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
    18. exp-0N/A

      \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
    19. lower-*.f64N/A

      \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
    20. exp-0N/A

      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
    21. lower-cosh.f64100.0

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

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

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

      \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
    3. *-lft-identityN/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} \]
  6. Applied rewrites100.0%

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

Alternative 2: 76.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:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.08333333333333333 \cdot re\right) \cdot im, im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{elif}\;t\_0 \leq 1:\\ \;\;\;\;\sin re \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \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 (fma (* (* 0.08333333333333333 re) im) im re) (* im im) (* 2.0 re))
      (fma (* re re) -0.08333333333333333 0.5))
     (if (<= t_0 1.0)
       (* (sin re) 1.0)
       (* (fma (/ (* (* im im) im) im) 0.5 1.0) re)))))
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(fma(((0.08333333333333333 * re) * im), im, re), (im * im), (2.0 * re)) * fma((re * re), -0.08333333333333333, 0.5);
	} else if (t_0 <= 1.0) {
		tmp = sin(re) * 1.0;
	} else {
		tmp = fma((((im * im) * im) / im), 0.5, 1.0) * re;
	}
	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(fma(fma(Float64(Float64(0.08333333333333333 * re) * im), im, re), Float64(im * im), Float64(2.0 * re)) * fma(Float64(re * re), -0.08333333333333333, 0.5));
	elseif (t_0 <= 1.0)
		tmp = Float64(sin(re) * 1.0);
	else
		tmp = Float64(fma(Float64(Float64(Float64(im * im) * im) / im), 0.5, 1.0) * re);
	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[(0.08333333333333333 * re), $MachinePrecision] * im), $MachinePrecision] * im + re), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(2.0 * re), $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1.0], N[(N[Sin[re], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * im), $MachinePrecision] / im), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * re), $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:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.08333333333333333 \cdot re\right) \cdot im, im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\

\mathbf{elif}\;t\_0 \leq 1:\\
\;\;\;\;\sin re \cdot 1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\


\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 re around 0

      \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
    4. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

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

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

        \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
      4. distribute-rgt-out--N/A

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

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

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

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

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

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

      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0 \cdot \left(-0.5 \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, -0.08333333333333333, 0.5\right) \]
    8. Step-by-step derivation
      1. Applied rewrites52.4%

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

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

          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\left(0.08333333333333333 \cdot re\right) \cdot im, im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
          3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
          14. cosh-0N/A

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

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

            \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
          17. cosh-0N/A

            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
          18. exp-0N/A

            \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
          19. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
          20. exp-0N/A

            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
          21. lower-cosh.f64100.0

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

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

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

            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
          3. *-lft-identityN/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} \]
        6. Applied rewrites100.0%

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

          \[\leadsto \sin re \cdot \color{blue}{1} \]
        8. Step-by-step derivation
          1. Applied rewrites97.5%

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

          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 \color{blue}{\sin re + \frac{1}{2} \cdot \left({im}^{2} \cdot \sin re\right)} \]
          4. Step-by-step derivation
            1. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot \color{blue}{re} \]
            2. Step-by-step derivation
              1. Applied rewrites48.5%

                \[\leadsto \mathsf{fma}\left(\frac{\left(-im \cdot im\right) \cdot \left(-im\right)}{im}, 0.5, 1\right) \cdot re \]
            3. Recombined 3 regimes into one program.
            4. Final simplification72.4%

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

            Alternative 3: 53.1% 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.0001:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.08333333333333333 \cdot re\right) \cdot im, im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
            (FPCore (re im)
             :precision binary64
             (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.0001)
               (*
                (fma (fma (* (* 0.08333333333333333 re) im) im re) (* im im) (* 2.0 re))
                (fma (* re re) -0.08333333333333333 0.5))
               (* (fma (/ (* (* im im) im) im) 0.5 1.0) re)))
            double code(double re, double im) {
            	double tmp;
            	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.0001) {
            		tmp = fma(fma(((0.08333333333333333 * re) * im), im, re), (im * im), (2.0 * re)) * fma((re * re), -0.08333333333333333, 0.5);
            	} else {
            		tmp = fma((((im * im) * im) / im), 0.5, 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.0001)
            		tmp = Float64(fma(fma(Float64(Float64(0.08333333333333333 * re) * im), im, re), Float64(im * im), Float64(2.0 * re)) * fma(Float64(re * re), -0.08333333333333333, 0.5));
            	else
            		tmp = Float64(fma(Float64(Float64(Float64(im * im) * im) / im), 0.5, 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.0001], N[(N[(N[(N[(N[(0.08333333333333333 * re), $MachinePrecision] * im), $MachinePrecision] * im + re), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(2.0 * re), $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * im), $MachinePrecision] / im), $MachinePrecision] * 0.5 + 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.0001:\\
            \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\left(0.08333333333333333 \cdot re\right) \cdot im, im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 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))) < 1.00000000000000005e-4

              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 re around 0

                \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
              4. Step-by-step derivation
                1. fp-cancel-sign-sub-invN/A

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

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

                  \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                4. distribute-rgt-out--N/A

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

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

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

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

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

                \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
              7. Applied rewrites59.0%

                \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0 \cdot \left(-0.5 \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, -0.08333333333333333, 0.5\right) \]
              8. Step-by-step derivation
                1. Applied rewrites59.0%

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

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

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

                  if 1.00000000000000005e-4 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                    Alternative 4: 51.2% 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.0001:\\ \;\;\;\;\left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
                    (FPCore (re im)
                     :precision binary64
                     (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.0001)
                       (* (* (fma im im 2.0) re) (fma (* re re) -0.08333333333333333 0.5))
                       (* (fma (/ (* (* im im) im) im) 0.5 1.0) re)))
                    double code(double re, double im) {
                    	double tmp;
                    	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.0001) {
                    		tmp = (fma(im, im, 2.0) * re) * fma((re * re), -0.08333333333333333, 0.5);
                    	} else {
                    		tmp = fma((((im * im) * im) / im), 0.5, 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.0001)
                    		tmp = Float64(Float64(fma(im, im, 2.0) * re) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                    	else
                    		tmp = Float64(fma(Float64(Float64(Float64(im * im) * im) / im), 0.5, 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.0001], N[(N[(N[(im * im + 2.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * im), $MachinePrecision] / im), $MachinePrecision] * 0.5 + 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.0001:\\
                    \;\;\;\;\left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 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))) < 1.00000000000000005e-4

                      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 re around 0

                        \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                      4. Step-by-step derivation
                        1. fp-cancel-sign-sub-invN/A

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

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

                          \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                        4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                        if 1.00000000000000005e-4 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                          Alternative 5: 49.3% 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.0001:\\ \;\;\;\;\left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
                          (FPCore (re im)
                           :precision binary64
                           (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.0001)
                             (* (* (fma im im 2.0) re) (fma (* re re) -0.08333333333333333 0.5))
                             (* (fma (* im im) 0.5 1.0) re)))
                          double code(double re, double im) {
                          	double tmp;
                          	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.0001) {
                          		tmp = (fma(im, im, 2.0) * re) * fma((re * re), -0.08333333333333333, 0.5);
                          	} else {
                          		tmp = fma((im * im), 0.5, 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.0001)
                          		tmp = Float64(Float64(fma(im, im, 2.0) * re) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                          	else
                          		tmp = Float64(fma(Float64(im * im), 0.5, 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.0001], N[(N[(N[(im * im + 2.0), $MachinePrecision] * re), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * 0.5 + 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.0001:\\
                          \;\;\;\;\left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                          
                          \mathbf{else}:\\
                          \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 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))) < 1.00000000000000005e-4

                            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 re around 0

                              \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                            4. Step-by-step derivation
                              1. fp-cancel-sign-sub-invN/A

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

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

                                \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                              4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                              if 1.00000000000000005e-4 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                              Alternative 6: 49.3% 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.0001:\\ \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
                              (FPCore (re im)
                               :precision binary64
                               (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.0001)
                                 (* (fma im im 2.0) (* (fma (* re re) -0.08333333333333333 0.5) re))
                                 (* (fma (* im im) 0.5 1.0) re)))
                              double code(double re, double im) {
                              	double tmp;
                              	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.0001) {
                              		tmp = fma(im, im, 2.0) * (fma((re * re), -0.08333333333333333, 0.5) * re);
                              	} else {
                              		tmp = fma((im * im), 0.5, 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.0001)
                              		tmp = Float64(fma(im, im, 2.0) * Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re));
                              	else
                              		tmp = Float64(fma(Float64(im * im), 0.5, 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.0001], N[(N[(im * im + 2.0), $MachinePrecision] * N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * 0.5 + 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.0001:\\
                              \;\;\;\;\mathsf{fma}\left(im, im, 2\right) \cdot \left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right)\\
                              
                              \mathbf{else}:\\
                              \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 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))) < 1.00000000000000005e-4

                                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 re around 0

                                  \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                4. Step-by-step derivation
                                  1. fp-cancel-sign-sub-invN/A

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

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

                                    \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                  4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                  if 1.00000000000000005e-4 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                  Alternative 7: 46.2% 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.05:\\ \;\;\;\;\left(\left(im \cdot re\right) \cdot im\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
                                  (FPCore (re im)
                                   :precision binary64
                                   (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) -0.05)
                                     (* (* (* im re) im) (fma (* re re) -0.08333333333333333 0.5))
                                     (* (fma (* im im) 0.5 1.0) re)))
                                  double code(double re, double im) {
                                  	double tmp;
                                  	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= -0.05) {
                                  		tmp = ((im * re) * im) * fma((re * re), -0.08333333333333333, 0.5);
                                  	} else {
                                  		tmp = fma((im * im), 0.5, 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.05)
                                  		tmp = Float64(Float64(Float64(im * re) * im) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                                  	else
                                  		tmp = Float64(fma(Float64(im * im), 0.5, 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.05], N[(N[(N[(im * re), $MachinePrecision] * im), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * 0.5 + 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.05:\\
                                  \;\;\;\;\left(\left(im \cdot re\right) \cdot im\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 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.050000000000000003

                                    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 re around 0

                                      \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                    4. Step-by-step derivation
                                      1. fp-cancel-sign-sub-invN/A

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

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

                                        \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                      4. distribute-rgt-out--N/A

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

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

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

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

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

                                      \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites25.0%

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

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

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

                                        if -0.050000000000000003 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                        Alternative 8: 41.0% 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.0001:\\ \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot re\\ \end{array} \end{array} \]
                                        (FPCore (re im)
                                         :precision binary64
                                         (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.0001)
                                           (* (* (fma (* re re) -0.08333333333333333 0.5) re) 2.0)
                                           (* (fma (* im im) 0.5 1.0) re)))
                                        double code(double re, double im) {
                                        	double tmp;
                                        	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.0001) {
                                        		tmp = (fma((re * re), -0.08333333333333333, 0.5) * re) * 2.0;
                                        	} else {
                                        		tmp = fma((im * im), 0.5, 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.0001)
                                        		tmp = Float64(Float64(fma(Float64(re * re), -0.08333333333333333, 0.5) * re) * 2.0);
                                        	else
                                        		tmp = Float64(fma(Float64(im * im), 0.5, 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.0001], N[(N[(N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision] * re), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * 0.5 + 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.0001:\\
                                        \;\;\;\;\left(\mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right) \cdot re\right) \cdot 2\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;\mathsf{fma}\left(im \cdot im, 0.5, 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))) < 1.00000000000000005e-4

                                          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 \color{blue}{2} \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites52.8%

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

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

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

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

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

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

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

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

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

                                            if 1.00000000000000005e-4 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                            Alternative 9: 37.2% 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.94:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(\left(im \cdot im\right) \cdot 0.5\right) \cdot re\\ \end{array} \end{array} \]
                                            (FPCore (re im)
                                             :precision binary64
                                             (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.94)
                                               (* (* re 0.5) 2.0)
                                               (* (* (* im im) 0.5) re)))
                                            double code(double re, double im) {
                                            	double tmp;
                                            	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.94) {
                                            		tmp = (re * 0.5) * 2.0;
                                            	} else {
                                            		tmp = ((im * im) * 0.5) * re;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            module fmin_fmax_functions
                                                implicit none
                                                private
                                                public fmax
                                                public fmin
                                            
                                                interface fmax
                                                    module procedure fmax88
                                                    module procedure fmax44
                                                    module procedure fmax84
                                                    module procedure fmax48
                                                end interface
                                                interface fmin
                                                    module procedure fmin88
                                                    module procedure fmin44
                                                    module procedure fmin84
                                                    module procedure fmin48
                                                end interface
                                            contains
                                                real(8) function fmax88(x, y) result (res)
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                end function
                                                real(4) function fmax44(x, y) result (res)
                                                    real(4), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                end function
                                                real(8) function fmax84(x, y) result(res)
                                                    real(8), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                end function
                                                real(8) function fmax48(x, y) result(res)
                                                    real(4), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                end function
                                                real(8) function fmin88(x, y) result (res)
                                                    real(8), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                end function
                                                real(4) function fmin44(x, y) result (res)
                                                    real(4), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                end function
                                                real(8) function fmin84(x, y) result(res)
                                                    real(8), intent (in) :: x
                                                    real(4), intent (in) :: y
                                                    res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                end function
                                                real(8) function fmin48(x, y) result(res)
                                                    real(4), intent (in) :: x
                                                    real(8), intent (in) :: y
                                                    res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                end function
                                            end module
                                            
                                            real(8) function code(re, im)
                                            use fmin_fmax_functions
                                                real(8), intent (in) :: re
                                                real(8), intent (in) :: im
                                                real(8) :: tmp
                                                if (((0.5d0 * sin(re)) * (exp(-im) + exp(im))) <= 0.94d0) then
                                                    tmp = (re * 0.5d0) * 2.0d0
                                                else
                                                    tmp = ((im * im) * 0.5d0) * re
                                                end if
                                                code = tmp
                                            end function
                                            
                                            public static double code(double re, double im) {
                                            	double tmp;
                                            	if (((0.5 * Math.sin(re)) * (Math.exp(-im) + Math.exp(im))) <= 0.94) {
                                            		tmp = (re * 0.5) * 2.0;
                                            	} else {
                                            		tmp = ((im * im) * 0.5) * re;
                                            	}
                                            	return tmp;
                                            }
                                            
                                            def code(re, im):
                                            	tmp = 0
                                            	if ((0.5 * math.sin(re)) * (math.exp(-im) + math.exp(im))) <= 0.94:
                                            		tmp = (re * 0.5) * 2.0
                                            	else:
                                            		tmp = ((im * im) * 0.5) * re
                                            	return tmp
                                            
                                            function code(re, im)
                                            	tmp = 0.0
                                            	if (Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) + exp(im))) <= 0.94)
                                            		tmp = Float64(Float64(re * 0.5) * 2.0);
                                            	else
                                            		tmp = Float64(Float64(Float64(im * im) * 0.5) * re);
                                            	end
                                            	return tmp
                                            end
                                            
                                            function tmp_2 = code(re, im)
                                            	tmp = 0.0;
                                            	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.94)
                                            		tmp = (re * 0.5) * 2.0;
                                            	else
                                            		tmp = ((im * im) * 0.5) * re;
                                            	end
                                            	tmp_2 = 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.94], N[(N[(re * 0.5), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(im * im), $MachinePrecision] * 0.5), $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.94:\\
                                            \;\;\;\;\left(re \cdot 0.5\right) \cdot 2\\
                                            
                                            \mathbf{else}:\\
                                            \;\;\;\;\left(\left(im \cdot im\right) \cdot 0.5\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.93999999999999995

                                              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 \color{blue}{2} \]
                                              4. Step-by-step derivation
                                                1. Applied rewrites59.6%

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

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

                                                    \[\leadsto \color{blue}{\left(re \cdot \frac{1}{2}\right)} \cdot 2 \]
                                                  2. lower-*.f6430.9

                                                    \[\leadsto \color{blue}{\left(re \cdot 0.5\right)} \cdot 2 \]
                                                4. Applied rewrites30.9%

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

                                                if 0.93999999999999995 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                      \[\leadsto \left(\left(im \cdot im\right) \cdot 0.5\right) \cdot re \]
                                                  4. Recombined 2 regimes into one program.
                                                  5. Final simplification32.5%

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

                                                  Alternative 10: 34.2% 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.94:\\ \;\;\;\;\left(re \cdot 0.5\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left(\left(im \cdot re\right) \cdot im\right) \cdot 0.5\\ \end{array} \end{array} \]
                                                  (FPCore (re im)
                                                   :precision binary64
                                                   (if (<= (* (* 0.5 (sin re)) (+ (exp (- im)) (exp im))) 0.94)
                                                     (* (* re 0.5) 2.0)
                                                     (* (* (* im re) im) 0.5)))
                                                  double code(double re, double im) {
                                                  	double tmp;
                                                  	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.94) {
                                                  		tmp = (re * 0.5) * 2.0;
                                                  	} else {
                                                  		tmp = ((im * re) * im) * 0.5;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  module fmin_fmax_functions
                                                      implicit none
                                                      private
                                                      public fmax
                                                      public fmin
                                                  
                                                      interface fmax
                                                          module procedure fmax88
                                                          module procedure fmax44
                                                          module procedure fmax84
                                                          module procedure fmax48
                                                      end interface
                                                      interface fmin
                                                          module procedure fmin88
                                                          module procedure fmin44
                                                          module procedure fmin84
                                                          module procedure fmin48
                                                      end interface
                                                  contains
                                                      real(8) function fmax88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmax44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, max(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmax48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin88(x, y) result (res)
                                                          real(8), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(4) function fmin44(x, y) result (res)
                                                          real(4), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(y, merge(x, min(x, y), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin84(x, y) result(res)
                                                          real(8), intent (in) :: x
                                                          real(4), intent (in) :: y
                                                          res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
                                                      end function
                                                      real(8) function fmin48(x, y) result(res)
                                                          real(4), intent (in) :: x
                                                          real(8), intent (in) :: y
                                                          res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
                                                      end function
                                                  end module
                                                  
                                                  real(8) function code(re, im)
                                                  use fmin_fmax_functions
                                                      real(8), intent (in) :: re
                                                      real(8), intent (in) :: im
                                                      real(8) :: tmp
                                                      if (((0.5d0 * sin(re)) * (exp(-im) + exp(im))) <= 0.94d0) then
                                                          tmp = (re * 0.5d0) * 2.0d0
                                                      else
                                                          tmp = ((im * re) * im) * 0.5d0
                                                      end if
                                                      code = tmp
                                                  end function
                                                  
                                                  public static double code(double re, double im) {
                                                  	double tmp;
                                                  	if (((0.5 * Math.sin(re)) * (Math.exp(-im) + Math.exp(im))) <= 0.94) {
                                                  		tmp = (re * 0.5) * 2.0;
                                                  	} else {
                                                  		tmp = ((im * re) * im) * 0.5;
                                                  	}
                                                  	return tmp;
                                                  }
                                                  
                                                  def code(re, im):
                                                  	tmp = 0
                                                  	if ((0.5 * math.sin(re)) * (math.exp(-im) + math.exp(im))) <= 0.94:
                                                  		tmp = (re * 0.5) * 2.0
                                                  	else:
                                                  		tmp = ((im * re) * im) * 0.5
                                                  	return tmp
                                                  
                                                  function code(re, im)
                                                  	tmp = 0.0
                                                  	if (Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(-im)) + exp(im))) <= 0.94)
                                                  		tmp = Float64(Float64(re * 0.5) * 2.0);
                                                  	else
                                                  		tmp = Float64(Float64(Float64(im * re) * im) * 0.5);
                                                  	end
                                                  	return tmp
                                                  end
                                                  
                                                  function tmp_2 = code(re, im)
                                                  	tmp = 0.0;
                                                  	if (((0.5 * sin(re)) * (exp(-im) + exp(im))) <= 0.94)
                                                  		tmp = (re * 0.5) * 2.0;
                                                  	else
                                                  		tmp = ((im * re) * im) * 0.5;
                                                  	end
                                                  	tmp_2 = 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.94], N[(N[(re * 0.5), $MachinePrecision] * 2.0), $MachinePrecision], N[(N[(N[(im * re), $MachinePrecision] * im), $MachinePrecision] * 0.5), $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.94:\\
                                                  \;\;\;\;\left(re \cdot 0.5\right) \cdot 2\\
                                                  
                                                  \mathbf{else}:\\
                                                  \;\;\;\;\left(\left(im \cdot re\right) \cdot im\right) \cdot 0.5\\
                                                  
                                                  
                                                  \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.93999999999999995

                                                    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 \color{blue}{2} \]
                                                    4. Step-by-step derivation
                                                      1. Applied rewrites59.6%

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

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

                                                          \[\leadsto \color{blue}{\left(re \cdot \frac{1}{2}\right)} \cdot 2 \]
                                                        2. lower-*.f6430.9

                                                          \[\leadsto \color{blue}{\left(re \cdot 0.5\right)} \cdot 2 \]
                                                      4. Applied rewrites30.9%

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

                                                      if 0.93999999999999995 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                            \[\leadsto \left(\left(im \cdot re\right) \cdot im\right) \cdot 0.5 \]
                                                        4. Recombined 2 regimes into one program.
                                                        5. Final simplification31.1%

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

                                                        Alternative 11: 49.1% accurate, 1.6× speedup?

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

                                                          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 re around 0

                                                            \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                          4. Step-by-step derivation
                                                            1. fp-cancel-sign-sub-invN/A

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

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

                                                              \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                            4. distribute-rgt-out--N/A

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

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

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

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

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

                                                            \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                                          7. Applied rewrites50.9%

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

                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{4}, re, \mathsf{fma}\left(\frac{-1}{6}, re, \mathsf{fma}\left(\frac{1}{3}, re, \frac{-1}{2} \cdot re\right)\right)\right), -im, 0 \cdot \left(\frac{-1}{2} \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left({re}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{{re}^{2}} - \frac{1}{12}\right)}\right) \]
                                                          9. Step-by-step derivation
                                                            1. Applied rewrites44.2%

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

                                                            if 1.00000000000000004e-297 < (*.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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

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

                                                                \[\leadsto \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot \color{blue}{re} \]
                                                              2. Step-by-step derivation
                                                                1. Applied rewrites48.9%

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

                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin re \leq 10^{-297}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \end{array} \]
                                                              5. Add Preprocessing

                                                              Alternative 12: 45.9% accurate, 1.9× speedup?

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

                                                                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 re around 0

                                                                  \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                4. Step-by-step derivation
                                                                  1. fp-cancel-sign-sub-invN/A

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

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

                                                                    \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                  4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

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

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

                                                                    if 1.99999999999999991e-6 < (*.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 re around 0

                                                                      \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                    4. Step-by-step derivation
                                                                      1. fp-cancel-sign-sub-invN/A

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

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

                                                                        \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                      4. distribute-rgt-out--N/A

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

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

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

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

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

                                                                      \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                                                    7. Applied rewrites16.1%

                                                                      \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0 \cdot \left(-0.5 \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, -0.08333333333333333, 0.5\right) \]
                                                                    8. Step-by-step derivation
                                                                      1. Applied rewrites26.4%

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

                                                                    Alternative 13: 94.8% accurate, 1.9× speedup?

                                                                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 5.2:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, im, 0.5\right), im, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \end{array} \]
                                                                    (FPCore (re im)
                                                                     :precision binary64
                                                                     (if (<= im 5.2)
                                                                       (*
                                                                        (fma
                                                                         (fma
                                                                          (fma 0.001388888888888889 (* im im) 0.041666666666666664)
                                                                          (* im im)
                                                                          0.5)
                                                                         (* im im)
                                                                         1.0)
                                                                        (sin re))
                                                                       (if (<= im 7.2e+51)
                                                                         (*
                                                                          (fma
                                                                           (exp im)
                                                                           re
                                                                           (/ re (fma (fma (fma 0.16666666666666666 im 0.5) im 1.0) im 1.0)))
                                                                          (fma (* re re) -0.08333333333333333 0.5))
                                                                         (*
                                                                          (sin re)
                                                                          (fma
                                                                           (fma (* 0.001388888888888889 (* im im)) (* im im) 0.5)
                                                                           (* im im)
                                                                           1.0)))))
                                                                    double code(double re, double im) {
                                                                    	double tmp;
                                                                    	if (im <= 5.2) {
                                                                    		tmp = fma(fma(fma(0.001388888888888889, (im * im), 0.041666666666666664), (im * im), 0.5), (im * im), 1.0) * sin(re);
                                                                    	} else if (im <= 7.2e+51) {
                                                                    		tmp = fma(exp(im), re, (re / fma(fma(fma(0.16666666666666666, im, 0.5), im, 1.0), im, 1.0))) * fma((re * re), -0.08333333333333333, 0.5);
                                                                    	} else {
                                                                    		tmp = sin(re) * fma(fma((0.001388888888888889 * (im * im)), (im * im), 0.5), (im * im), 1.0);
                                                                    	}
                                                                    	return tmp;
                                                                    }
                                                                    
                                                                    function code(re, im)
                                                                    	tmp = 0.0
                                                                    	if (im <= 5.2)
                                                                    		tmp = Float64(fma(fma(fma(0.001388888888888889, Float64(im * im), 0.041666666666666664), Float64(im * im), 0.5), Float64(im * im), 1.0) * sin(re));
                                                                    	elseif (im <= 7.2e+51)
                                                                    		tmp = Float64(fma(exp(im), re, Float64(re / fma(fma(fma(0.16666666666666666, im, 0.5), im, 1.0), im, 1.0))) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                                                                    	else
                                                                    		tmp = Float64(sin(re) * fma(fma(Float64(0.001388888888888889 * Float64(im * im)), Float64(im * im), 0.5), Float64(im * im), 1.0));
                                                                    	end
                                                                    	return tmp
                                                                    end
                                                                    
                                                                    code[re_, im_] := If[LessEqual[im, 5.2], N[(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] * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+51], N[(N[(N[Exp[im], $MachinePrecision] * re + N[(re / N[(N[(N[(0.16666666666666666 * im + 0.5), $MachinePrecision] * im + 1.0), $MachinePrecision] * im + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(0.001388888888888889 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
                                                                    
                                                                    \begin{array}{l}
                                                                    
                                                                    \\
                                                                    \begin{array}{l}
                                                                    \mathbf{if}\;im \leq 5.2:\\
                                                                    \;\;\;\;\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) \cdot \sin re\\
                                                                    
                                                                    \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\
                                                                    \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, im, 0.5\right), im, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                                                                    
                                                                    \mathbf{else}:\\
                                                                    \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\
                                                                    
                                                                    
                                                                    \end{array}
                                                                    \end{array}
                                                                    
                                                                    Derivation
                                                                    1. Split input into 3 regimes
                                                                    2. if im < 5.20000000000000018

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

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

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

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

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

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

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

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

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

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

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

                                                                          \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                        14. cosh-0N/A

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

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

                                                                          \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                        17. cosh-0N/A

                                                                          \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                        18. exp-0N/A

                                                                          \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                        19. lower-*.f64N/A

                                                                          \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                        20. exp-0N/A

                                                                          \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                        21. lower-cosh.f64100.0

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

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

                                                                        \[\leadsto \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)} \cdot \sin re \]
                                                                      6. Step-by-step derivation
                                                                        1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                                          \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720}, im \cdot im, \frac{1}{24}\right), im \cdot im, \frac{1}{2}\right), \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
                                                                        14. lower-*.f6492.7

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

                                                                        \[\leadsto \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)} \cdot \sin re \]

                                                                      if 5.20000000000000018 < im < 7.20000000000000022e51

                                                                      1. Initial program 99.9%

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

                                                                        \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                      4. Step-by-step derivation
                                                                        1. fp-cancel-sign-sub-invN/A

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

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

                                                                          \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                        4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                        if 7.20000000000000022e51 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                          3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                            \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                          14. cosh-0N/A

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

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

                                                                            \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                          17. cosh-0N/A

                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                          18. exp-0N/A

                                                                            \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                          19. lower-*.f64N/A

                                                                            \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                          20. exp-0N/A

                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                          21. lower-cosh.f64100.0

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

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

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

                                                                            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                          3. *-lft-identityN/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} \]
                                                                        6. Applied rewrites100.0%

                                                                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                        7. 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)} \]
                                                                        8. Step-by-step derivation
                                                                          1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                            \[\leadsto \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), \color{blue}{im \cdot im}, 1\right) \]
                                                                        9. Applied rewrites100.0%

                                                                          \[\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)} \]
                                                                        10. Taylor expanded in im around inf

                                                                          \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720} \cdot {im}^{2}, im \cdot im, \frac{1}{2}\right), im \cdot im, 1\right) \]
                                                                        11. Step-by-step derivation
                                                                          1. Applied rewrites100.0%

                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right) \]
                                                                        12. Recombined 3 regimes into one program.
                                                                        13. Final simplification94.5%

                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 5.2:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, im, 0.5\right), im, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \]
                                                                        14. Add Preprocessing

                                                                        Alternative 14: 94.8% accurate, 2.0× speedup?

                                                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 6:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \end{array} \]
                                                                        (FPCore (re im)
                                                                         :precision binary64
                                                                         (if (<= im 6.0)
                                                                           (*
                                                                            (fma
                                                                             (fma
                                                                              (fma 0.001388888888888889 (* im im) 0.041666666666666664)
                                                                              (* im im)
                                                                              0.5)
                                                                             (* im im)
                                                                             1.0)
                                                                            (sin re))
                                                                           (if (<= im 7.2e+51)
                                                                             (*
                                                                              (fma (exp im) re (/ re (fma (fma im 0.5 1.0) im 1.0)))
                                                                              (fma (* re re) -0.08333333333333333 0.5))
                                                                             (*
                                                                              (sin re)
                                                                              (fma
                                                                               (fma (* 0.001388888888888889 (* im im)) (* im im) 0.5)
                                                                               (* im im)
                                                                               1.0)))))
                                                                        double code(double re, double im) {
                                                                        	double tmp;
                                                                        	if (im <= 6.0) {
                                                                        		tmp = fma(fma(fma(0.001388888888888889, (im * im), 0.041666666666666664), (im * im), 0.5), (im * im), 1.0) * sin(re);
                                                                        	} else if (im <= 7.2e+51) {
                                                                        		tmp = fma(exp(im), re, (re / fma(fma(im, 0.5, 1.0), im, 1.0))) * fma((re * re), -0.08333333333333333, 0.5);
                                                                        	} else {
                                                                        		tmp = sin(re) * fma(fma((0.001388888888888889 * (im * im)), (im * im), 0.5), (im * im), 1.0);
                                                                        	}
                                                                        	return tmp;
                                                                        }
                                                                        
                                                                        function code(re, im)
                                                                        	tmp = 0.0
                                                                        	if (im <= 6.0)
                                                                        		tmp = Float64(fma(fma(fma(0.001388888888888889, Float64(im * im), 0.041666666666666664), Float64(im * im), 0.5), Float64(im * im), 1.0) * sin(re));
                                                                        	elseif (im <= 7.2e+51)
                                                                        		tmp = Float64(fma(exp(im), re, Float64(re / fma(fma(im, 0.5, 1.0), im, 1.0))) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                                                                        	else
                                                                        		tmp = Float64(sin(re) * fma(fma(Float64(0.001388888888888889 * Float64(im * im)), Float64(im * im), 0.5), Float64(im * im), 1.0));
                                                                        	end
                                                                        	return tmp
                                                                        end
                                                                        
                                                                        code[re_, im_] := If[LessEqual[im, 6.0], N[(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] * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+51], N[(N[(N[Exp[im], $MachinePrecision] * re + N[(re / N[(N[(im * 0.5 + 1.0), $MachinePrecision] * im + 1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(0.001388888888888889 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
                                                                        
                                                                        \begin{array}{l}
                                                                        
                                                                        \\
                                                                        \begin{array}{l}
                                                                        \mathbf{if}\;im \leq 6:\\
                                                                        \;\;\;\;\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) \cdot \sin re\\
                                                                        
                                                                        \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\
                                                                        \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                                                                        
                                                                        \mathbf{else}:\\
                                                                        \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\
                                                                        
                                                                        
                                                                        \end{array}
                                                                        \end{array}
                                                                        
                                                                        Derivation
                                                                        1. Split input into 3 regimes
                                                                        2. if im < 6

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

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

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

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                            14. cosh-0N/A

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

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

                                                                              \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                            17. cosh-0N/A

                                                                              \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                            18. exp-0N/A

                                                                              \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                            19. lower-*.f64N/A

                                                                              \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                            20. exp-0N/A

                                                                              \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                            21. lower-cosh.f64100.0

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

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

                                                                            \[\leadsto \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)} \cdot \sin re \]
                                                                          6. Step-by-step derivation
                                                                            1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720}, im \cdot im, \frac{1}{24}\right), im \cdot im, \frac{1}{2}\right), \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
                                                                            14. lower-*.f6492.7

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

                                                                            \[\leadsto \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)} \cdot \sin re \]

                                                                          if 6 < im < 7.20000000000000022e51

                                                                          1. Initial program 99.9%

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

                                                                            \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                          4. Step-by-step derivation
                                                                            1. fp-cancel-sign-sub-invN/A

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

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

                                                                              \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                            4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                            if 7.20000000000000022e51 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                              3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                              14. cosh-0N/A

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

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

                                                                                \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                              17. cosh-0N/A

                                                                                \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                              18. exp-0N/A

                                                                                \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                              19. lower-*.f64N/A

                                                                                \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                              20. exp-0N/A

                                                                                \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                              21. lower-cosh.f64100.0

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

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

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

                                                                                \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                              3. *-lft-identityN/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} \]
                                                                            6. Applied rewrites100.0%

                                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                            7. 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)} \]
                                                                            8. Step-by-step derivation
                                                                              1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                \[\leadsto \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), \color{blue}{im \cdot im}, 1\right) \]
                                                                            9. Applied rewrites100.0%

                                                                              \[\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)} \]
                                                                            10. Taylor expanded in im around inf

                                                                              \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720} \cdot {im}^{2}, im \cdot im, \frac{1}{2}\right), im \cdot im, 1\right) \]
                                                                            11. Step-by-step derivation
                                                                              1. Applied rewrites100.0%

                                                                                \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right) \]
                                                                            12. Recombined 3 regimes into one program.
                                                                            13. Final simplification94.5%

                                                                              \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{\mathsf{fma}\left(\mathsf{fma}\left(im, 0.5, 1\right), im, 1\right)}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \]
                                                                            14. Add Preprocessing

                                                                            Alternative 15: 94.8% accurate, 2.1× speedup?

                                                                            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 6:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{1 + im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \end{array} \]
                                                                            (FPCore (re im)
                                                                             :precision binary64
                                                                             (if (<= im 6.0)
                                                                               (*
                                                                                (fma
                                                                                 (fma
                                                                                  (fma 0.001388888888888889 (* im im) 0.041666666666666664)
                                                                                  (* im im)
                                                                                  0.5)
                                                                                 (* im im)
                                                                                 1.0)
                                                                                (sin re))
                                                                               (if (<= im 7.2e+51)
                                                                                 (*
                                                                                  (fma (exp im) re (/ re (+ 1.0 im)))
                                                                                  (fma (* re re) -0.08333333333333333 0.5))
                                                                                 (*
                                                                                  (sin re)
                                                                                  (fma
                                                                                   (fma (* 0.001388888888888889 (* im im)) (* im im) 0.5)
                                                                                   (* im im)
                                                                                   1.0)))))
                                                                            double code(double re, double im) {
                                                                            	double tmp;
                                                                            	if (im <= 6.0) {
                                                                            		tmp = fma(fma(fma(0.001388888888888889, (im * im), 0.041666666666666664), (im * im), 0.5), (im * im), 1.0) * sin(re);
                                                                            	} else if (im <= 7.2e+51) {
                                                                            		tmp = fma(exp(im), re, (re / (1.0 + im))) * fma((re * re), -0.08333333333333333, 0.5);
                                                                            	} else {
                                                                            		tmp = sin(re) * fma(fma((0.001388888888888889 * (im * im)), (im * im), 0.5), (im * im), 1.0);
                                                                            	}
                                                                            	return tmp;
                                                                            }
                                                                            
                                                                            function code(re, im)
                                                                            	tmp = 0.0
                                                                            	if (im <= 6.0)
                                                                            		tmp = Float64(fma(fma(fma(0.001388888888888889, Float64(im * im), 0.041666666666666664), Float64(im * im), 0.5), Float64(im * im), 1.0) * sin(re));
                                                                            	elseif (im <= 7.2e+51)
                                                                            		tmp = Float64(fma(exp(im), re, Float64(re / Float64(1.0 + im))) * fma(Float64(re * re), -0.08333333333333333, 0.5));
                                                                            	else
                                                                            		tmp = Float64(sin(re) * fma(fma(Float64(0.001388888888888889 * Float64(im * im)), Float64(im * im), 0.5), Float64(im * im), 1.0));
                                                                            	end
                                                                            	return tmp
                                                                            end
                                                                            
                                                                            code[re_, im_] := If[LessEqual[im, 6.0], N[(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] * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 7.2e+51], N[(N[(N[Exp[im], $MachinePrecision] * re + N[(re / N[(1.0 + im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(re * re), $MachinePrecision] * -0.08333333333333333 + 0.5), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(N[(0.001388888888888889 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
                                                                            
                                                                            \begin{array}{l}
                                                                            
                                                                            \\
                                                                            \begin{array}{l}
                                                                            \mathbf{if}\;im \leq 6:\\
                                                                            \;\;\;\;\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) \cdot \sin re\\
                                                                            
                                                                            \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\
                                                                            \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{1 + im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\
                                                                            
                                                                            \mathbf{else}:\\
                                                                            \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\
                                                                            
                                                                            
                                                                            \end{array}
                                                                            \end{array}
                                                                            
                                                                            Derivation
                                                                            1. Split input into 3 regimes
                                                                            2. if im < 6

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

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

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

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

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

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

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

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

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

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

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

                                                                                  \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                14. cosh-0N/A

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

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

                                                                                  \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                17. cosh-0N/A

                                                                                  \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                18. exp-0N/A

                                                                                  \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                19. lower-*.f64N/A

                                                                                  \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                20. exp-0N/A

                                                                                  \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                21. lower-cosh.f64100.0

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

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

                                                                                \[\leadsto \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)} \cdot \sin re \]
                                                                              6. Step-by-step derivation
                                                                                1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                  \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720}, im \cdot im, \frac{1}{24}\right), im \cdot im, \frac{1}{2}\right), \color{blue}{im \cdot im}, 1\right) \cdot \sin re \]
                                                                                14. lower-*.f6492.7

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

                                                                                \[\leadsto \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)} \cdot \sin re \]

                                                                              if 6 < im < 7.20000000000000022e51

                                                                              1. Initial program 99.9%

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

                                                                                \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                              4. Step-by-step derivation
                                                                                1. fp-cancel-sign-sub-invN/A

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

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

                                                                                  \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                                if 7.20000000000000022e51 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                  3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                    \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                  14. cosh-0N/A

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

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

                                                                                    \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                  17. cosh-0N/A

                                                                                    \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                  18. exp-0N/A

                                                                                    \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                  19. lower-*.f64N/A

                                                                                    \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                  20. exp-0N/A

                                                                                    \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                  21. lower-cosh.f64100.0

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

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

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

                                                                                    \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                  3. *-lft-identityN/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} \]
                                                                                6. Applied rewrites100.0%

                                                                                  \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                7. 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)} \]
                                                                                8. Step-by-step derivation
                                                                                  1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                    \[\leadsto \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), \color{blue}{im \cdot im}, 1\right) \]
                                                                                9. Applied rewrites100.0%

                                                                                  \[\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)} \]
                                                                                10. Taylor expanded in im around inf

                                                                                  \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720} \cdot {im}^{2}, im \cdot im, \frac{1}{2}\right), im \cdot im, 1\right) \]
                                                                                11. Step-by-step derivation
                                                                                  1. Applied rewrites100.0%

                                                                                    \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right) \]
                                                                                12. Recombined 3 regimes into one program.
                                                                                13. Final simplification94.4%

                                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 6:\\ \;\;\;\;\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) \cdot \sin re\\ \mathbf{elif}\;im \leq 7.2 \cdot 10^{+51}:\\ \;\;\;\;\mathsf{fma}\left(e^{im}, re, \frac{re}{1 + im}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right)\\ \end{array} \]
                                                                                14. Add Preprocessing

                                                                                Alternative 16: 92.9% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                      \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                    14. cosh-0N/A

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

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

                                                                                      \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                    17. cosh-0N/A

                                                                                      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                    18. exp-0N/A

                                                                                      \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                    19. lower-*.f64N/A

                                                                                      \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                    20. exp-0N/A

                                                                                      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                    21. lower-cosh.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                  if 5.20000000000000018 < im < 7.20000000000000022e51

                                                                                  1. Initial program 99.9%

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

                                                                                    \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                  4. Step-by-step derivation
                                                                                    1. fp-cancel-sign-sub-invN/A

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

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

                                                                                      \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                    4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                                    if 7.20000000000000022e51 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                      3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                        \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                      14. cosh-0N/A

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

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

                                                                                        \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                      17. cosh-0N/A

                                                                                        \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                      18. exp-0N/A

                                                                                        \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                      19. lower-*.f64N/A

                                                                                        \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                      20. exp-0N/A

                                                                                        \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                      21. lower-cosh.f64100.0

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

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

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

                                                                                        \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                      3. *-lft-identityN/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} \]
                                                                                    6. Applied rewrites100.0%

                                                                                      \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                    7. 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)} \]
                                                                                    8. Step-by-step derivation
                                                                                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                        \[\leadsto \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), \color{blue}{im \cdot im}, 1\right) \]
                                                                                    9. Applied rewrites100.0%

                                                                                      \[\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)} \]
                                                                                    10. Taylor expanded in im around inf

                                                                                      \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{720} \cdot {im}^{2}, im \cdot im, \frac{1}{2}\right), im \cdot im, 1\right) \]
                                                                                    11. Step-by-step derivation
                                                                                      1. Applied rewrites100.0%

                                                                                        \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.001388888888888889 \cdot \left(im \cdot im\right), im \cdot im, 0.5\right), im \cdot im, 1\right) \]
                                                                                    12. Recombined 3 regimes into one program.
                                                                                    13. Final simplification89.5%

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

                                                                                    Alternative 17: 92.4% accurate, 2.1× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                          \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                        14. cosh-0N/A

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

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

                                                                                          \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                        17. cosh-0N/A

                                                                                          \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                        18. exp-0N/A

                                                                                          \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                        19. lower-*.f64N/A

                                                                                          \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                        20. exp-0N/A

                                                                                          \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                        21. lower-cosh.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                      if 5.20000000000000018 < im < 2.6000000000000002e77

                                                                                      1. Initial program 99.9%

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

                                                                                        \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                      4. Step-by-step derivation
                                                                                        1. fp-cancel-sign-sub-invN/A

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

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

                                                                                          \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                        4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                                        if 2.6000000000000002e77 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                          3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                          14. cosh-0N/A

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

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

                                                                                            \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                          17. cosh-0N/A

                                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                          18. exp-0N/A

                                                                                            \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                          19. lower-*.f64N/A

                                                                                            \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                          20. exp-0N/A

                                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                          21. lower-cosh.f64100.0

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

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

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

                                                                                            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                          3. *-lft-identityN/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} \]
                                                                                        6. Applied rewrites100.0%

                                                                                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                        7. 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)} \]
                                                                                        8. Step-by-step derivation
                                                                                          1. +-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                        9. Applied rewrites100.0%

                                                                                          \[\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)} \]
                                                                                        10. Taylor expanded in im around inf

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

                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), \color{blue}{im} \cdot im, 1\right) \]
                                                                                        12. Recombined 3 regimes into one program.
                                                                                        13. Final simplification89.1%

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

                                                                                        Alternative 18: 92.4% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                              \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                            14. cosh-0N/A

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

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

                                                                                              \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                            17. cosh-0N/A

                                                                                              \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                            18. exp-0N/A

                                                                                              \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                            19. lower-*.f64N/A

                                                                                              \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                            20. exp-0N/A

                                                                                              \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                            21. lower-cosh.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                          if 6 < im < 2.6000000000000002e77

                                                                                          1. Initial program 99.9%

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

                                                                                            \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                          4. Step-by-step derivation
                                                                                            1. fp-cancel-sign-sub-invN/A

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

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

                                                                                              \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                            4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                                            if 2.6000000000000002e77 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                              3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                                \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                              14. cosh-0N/A

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

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

                                                                                                \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                              17. cosh-0N/A

                                                                                                \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                              18. exp-0N/A

                                                                                                \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                              19. lower-*.f64N/A

                                                                                                \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                              20. exp-0N/A

                                                                                                \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                              21. lower-cosh.f64100.0

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

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

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

                                                                                                \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                              3. *-lft-identityN/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} \]
                                                                                            6. Applied rewrites100.0%

                                                                                              \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                            7. 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)} \]
                                                                                            8. Step-by-step derivation
                                                                                              1. +-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                            9. Applied rewrites100.0%

                                                                                              \[\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)} \]
                                                                                            10. Taylor expanded in im around inf

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

                                                                                                \[\leadsto \sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), \color{blue}{im} \cdot im, 1\right) \]
                                                                                            12. Recombined 3 regimes into one program.
                                                                                            13. Final simplification89.1%

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

                                                                                            Alternative 19: 92.2% accurate, 2.2× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                  \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                                14. cosh-0N/A

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

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

                                                                                                  \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                17. cosh-0N/A

                                                                                                  \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                18. exp-0N/A

                                                                                                  \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                19. lower-*.f64N/A

                                                                                                  \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                20. exp-0N/A

                                                                                                  \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                21. lower-cosh.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                              if 8 < im < 2.6000000000000002e77

                                                                                              1. Initial program 99.9%

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

                                                                                                \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                              4. Step-by-step derivation
                                                                                                1. fp-cancel-sign-sub-invN/A

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

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

                                                                                                  \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                                4. distribute-rgt-out--N/A

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

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

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

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

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

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

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

                                                                                                if 2.6000000000000002e77 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                                  3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                                    \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                                  14. cosh-0N/A

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

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

                                                                                                    \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                  17. cosh-0N/A

                                                                                                    \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                  18. exp-0N/A

                                                                                                    \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                  19. lower-*.f64N/A

                                                                                                    \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                  20. exp-0N/A

                                                                                                    \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                  21. lower-cosh.f64100.0

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

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

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

                                                                                                    \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                  3. *-lft-identityN/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} \]
                                                                                                6. Applied rewrites100.0%

                                                                                                  \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                7. 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)} \]
                                                                                                8. Step-by-step derivation
                                                                                                  1. +-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                    \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                                9. Applied rewrites100.0%

                                                                                                  \[\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)} \]
                                                                                                10. Taylor expanded in im around inf

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

                                                                                                    \[\leadsto \sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), \color{blue}{im} \cdot im, 1\right) \]
                                                                                                12. Recombined 3 regimes into one program.
                                                                                                13. Final simplification88.6%

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

                                                                                                Alternative 20: 90.4% accurate, 2.3× speedup?

                                                                                                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;im \leq 21000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), im \cdot im, 1\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+75}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\ \end{array} \end{array} \]
                                                                                                (FPCore (re im)
                                                                                                 :precision binary64
                                                                                                 (if (<= im 21000.0)
                                                                                                   (* (fma (fma 0.041666666666666664 (* im im) 0.5) (* im im) 1.0) (sin re))
                                                                                                   (if (<= im 8e+75)
                                                                                                     (*
                                                                                                      (fma
                                                                                                       (fma
                                                                                                        (fma
                                                                                                         (fma
                                                                                                          0.25
                                                                                                          re
                                                                                                          (fma
                                                                                                           -0.16666666666666666
                                                                                                           re
                                                                                                           (fma 0.3333333333333333 re (* -0.5 re))))
                                                                                                         (- im)
                                                                                                         0.0)
                                                                                                        im
                                                                                                        re)
                                                                                                       (* im im)
                                                                                                       (* 2.0 re))
                                                                                                      (* (* (- (/ 0.5 (* re re)) 0.08333333333333333) re) re))
                                                                                                     (* (sin re) (fma (* 0.041666666666666664 (* im im)) (* im im) 1.0)))))
                                                                                                double code(double re, double im) {
                                                                                                	double tmp;
                                                                                                	if (im <= 21000.0) {
                                                                                                		tmp = fma(fma(0.041666666666666664, (im * im), 0.5), (im * im), 1.0) * sin(re);
                                                                                                	} else if (im <= 8e+75) {
                                                                                                		tmp = fma(fma(fma(fma(0.25, re, fma(-0.16666666666666666, re, fma(0.3333333333333333, re, (-0.5 * re)))), -im, 0.0), im, re), (im * im), (2.0 * re)) * ((((0.5 / (re * re)) - 0.08333333333333333) * re) * re);
                                                                                                	} else {
                                                                                                		tmp = sin(re) * fma((0.041666666666666664 * (im * im)), (im * im), 1.0);
                                                                                                	}
                                                                                                	return tmp;
                                                                                                }
                                                                                                
                                                                                                function code(re, im)
                                                                                                	tmp = 0.0
                                                                                                	if (im <= 21000.0)
                                                                                                		tmp = Float64(fma(fma(0.041666666666666664, Float64(im * im), 0.5), Float64(im * im), 1.0) * sin(re));
                                                                                                	elseif (im <= 8e+75)
                                                                                                		tmp = Float64(fma(fma(fma(fma(0.25, re, fma(-0.16666666666666666, re, fma(0.3333333333333333, re, Float64(-0.5 * re)))), Float64(-im), 0.0), im, re), Float64(im * im), Float64(2.0 * re)) * Float64(Float64(Float64(Float64(0.5 / Float64(re * re)) - 0.08333333333333333) * re) * re));
                                                                                                	else
                                                                                                		tmp = Float64(sin(re) * fma(Float64(0.041666666666666664 * Float64(im * im)), Float64(im * im), 1.0));
                                                                                                	end
                                                                                                	return tmp
                                                                                                end
                                                                                                
                                                                                                code[re_, im_] := If[LessEqual[im, 21000.0], N[(N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision] + 0.5), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 8e+75], N[(N[(N[(N[(N[(0.25 * re + N[(-0.16666666666666666 * re + N[(0.3333333333333333 * re + N[(-0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-im) + 0.0), $MachinePrecision] * im + re), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(2.0 * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(0.5 / N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision], N[(N[Sin[re], $MachinePrecision] * N[(N[(0.041666666666666664 * N[(im * im), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
                                                                                                
                                                                                                \begin{array}{l}
                                                                                                
                                                                                                \\
                                                                                                \begin{array}{l}
                                                                                                \mathbf{if}\;im \leq 21000:\\
                                                                                                \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), im \cdot im, 1\right) \cdot \sin re\\
                                                                                                
                                                                                                \mathbf{elif}\;im \leq 8 \cdot 10^{+75}:\\
                                                                                                \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\
                                                                                                
                                                                                                \mathbf{else}:\\
                                                                                                \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\
                                                                                                
                                                                                                
                                                                                                \end{array}
                                                                                                \end{array}
                                                                                                
                                                                                                Derivation
                                                                                                1. Split input into 3 regimes
                                                                                                2. if im < 21000

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

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

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

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

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

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

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

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

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

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

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

                                                                                                      \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                                    14. cosh-0N/A

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

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

                                                                                                      \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                    17. cosh-0N/A

                                                                                                      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                    18. exp-0N/A

                                                                                                      \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                    19. lower-*.f64N/A

                                                                                                      \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                    20. exp-0N/A

                                                                                                      \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                    21. lower-cosh.f64100.0

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

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

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

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

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

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

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

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

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

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

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

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

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

                                                                                                  if 21000 < im < 7.99999999999999941e75

                                                                                                  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 re around 0

                                                                                                    \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                                  4. Step-by-step derivation
                                                                                                    1. fp-cancel-sign-sub-invN/A

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

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

                                                                                                      \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                                    4. distribute-rgt-out--N/A

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

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

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

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

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

                                                                                                    \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                                                                                  7. Applied rewrites16.5%

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

                                                                                                    \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{4}, re, \mathsf{fma}\left(\frac{-1}{6}, re, \mathsf{fma}\left(\frac{1}{3}, re, \frac{-1}{2} \cdot re\right)\right)\right), -im, 0 \cdot \left(\frac{-1}{2} \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left({re}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{{re}^{2}} - \frac{1}{12}\right)}\right) \]
                                                                                                  9. Step-by-step derivation
                                                                                                    1. Applied rewrites42.2%

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

                                                                                                    if 7.99999999999999941e75 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                                      3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                                        \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                                      14. cosh-0N/A

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

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

                                                                                                        \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                      17. cosh-0N/A

                                                                                                        \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                      18. exp-0N/A

                                                                                                        \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                      19. lower-*.f64N/A

                                                                                                        \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                      20. exp-0N/A

                                                                                                        \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                      21. lower-cosh.f64100.0

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

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

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

                                                                                                        \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                      3. *-lft-identityN/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} \]
                                                                                                    6. Applied rewrites100.0%

                                                                                                      \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                    7. 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)} \]
                                                                                                    8. Step-by-step derivation
                                                                                                      1. +-commutativeN/A

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

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

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

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

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

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

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

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

                                                                                                        \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                                    9. Applied rewrites100.0%

                                                                                                      \[\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)} \]
                                                                                                    10. Taylor expanded in im around inf

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

                                                                                                        \[\leadsto \sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), \color{blue}{im} \cdot im, 1\right) \]
                                                                                                    12. Recombined 3 regimes into one program.
                                                                                                    13. Final simplification85.2%

                                                                                                      \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 21000:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), im \cdot im, 1\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+75}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\ \end{array} \]
                                                                                                    14. Add Preprocessing

                                                                                                    Alternative 21: 84.8% accurate, 2.3× speedup?

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

                                                                                                      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. associate-*r*N/A

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

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

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

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

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

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

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

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

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

                                                                                                      if 14.5 < im < 7.99999999999999941e75

                                                                                                      1. Initial program 99.9%

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

                                                                                                        \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                                      4. Step-by-step derivation
                                                                                                        1. fp-cancel-sign-sub-invN/A

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

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

                                                                                                          \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                                        4. distribute-rgt-out--N/A

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

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

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

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

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

                                                                                                        \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                                                                                      7. Applied rewrites14.8%

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

                                                                                                        \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{4}, re, \mathsf{fma}\left(\frac{-1}{6}, re, \mathsf{fma}\left(\frac{1}{3}, re, \frac{-1}{2} \cdot re\right)\right)\right), -im, 0 \cdot \left(\frac{-1}{2} \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left({re}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{{re}^{2}} - \frac{1}{12}\right)}\right) \]
                                                                                                      9. Step-by-step derivation
                                                                                                        1. Applied rewrites36.3%

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

                                                                                                        if 7.99999999999999941e75 < 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 \color{blue}{\left(\frac{1}{2} \cdot \sin re\right)} \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                                          3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

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

                                                                                                            \[\leadsto \sin re \cdot \left(\color{blue}{1} \cdot \cosh im\right) \]
                                                                                                          14. cosh-0N/A

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

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

                                                                                                            \[\leadsto \color{blue}{\left(\cosh 0 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                          17. cosh-0N/A

                                                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                          18. exp-0N/A

                                                                                                            \[\leadsto \left(\color{blue}{e^{0}} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                          19. lower-*.f64N/A

                                                                                                            \[\leadsto \color{blue}{\left(e^{0} \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                          20. exp-0N/A

                                                                                                            \[\leadsto \left(\color{blue}{1} \cdot \cosh im\right) \cdot \sin re \]
                                                                                                          21. lower-cosh.f64100.0

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

                                                                                                          \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                        5. Step-by-step derivation
                                                                                                          1. lift-*.f64N/A

                                                                                                            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right) \cdot \sin re} \]
                                                                                                          2. lift-*.f64N/A

                                                                                                            \[\leadsto \color{blue}{\left(1 \cdot \cosh im\right)} \cdot \sin re \]
                                                                                                          3. *-lft-identityN/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} \]
                                                                                                        6. Applied rewrites100.0%

                                                                                                          \[\leadsto \color{blue}{\sin re \cdot \cosh im} \]
                                                                                                        7. 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)} \]
                                                                                                        8. Step-by-step derivation
                                                                                                          1. +-commutativeN/A

                                                                                                            \[\leadsto \sin re \cdot \color{blue}{\left({im}^{2} \cdot \left(\frac{1}{2} + \frac{1}{24} \cdot {im}^{2}\right) + 1\right)} \]
                                                                                                          2. *-commutativeN/A

                                                                                                            \[\leadsto \sin re \cdot \left(\color{blue}{\left(\frac{1}{2} + \frac{1}{24} \cdot {im}^{2}\right) \cdot {im}^{2}} + 1\right) \]
                                                                                                          3. lower-fma.f64N/A

                                                                                                            \[\leadsto \sin re \cdot \color{blue}{\mathsf{fma}\left(\frac{1}{2} + \frac{1}{24} \cdot {im}^{2}, {im}^{2}, 1\right)} \]
                                                                                                          4. +-commutativeN/A

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\color{blue}{\frac{1}{24} \cdot {im}^{2} + \frac{1}{2}}, {im}^{2}, 1\right) \]
                                                                                                          5. lower-fma.f64N/A

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\color{blue}{\mathsf{fma}\left(\frac{1}{24}, {im}^{2}, \frac{1}{2}\right)}, {im}^{2}, 1\right) \]
                                                                                                          6. unpow2N/A

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, \color{blue}{im \cdot im}, \frac{1}{2}\right), {im}^{2}, 1\right) \]
                                                                                                          7. lower-*.f64N/A

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, \color{blue}{im \cdot im}, \frac{1}{2}\right), {im}^{2}, 1\right) \]
                                                                                                          8. unpow2N/A

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{24}, im \cdot im, \frac{1}{2}\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                                          9. lower-*.f64100.0

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, im \cdot im, 0.5\right), \color{blue}{im \cdot im}, 1\right) \]
                                                                                                        9. Applied rewrites100.0%

                                                                                                          \[\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)} \]
                                                                                                        10. Taylor expanded in im around inf

                                                                                                          \[\leadsto \sin re \cdot \mathsf{fma}\left(\frac{1}{24} \cdot {im}^{2}, \color{blue}{im} \cdot im, 1\right) \]
                                                                                                        11. Step-by-step derivation
                                                                                                          1. Applied rewrites100.0%

                                                                                                            \[\leadsto \sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), \color{blue}{im} \cdot im, 1\right) \]
                                                                                                        12. Recombined 3 regimes into one program.
                                                                                                        13. Final simplification76.6%

                                                                                                          \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 14.5:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 8 \cdot 10^{+75}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{else}:\\ \;\;\;\;\sin re \cdot \mathsf{fma}\left(0.041666666666666664 \cdot \left(im \cdot im\right), im \cdot im, 1\right)\\ \end{array} \]
                                                                                                        14. Add Preprocessing

                                                                                                        Alternative 22: 83.0% accurate, 2.3× speedup?

                                                                                                        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \mathbf{if}\;im \leq 14.5:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;im \leq 1.75 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
                                                                                                        (FPCore (re im)
                                                                                                         :precision binary64
                                                                                                         (let* ((t_0 (* (fma (* 0.5 im) im 1.0) (sin re))))
                                                                                                           (if (<= im 14.5)
                                                                                                             t_0
                                                                                                             (if (<= im 1.75e+124)
                                                                                                               (*
                                                                                                                (fma
                                                                                                                 (fma
                                                                                                                  (fma
                                                                                                                   (fma
                                                                                                                    0.25
                                                                                                                    re
                                                                                                                    (fma
                                                                                                                     -0.16666666666666666
                                                                                                                     re
                                                                                                                     (fma 0.3333333333333333 re (* -0.5 re))))
                                                                                                                   (- im)
                                                                                                                   0.0)
                                                                                                                  im
                                                                                                                  re)
                                                                                                                 (* im im)
                                                                                                                 (* 2.0 re))
                                                                                                                (* (* (- (/ 0.5 (* re re)) 0.08333333333333333) re) re))
                                                                                                               (if (<= im 1.9e+154)
                                                                                                                 (* (fma (/ (* (* im im) im) im) 0.5 1.0) re)
                                                                                                                 t_0)))))
                                                                                                        double code(double re, double im) {
                                                                                                        	double t_0 = fma((0.5 * im), im, 1.0) * sin(re);
                                                                                                        	double tmp;
                                                                                                        	if (im <= 14.5) {
                                                                                                        		tmp = t_0;
                                                                                                        	} else if (im <= 1.75e+124) {
                                                                                                        		tmp = fma(fma(fma(fma(0.25, re, fma(-0.16666666666666666, re, fma(0.3333333333333333, re, (-0.5 * re)))), -im, 0.0), im, re), (im * im), (2.0 * re)) * ((((0.5 / (re * re)) - 0.08333333333333333) * re) * re);
                                                                                                        	} else if (im <= 1.9e+154) {
                                                                                                        		tmp = fma((((im * im) * im) / im), 0.5, 1.0) * re;
                                                                                                        	} else {
                                                                                                        		tmp = t_0;
                                                                                                        	}
                                                                                                        	return tmp;
                                                                                                        }
                                                                                                        
                                                                                                        function code(re, im)
                                                                                                        	t_0 = Float64(fma(Float64(0.5 * im), im, 1.0) * sin(re))
                                                                                                        	tmp = 0.0
                                                                                                        	if (im <= 14.5)
                                                                                                        		tmp = t_0;
                                                                                                        	elseif (im <= 1.75e+124)
                                                                                                        		tmp = Float64(fma(fma(fma(fma(0.25, re, fma(-0.16666666666666666, re, fma(0.3333333333333333, re, Float64(-0.5 * re)))), Float64(-im), 0.0), im, re), Float64(im * im), Float64(2.0 * re)) * Float64(Float64(Float64(Float64(0.5 / Float64(re * re)) - 0.08333333333333333) * re) * re));
                                                                                                        	elseif (im <= 1.9e+154)
                                                                                                        		tmp = Float64(fma(Float64(Float64(Float64(im * im) * im) / im), 0.5, 1.0) * re);
                                                                                                        	else
                                                                                                        		tmp = t_0;
                                                                                                        	end
                                                                                                        	return tmp
                                                                                                        end
                                                                                                        
                                                                                                        code[re_, im_] := Block[{t$95$0 = N[(N[(N[(0.5 * im), $MachinePrecision] * im + 1.0), $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[im, 14.5], t$95$0, If[LessEqual[im, 1.75e+124], N[(N[(N[(N[(N[(0.25 * re + N[(-0.16666666666666666 * re + N[(0.3333333333333333 * re + N[(-0.5 * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * (-im) + 0.0), $MachinePrecision] * im + re), $MachinePrecision] * N[(im * im), $MachinePrecision] + N[(2.0 * re), $MachinePrecision]), $MachinePrecision] * N[(N[(N[(N[(0.5 / N[(re * re), $MachinePrecision]), $MachinePrecision] - 0.08333333333333333), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision], If[LessEqual[im, 1.9e+154], N[(N[(N[(N[(N[(im * im), $MachinePrecision] * im), $MachinePrecision] / im), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * re), $MachinePrecision], t$95$0]]]]
                                                                                                        
                                                                                                        \begin{array}{l}
                                                                                                        
                                                                                                        \\
                                                                                                        \begin{array}{l}
                                                                                                        t_0 := \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\
                                                                                                        \mathbf{if}\;im \leq 14.5:\\
                                                                                                        \;\;\;\;t\_0\\
                                                                                                        
                                                                                                        \mathbf{elif}\;im \leq 1.75 \cdot 10^{+124}:\\
                                                                                                        \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\
                                                                                                        
                                                                                                        \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\
                                                                                                        \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\
                                                                                                        
                                                                                                        \mathbf{else}:\\
                                                                                                        \;\;\;\;t\_0\\
                                                                                                        
                                                                                                        
                                                                                                        \end{array}
                                                                                                        \end{array}
                                                                                                        
                                                                                                        Derivation
                                                                                                        1. Split input into 3 regimes
                                                                                                        2. if im < 14.5 or 1.8999999999999999e154 < 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. associate-*r*N/A

                                                                                                              \[\leadsto \sin re + \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \sin re} \]
                                                                                                            2. unpow2N/A

                                                                                                              \[\leadsto \sin re + \left(\frac{1}{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \sin re \]
                                                                                                            3. associate-*r*N/A

                                                                                                              \[\leadsto \sin re + \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im\right)} \cdot \sin re \]
                                                                                                            4. distribute-rgt1-inN/A

                                                                                                              \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                            5. lower-*.f64N/A

                                                                                                              \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                            6. lower-fma.f64N/A

                                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{2} \cdot im, im, 1\right)} \cdot \sin re \]
                                                                                                            7. lower-*.f64N/A

                                                                                                              \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{2} \cdot im}, im, 1\right) \cdot \sin re \]
                                                                                                            8. lower-sin.f6478.7

                                                                                                              \[\leadsto \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \color{blue}{\sin re} \]
                                                                                                          5. Applied rewrites78.7%

                                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re} \]

                                                                                                          if 14.5 < im < 1.7500000000000001e124

                                                                                                          1. Initial program 99.9%

                                                                                                            \[\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \]
                                                                                                          2. Add Preprocessing
                                                                                                          3. Taylor expanded in re around 0

                                                                                                            \[\leadsto \color{blue}{re \cdot \left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) + \frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                                          4. Step-by-step derivation
                                                                                                            1. fp-cancel-sign-sub-invN/A

                                                                                                              \[\leadsto re \cdot \color{blue}{\left(\frac{-1}{12} \cdot \left({re}^{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)} \]
                                                                                                            2. *-commutativeN/A

                                                                                                              \[\leadsto re \cdot \left(\frac{-1}{12} \cdot \color{blue}{\left(\left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right) \cdot {re}^{2}\right)} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                                            3. associate-*r*N/A

                                                                                                              \[\leadsto re \cdot \left(\color{blue}{\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}} - \left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \]
                                                                                                            4. distribute-rgt-out--N/A

                                                                                                              \[\leadsto \color{blue}{\left(\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}\right) \cdot re - \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot re} \]
                                                                                                            5. *-commutativeN/A

                                                                                                              \[\leadsto \color{blue}{re \cdot \left(\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}\right)} - \left(\left(\mathsf{neg}\left(\frac{1}{2}\right)\right) \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot re \]
                                                                                                            6. distribute-lft-neg-inN/A

                                                                                                              \[\leadsto re \cdot \left(\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}\right) - \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right)\right)} \cdot re \]
                                                                                                            7. cancel-sign-subN/A

                                                                                                              \[\leadsto \color{blue}{re \cdot \left(\left(\frac{-1}{12} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot {re}^{2}\right) + \left(\frac{1}{2} \cdot \left(e^{im} + e^{\mathsf{neg}\left(im\right)}\right)\right) \cdot re} \]
                                                                                                          5. Applied rewrites90.9%

                                                                                                            \[\leadsto \color{blue}{\mathsf{fma}\left(e^{im}, re, \frac{re}{e^{im}}\right) \cdot \mathsf{fma}\left(re \cdot re, -0.08333333333333333, 0.5\right)} \]
                                                                                                          6. Taylor expanded in im around 0

                                                                                                            \[\leadsto \left(2 \cdot re + {im}^{2} \cdot \left(im \cdot \left(-1 \cdot \left(im \cdot \left(-1 \cdot \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \left(\frac{-1}{2} \cdot re + \frac{1}{6} \cdot re\right)\right) + \left(\frac{-1}{2} \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{6} \cdot re\right)\right)\right) - \left(-1 \cdot \left(-1 \cdot re + \frac{1}{2} \cdot re\right) + \frac{-1}{2} \cdot re\right)\right) - -1 \cdot re\right)\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, \frac{-1}{12}, \frac{1}{2}\right) \]
                                                                                                          7. Applied rewrites25.7%

                                                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0 \cdot \left(-0.5 \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \mathsf{fma}\left(\color{blue}{re \cdot re}, -0.08333333333333333, 0.5\right) \]
                                                                                                          8. Taylor expanded in re around inf

                                                                                                            \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\frac{1}{4}, re, \mathsf{fma}\left(\frac{-1}{6}, re, \mathsf{fma}\left(\frac{1}{3}, re, \frac{-1}{2} \cdot re\right)\right)\right), -im, 0 \cdot \left(\frac{-1}{2} \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left({re}^{2} \cdot \color{blue}{\left(\frac{1}{2} \cdot \frac{1}{{re}^{2}} - \frac{1}{12}\right)}\right) \]
                                                                                                          9. Step-by-step derivation
                                                                                                            1. Applied rewrites43.3%

                                                                                                              \[\leadsto \mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0 \cdot \left(-0.5 \cdot re\right)\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot \color{blue}{re}\right) \]

                                                                                                            if 1.7500000000000001e124 < im < 1.8999999999999999e154

                                                                                                            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. associate-*r*N/A

                                                                                                                \[\leadsto \sin re + \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \sin re} \]
                                                                                                              2. unpow2N/A

                                                                                                                \[\leadsto \sin re + \left(\frac{1}{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \sin re \]
                                                                                                              3. associate-*r*N/A

                                                                                                                \[\leadsto \sin re + \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im\right)} \cdot \sin re \]
                                                                                                              4. distribute-rgt1-inN/A

                                                                                                                \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                              5. lower-*.f64N/A

                                                                                                                \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                              6. lower-fma.f64N/A

                                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{2} \cdot im, im, 1\right)} \cdot \sin re \]
                                                                                                              7. lower-*.f64N/A

                                                                                                                \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{2} \cdot im}, im, 1\right) \cdot \sin re \]
                                                                                                              8. lower-sin.f647.8

                                                                                                                \[\leadsto \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \color{blue}{\sin re} \]
                                                                                                            5. Applied rewrites7.8%

                                                                                                              \[\leadsto \color{blue}{\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re} \]
                                                                                                            6. Taylor expanded in re around 0

                                                                                                              \[\leadsto re \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot {im}^{2}\right)} \]
                                                                                                            7. Step-by-step derivation
                                                                                                              1. Applied rewrites51.5%

                                                                                                                \[\leadsto \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot \color{blue}{re} \]
                                                                                                              2. Step-by-step derivation
                                                                                                                1. Applied rewrites83.3%

                                                                                                                  \[\leadsto \mathsf{fma}\left(\frac{\left(-im \cdot im\right) \cdot \left(-im\right)}{im}, 0.5, 1\right) \cdot re \]
                                                                                                              3. Recombined 3 regimes into one program.
                                                                                                              4. Final simplification75.8%

                                                                                                                \[\leadsto \begin{array}{l} \mathbf{if}\;im \leq 14.5:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \mathbf{elif}\;im \leq 1.75 \cdot 10^{+124}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.25, re, \mathsf{fma}\left(-0.16666666666666666, re, \mathsf{fma}\left(0.3333333333333333, re, -0.5 \cdot re\right)\right)\right), -im, 0\right), im, re\right), im \cdot im, 2 \cdot re\right) \cdot \left(\left(\left(\frac{0.5}{re \cdot re} - 0.08333333333333333\right) \cdot re\right) \cdot re\right)\\ \mathbf{elif}\;im \leq 1.9 \cdot 10^{+154}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\left(im \cdot im\right) \cdot im}{im}, 0.5, 1\right) \cdot re\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re\\ \end{array} \]
                                                                                                              5. Add Preprocessing

                                                                                                              Alternative 23: 48.7% accurate, 18.6× speedup?

                                                                                                              \[\begin{array}{l} \\ \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot re \end{array} \]
                                                                                                              (FPCore (re im) :precision binary64 (* (fma (* im im) 0.5 1.0) re))
                                                                                                              double code(double re, double im) {
                                                                                                              	return fma((im * im), 0.5, 1.0) * re;
                                                                                                              }
                                                                                                              
                                                                                                              function code(re, im)
                                                                                                              	return Float64(fma(Float64(im * im), 0.5, 1.0) * re)
                                                                                                              end
                                                                                                              
                                                                                                              code[re_, im_] := N[(N[(N[(im * im), $MachinePrecision] * 0.5 + 1.0), $MachinePrecision] * re), $MachinePrecision]
                                                                                                              
                                                                                                              \begin{array}{l}
                                                                                                              
                                                                                                              \\
                                                                                                              \mathsf{fma}\left(im \cdot im, 0.5, 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. associate-*r*N/A

                                                                                                                  \[\leadsto \sin re + \color{blue}{\left(\frac{1}{2} \cdot {im}^{2}\right) \cdot \sin re} \]
                                                                                                                2. unpow2N/A

                                                                                                                  \[\leadsto \sin re + \left(\frac{1}{2} \cdot \color{blue}{\left(im \cdot im\right)}\right) \cdot \sin re \]
                                                                                                                3. associate-*r*N/A

                                                                                                                  \[\leadsto \sin re + \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im\right)} \cdot \sin re \]
                                                                                                                4. distribute-rgt1-inN/A

                                                                                                                  \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                                5. lower-*.f64N/A

                                                                                                                  \[\leadsto \color{blue}{\left(\left(\frac{1}{2} \cdot im\right) \cdot im + 1\right) \cdot \sin re} \]
                                                                                                                6. lower-fma.f64N/A

                                                                                                                  \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{1}{2} \cdot im, im, 1\right)} \cdot \sin re \]
                                                                                                                7. lower-*.f64N/A

                                                                                                                  \[\leadsto \mathsf{fma}\left(\color{blue}{\frac{1}{2} \cdot im}, im, 1\right) \cdot \sin re \]
                                                                                                                8. lower-sin.f6470.7

                                                                                                                  \[\leadsto \mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \color{blue}{\sin re} \]
                                                                                                              5. Applied rewrites70.7%

                                                                                                                \[\leadsto \color{blue}{\mathsf{fma}\left(0.5 \cdot im, im, 1\right) \cdot \sin re} \]
                                                                                                              6. Taylor expanded in re around 0

                                                                                                                \[\leadsto re \cdot \color{blue}{\left(1 + \frac{1}{2} \cdot {im}^{2}\right)} \]
                                                                                                              7. Step-by-step derivation
                                                                                                                1. Applied rewrites45.7%

                                                                                                                  \[\leadsto \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \cdot \color{blue}{re} \]
                                                                                                                2. Add Preprocessing

                                                                                                                Alternative 24: 26.3% accurate, 28.8× speedup?

                                                                                                                \[\begin{array}{l} \\ \left(re \cdot 0.5\right) \cdot 2 \end{array} \]
                                                                                                                (FPCore (re im) :precision binary64 (* (* re 0.5) 2.0))
                                                                                                                double code(double re, double im) {
                                                                                                                	return (re * 0.5) * 2.0;
                                                                                                                }
                                                                                                                
                                                                                                                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 * 0.5d0) * 2.0d0
                                                                                                                end function
                                                                                                                
                                                                                                                public static double code(double re, double im) {
                                                                                                                	return (re * 0.5) * 2.0;
                                                                                                                }
                                                                                                                
                                                                                                                def code(re, im):
                                                                                                                	return (re * 0.5) * 2.0
                                                                                                                
                                                                                                                function code(re, im)
                                                                                                                	return Float64(Float64(re * 0.5) * 2.0)
                                                                                                                end
                                                                                                                
                                                                                                                function tmp = code(re, im)
                                                                                                                	tmp = (re * 0.5) * 2.0;
                                                                                                                end
                                                                                                                
                                                                                                                code[re_, im_] := N[(N[(re * 0.5), $MachinePrecision] * 2.0), $MachinePrecision]
                                                                                                                
                                                                                                                \begin{array}{l}
                                                                                                                
                                                                                                                \\
                                                                                                                \left(re \cdot 0.5\right) \cdot 2
                                                                                                                \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 \left(\frac{1}{2} \cdot \sin re\right) \cdot \color{blue}{2} \]
                                                                                                                4. Step-by-step derivation
                                                                                                                  1. Applied rewrites46.8%

                                                                                                                    \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \color{blue}{2} \]
                                                                                                                  2. Taylor expanded in re around 0

                                                                                                                    \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot 2 \]
                                                                                                                  3. Step-by-step derivation
                                                                                                                    1. *-commutativeN/A

                                                                                                                      \[\leadsto \color{blue}{\left(re \cdot \frac{1}{2}\right)} \cdot 2 \]
                                                                                                                    2. lower-*.f6424.1

                                                                                                                      \[\leadsto \color{blue}{\left(re \cdot 0.5\right)} \cdot 2 \]
                                                                                                                  4. Applied rewrites24.1%

                                                                                                                    \[\leadsto \color{blue}{\left(re \cdot 0.5\right)} \cdot 2 \]
                                                                                                                  5. Add Preprocessing

                                                                                                                  Reproduce

                                                                                                                  ?
                                                                                                                  herbie shell --seed 2024358 
                                                                                                                  (FPCore (re im)
                                                                                                                    :name "math.sin on complex, real part"
                                                                                                                    :precision binary64
                                                                                                                    (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))))