math.sin on complex, real part

Percentage Accurate: 100.0% → 100.0%
Time: 3.9s
Alternatives: 12
Speedup: 1.4×

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}

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 12 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.4× 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. Step-by-step derivation
    1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\sin re} \cdot \cosh im \]
  7. Step-by-step derivation
    1. lift-sin.f64100.0

      \[\leadsto \sin re \cdot \cosh im \]
  8. Applied rewrites100.0%

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

Alternative 2: 87.1% accurate, 0.4× speedup?

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

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

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

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


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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    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. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\sin re} \cdot \cosh im \]
    7. Step-by-step derivation
      1. lift-sin.f64100.0

        \[\leadsto \sin re \cdot \cosh im \]
    8. Applied rewrites100.0%

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

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

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

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

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

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

        \[\leadsto \sin re \cdot \mathsf{fma}\left(im \cdot im, 0.5, 1\right) \]
    11. Applied rewrites75.8%

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

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

    1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{re} \cdot \cosh im \]
    7. Step-by-step derivation
      1. Applied rewrites62.2%

        \[\leadsto \color{blue}{re} \cdot \cosh im \]
    8. Recombined 3 regimes into one program.
    9. Add Preprocessing

    Alternative 3: 86.7% accurate, 0.4× speedup?

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

      1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      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. Step-by-step derivation
        1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\sin re} \cdot \cosh im \]
      7. Step-by-step derivation
        1. lift-sin.f64100.0

          \[\leadsto \sin re \cdot \cosh im \]
      8. Applied rewrites100.0%

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

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

          \[\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. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{re} \cdot \cosh im \]
        7. Step-by-step derivation
          1. Applied rewrites62.2%

            \[\leadsto \color{blue}{re} \cdot \cosh im \]
        8. Recombined 3 regimes into one program.
        9. Add Preprocessing

        Alternative 4: 62.2% accurate, 0.7× speedup?

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          1. Initial program 100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{re} \cdot \cosh im \]
          7. Step-by-step derivation
            1. Applied rewrites62.2%

              \[\leadsto \color{blue}{re} \cdot \cosh im \]
          8. Recombined 2 regimes into one program.
          9. Add Preprocessing

          Alternative 5: 62.2% accurate, 0.7× speedup?

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

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

                \[\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} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right)\right)} \cdot 2 \]
              3. Step-by-step derivation
                1. *-commutativeN/A

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

                  \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot 2 \]
              4. Applied rewrites35.5%

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

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

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

                  \[\leadsto \left({re}^{7} \cdot \frac{-1}{10080}\right) \cdot 2 \]
                3. lower-pow.f6412.7

                  \[\leadsto \left({re}^{7} \cdot -9.92063492063492 \cdot 10^{-5}\right) \cdot 2 \]
              7. Applied rewrites12.7%

                \[\leadsto \left({re}^{7} \cdot \color{blue}{-9.92063492063492 \cdot 10^{-5}}\right) \cdot 2 \]

              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. Step-by-step derivation
                1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{re} \cdot \cosh im \]
              7. Step-by-step derivation
                1. Applied rewrites62.2%

                  \[\leadsto \color{blue}{re} \cdot \cosh im \]
              8. Recombined 2 regimes into one program.
              9. Add Preprocessing

              Alternative 6: 48.8% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \leq -0.05:\\ \;\;\;\;\left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot 2\\ \mathbf{else}:\\ \;\;\;\;re \cdot \cosh im\\ \end{array} \end{array} \]
              (FPCore (re im)
               :precision binary64
               (if (<= (* (* 0.5 (sin re)) (+ (exp (- 0.0 im)) (exp im))) -0.05)
                 (* (* (fma -0.08333333333333333 (* re re) 0.5) re) 2.0)
                 (* re (cosh im))))
              double code(double re, double im) {
              	double tmp;
              	if (((0.5 * sin(re)) * (exp((0.0 - im)) + exp(im))) <= -0.05) {
              		tmp = (fma(-0.08333333333333333, (re * re), 0.5) * re) * 2.0;
              	} else {
              		tmp = re * cosh(im);
              	}
              	return tmp;
              }
              
              function code(re, im)
              	tmp = 0.0
              	if (Float64(Float64(0.5 * sin(re)) * Float64(exp(Float64(0.0 - im)) + exp(im))) <= -0.05)
              		tmp = Float64(Float64(fma(-0.08333333333333333, Float64(re * re), 0.5) * re) * 2.0);
              	else
              		tmp = Float64(re * cosh(im));
              	end
              	return tmp
              end
              
              code[re_, im_] := If[LessEqual[N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Exp[N[(0.0 - im), $MachinePrecision]], $MachinePrecision] + N[Exp[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -0.05], N[(N[(N[(-0.08333333333333333 * N[(re * re), $MachinePrecision] + 0.5), $MachinePrecision] * re), $MachinePrecision] * 2.0), $MachinePrecision], N[(re * N[Cosh[im], $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;\left(0.5 \cdot \sin re\right) \cdot \left(e^{0 - im} + e^{im}\right) \leq -0.05:\\
              \;\;\;\;\left(\mathsf{fma}\left(-0.08333333333333333, re \cdot re, 0.5\right) \cdot re\right) \cdot 2\\
              
              \mathbf{else}:\\
              \;\;\;\;re \cdot \cosh im\\
              
              
              \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. Taylor expanded in im around 0

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

                    \[\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} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right)\right)} \cdot 2 \]
                  3. Step-by-step derivation
                    1. *-commutativeN/A

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

                      \[\leadsto \left(\left(\frac{1}{2} + {re}^{2} \cdot \left({re}^{2} \cdot \left(\frac{1}{240} + \frac{-1}{10080} \cdot {re}^{2}\right) - \frac{1}{12}\right)\right) \cdot \color{blue}{re}\right) \cdot 2 \]
                  4. Applied rewrites35.5%

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

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

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

                    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. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{re} \cdot \cosh im \]
                    7. Step-by-step derivation
                      1. Applied rewrites62.2%

                        \[\leadsto \color{blue}{re} \cdot \cosh im \]
                    8. Recombined 2 regimes into one program.
                    9. Add Preprocessing

                    Alternative 7: 47.7% accurate, 4.4× speedup?

                    \[\begin{array}{l} \\ re \cdot \cosh im \end{array} \]
                    (FPCore (re im) :precision binary64 (* re (cosh im)))
                    double code(double re, double im) {
                    	return 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 = re * cosh(im)
                    end function
                    
                    public static double code(double re, double im) {
                    	return re * Math.cosh(im);
                    }
                    
                    def code(re, im):
                    	return re * math.cosh(im)
                    
                    function code(re, im)
                    	return Float64(re * cosh(im))
                    end
                    
                    function tmp = code(re, im)
                    	tmp = re * cosh(im);
                    end
                    
                    code[re_, im_] := N[(re * N[Cosh[im], $MachinePrecision]), $MachinePrecision]
                    
                    \begin{array}{l}
                    
                    \\
                    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. Step-by-step derivation
                      1. lift-+.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \color{blue}{re} \cdot \cosh im \]
                    7. Step-by-step derivation
                      1. Applied rewrites62.2%

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

                      Alternative 8: 47.0% accurate, 5.4× speedup?

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        7. sub-to-multN/A

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. metadata-evalN/A

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        4. metadata-evalN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        5. exp-prodN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        6. sub-to-multN/A

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

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        8. mul-1-negN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. mul-1-negN/A

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

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

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

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

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

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

                          \[\leadsto \left(\mathsf{fma}\left(im \cdot \frac{1}{2} + 1, im, 2\right) \cdot re\right) \cdot \frac{1}{2} \]
                        16. lower-fma.f6446.5

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

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

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

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

                          \[\leadsto \left(\left(im \cdot im + 2\right) \cdot re\right) \cdot \frac{1}{2} \]
                        3. lower-fma.f6447.0

                          \[\leadsto \left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot 0.5 \]
                      10. Applied rewrites47.0%

                        \[\leadsto \left(\mathsf{fma}\left(im, im, 2\right) \cdot re\right) \cdot 0.5 \]
                      11. Add Preprocessing

                      Alternative 9: 47.0% accurate, 5.4× speedup?

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        7. sub-to-multN/A

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. metadata-evalN/A

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        4. metadata-evalN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        5. exp-prodN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        6. sub-to-multN/A

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

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        8. mul-1-negN/A

                          \[\leadsto \left(\left(2 + im \cdot \left(1 + \frac{1}{2} \cdot im\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. mul-1-negN/A

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

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

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

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

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

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

                          \[\leadsto \left(\mathsf{fma}\left(im \cdot \frac{1}{2} + 1, im, 2\right) \cdot re\right) \cdot \frac{1}{2} \]
                        16. lower-fma.f6446.5

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

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

                        \[\leadsto re + \color{blue}{\frac{1}{2} \cdot \left({im}^{2} \cdot re\right)} \]
                      9. Step-by-step derivation
                        1. associate-*l*N/A

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

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

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

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

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

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

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

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

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

                          \[\leadsto re + \frac{1}{2} \cdot \left({im}^{2} \cdot re\right) \]
                        11. sub-flipN/A

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(\left(im \cdot im\right) \cdot re, 0.5, re\right) \]
                      10. Applied rewrites47.0%

                        \[\leadsto \mathsf{fma}\left(\left(im \cdot im\right) \cdot re, \color{blue}{0.5}, re\right) \]
                      11. Add Preprocessing

                      Alternative 10: 31.4% accurate, 0.9× speedup?

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

                        1. Initial program 100.0%

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

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

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

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

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

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

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

                            \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                          7. sub-to-multN/A

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

                            \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                          9. metadata-evalN/A

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

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

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

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

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

                          \[\leadsto \left(2 \cdot re\right) \cdot \frac{1}{2} \]
                        6. Step-by-step derivation
                          1. count-2-revN/A

                            \[\leadsto \left(re + re\right) \cdot \frac{1}{2} \]
                          2. lower-+.f6425.8

                            \[\leadsto \left(re + re\right) \cdot 0.5 \]
                        7. Applied rewrites25.8%

                          \[\leadsto \left(re + re\right) \cdot 0.5 \]

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

                        1. Initial program 100.0%

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

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

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

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

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

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

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

                            \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                          7. sub-to-multN/A

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

                            \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                          9. metadata-evalN/A

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{fma}\left(im \cdot re, 0.5, re\right) \]
                        7. Applied rewrites31.4%

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

                          \[\leadsto \frac{1}{2} \cdot \left(im \cdot \color{blue}{re}\right) \]
                        9. Step-by-step derivation
                          1. associate-*r*N/A

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

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

                            \[\leadsto \left(im \cdot \frac{1}{2}\right) \cdot re \]
                          4. lower-*.f649.7

                            \[\leadsto \left(im \cdot 0.5\right) \cdot re \]
                        10. Applied rewrites9.7%

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

                      Alternative 11: 28.8% accurate, 7.2× speedup?

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        7. sub-to-multN/A

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. metadata-evalN/A

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{fma}\left(im \cdot re, 0.5, re\right) \]
                      7. Applied rewrites31.4%

                        \[\leadsto \mathsf{fma}\left(im \cdot re, \color{blue}{0.5}, re\right) \]
                      8. Add Preprocessing

                      Alternative 12: 25.8% accurate, 9.6× speedup?

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

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

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

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

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

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

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

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left(e^{0 - im}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        7. sub-to-multN/A

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

                          \[\leadsto \left(\left(e^{im} - \left(\mathsf{neg}\left({\left(e^{1 - \frac{im}{0}}\right)}^{0}\right)\right)\right) \cdot re\right) \cdot \frac{1}{2} \]
                        9. metadata-evalN/A

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

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

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

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

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

                        \[\leadsto \left(2 \cdot re\right) \cdot \frac{1}{2} \]
                      6. Step-by-step derivation
                        1. count-2-revN/A

                          \[\leadsto \left(re + re\right) \cdot \frac{1}{2} \]
                        2. lower-+.f6425.8

                          \[\leadsto \left(re + re\right) \cdot 0.5 \]
                      7. Applied rewrites25.8%

                        \[\leadsto \left(re + re\right) \cdot 0.5 \]
                      8. Add Preprocessing

                      Reproduce

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