math.cos on complex, imaginary part

Percentage Accurate: 65.6% → 99.9%
Time: 4.9s
Alternatives: 12
Speedup: 1.5×

Specification

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

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

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

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: 65.6% accurate, 1.0× speedup?

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

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

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

Alternative 1: 99.9% accurate, 1.5× speedup?

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

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

real(8) function code(re, im)
use fmin_fmax_functions
    real(8), intent (in) :: re
    real(8), intent (in) :: im
    code = sinh(-im) * sin(re)
end function
public static double code(double re, double im) {
	return Math.sinh(-im) * Math.sin(re);
}
def code(re, im):
	return math.sinh(-im) * math.sin(re)
function code(re, im)
	return Float64(sinh(Float64(-im)) * sin(re))
end
function tmp = code(re, im)
	tmp = sinh(-im) * sin(re);
end
code[re_, im_] := N[(N[Sinh[(-im)], $MachinePrecision] * N[Sin[re], $MachinePrecision]), $MachinePrecision]
\sinh \left(-im\right) \cdot \sin re
Derivation
  1. Initial program 65.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \left(\mathsf{neg}\left(\color{blue}{\sinh im}\right)\right) \cdot \sin re \]
    14. sinh-negN/A

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

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

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

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

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

Alternative 2: 93.9% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left|im\right| \cdot \left|im\right|\\ t_1 := \left(\left(t\_0 \cdot -0.016666666666666666 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 1\\ \mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;\left|im\right| \leq 23000000000:\\ \;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(\left(1 - \frac{1}{t\_1}\right) \cdot \left(t\_1 \cdot \left|im\right|\right)\right)\\ \mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\ \;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot t\_0 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
  :precision binary64
  (let* ((t_0 (* (fabs im) (fabs im)))
       (t_1
        (-
         (*
          (*
           (- (* t_0 -0.016666666666666666) 0.3333333333333333)
           (fabs im))
          (fabs im))
         1.0)))
  (*
   (copysign 1.0 im)
   (if (<= (fabs im) 23000000000.0)
     (* (* (sin re) 0.5) (* (- 1.0 (/ 1.0 t_1)) (* t_1 (fabs im))))
     (if (<= (fabs im) 1.02e+62)
       (*
        -1.0
        (*
         (fabs im)
         (*
          (* re (* (* (- 1.0 (/ 6.0 (* re re))) re) re))
          -0.16666666666666666)))
       (*
        (* 0.5 (sin re))
        (*
         (fabs im)
         (-
          (*
           (*
            (- (* -0.016666666666666666 t_0) 0.3333333333333333)
            (fabs im))
           (fabs im))
          2.0))))))))
double code(double re, double im) {
	double t_0 = fabs(im) * fabs(im);
	double t_1 = ((((t_0 * -0.016666666666666666) - 0.3333333333333333) * fabs(im)) * fabs(im)) - 1.0;
	double tmp;
	if (fabs(im) <= 23000000000.0) {
		tmp = (sin(re) * 0.5) * ((1.0 - (1.0 / t_1)) * (t_1 * fabs(im)));
	} else if (fabs(im) <= 1.02e+62) {
		tmp = -1.0 * (fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = (0.5 * sin(re)) * (fabs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * fabs(im)) * fabs(im)) - 2.0));
	}
	return copysign(1.0, im) * tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.abs(im) * Math.abs(im);
	double t_1 = ((((t_0 * -0.016666666666666666) - 0.3333333333333333) * Math.abs(im)) * Math.abs(im)) - 1.0;
	double tmp;
	if (Math.abs(im) <= 23000000000.0) {
		tmp = (Math.sin(re) * 0.5) * ((1.0 - (1.0 / t_1)) * (t_1 * Math.abs(im)));
	} else if (Math.abs(im) <= 1.02e+62) {
		tmp = -1.0 * (Math.abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = (0.5 * Math.sin(re)) * (Math.abs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * Math.abs(im)) * Math.abs(im)) - 2.0));
	}
	return Math.copySign(1.0, im) * tmp;
}
def code(re, im):
	t_0 = math.fabs(im) * math.fabs(im)
	t_1 = ((((t_0 * -0.016666666666666666) - 0.3333333333333333) * math.fabs(im)) * math.fabs(im)) - 1.0
	tmp = 0
	if math.fabs(im) <= 23000000000.0:
		tmp = (math.sin(re) * 0.5) * ((1.0 - (1.0 / t_1)) * (t_1 * math.fabs(im)))
	elif math.fabs(im) <= 1.02e+62:
		tmp = -1.0 * (math.fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666))
	else:
		tmp = (0.5 * math.sin(re)) * (math.fabs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * math.fabs(im)) * math.fabs(im)) - 2.0))
	return math.copysign(1.0, im) * tmp
function code(re, im)
	t_0 = Float64(abs(im) * abs(im))
	t_1 = Float64(Float64(Float64(Float64(Float64(t_0 * -0.016666666666666666) - 0.3333333333333333) * abs(im)) * abs(im)) - 1.0)
	tmp = 0.0
	if (abs(im) <= 23000000000.0)
		tmp = Float64(Float64(sin(re) * 0.5) * Float64(Float64(1.0 - Float64(1.0 / t_1)) * Float64(t_1 * abs(im))));
	elseif (abs(im) <= 1.02e+62)
		tmp = Float64(-1.0 * Float64(abs(im) * Float64(Float64(re * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(re * re))) * re) * re)) * -0.16666666666666666)));
	else
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(abs(im) * Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * t_0) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0)));
	end
	return Float64(copysign(1.0, im) * tmp)
end
function tmp_2 = code(re, im)
	t_0 = abs(im) * abs(im);
	t_1 = ((((t_0 * -0.016666666666666666) - 0.3333333333333333) * abs(im)) * abs(im)) - 1.0;
	tmp = 0.0;
	if (abs(im) <= 23000000000.0)
		tmp = (sin(re) * 0.5) * ((1.0 - (1.0 / t_1)) * (t_1 * abs(im)));
	elseif (abs(im) <= 1.02e+62)
		tmp = -1.0 * (abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	else
		tmp = (0.5 * sin(re)) * (abs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0));
	end
	tmp_2 = (sign(im) * abs(1.0)) * tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(N[(t$95$0 * -0.016666666666666666), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[im], $MachinePrecision], 23000000000.0], N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(1.0 - N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] * N[(t$95$1 * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[im], $MachinePrecision], 1.02e+62], N[(-1.0 * N[(N[Abs[im], $MachinePrecision] * N[(N[(re * N[(N[(N[(1.0 - N[(6.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[im], $MachinePrecision] * N[(N[(N[(N[(N[(-0.016666666666666666 * t$95$0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|im\right| \cdot \left|im\right|\\
t_1 := \left(\left(t\_0 \cdot -0.016666666666666666 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 1\\
\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|im\right| \leq 23000000000:\\
\;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(\left(1 - \frac{1}{t\_1}\right) \cdot \left(t\_1 \cdot \left|im\right|\right)\right)\\

\mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot t\_0 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\


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

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. lower-*.f6490.8%

        \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
    6. Applied rewrites90.8%

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

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

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

    if 2.3e10 < im < 1.02e62

    1. Initial program 65.6%

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
      3. lower-sin.f6452.0%

        \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
    4. Applied rewrites52.0%

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
      4. lower-pow.f6435.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
    7. Applied rewrites35.5%

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
      8. lower-unsound-/.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      11. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
      12. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      14. lower-*.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      17. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
      18. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      20. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
    9. Applied rewrites23.5%

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
    11. Applied rewrites35.6%

      \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right) \]

    if 1.02e62 < im

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left(\left(\left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right)\right) \]
      8. lift-pow.f64N/A

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

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

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

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

Alternative 3: 93.9% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left(\left(-0.016666666666666666 \cdot \left(\left|im\right| \cdot \left|im\right|\right) - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right|\\ t_1 := t\_0 - 1\\ t_2 := 0.5 \cdot \sin re\\ \mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;\left|im\right| \leq 23000000000:\\ \;\;\;\;t\_2 \cdot \left(\left|im\right| \cdot \left(\left(1 - \frac{1}{t\_1}\right) \cdot t\_1\right)\right)\\ \mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\ \;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_2 \cdot \left(\left|im\right| \cdot \left(t\_0 - 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
  :precision binary64
  (let* ((t_0
        (*
         (*
          (-
           (* -0.016666666666666666 (* (fabs im) (fabs im)))
           0.3333333333333333)
          (fabs im))
         (fabs im)))
       (t_1 (- t_0 1.0))
       (t_2 (* 0.5 (sin re))))
  (*
   (copysign 1.0 im)
   (if (<= (fabs im) 23000000000.0)
     (* t_2 (* (fabs im) (* (- 1.0 (/ 1.0 t_1)) t_1)))
     (if (<= (fabs im) 1.02e+62)
       (*
        -1.0
        (*
         (fabs im)
         (*
          (* re (* (* (- 1.0 (/ 6.0 (* re re))) re) re))
          -0.16666666666666666)))
       (* t_2 (* (fabs im) (- t_0 2.0))))))))
double code(double re, double im) {
	double t_0 = (((-0.016666666666666666 * (fabs(im) * fabs(im))) - 0.3333333333333333) * fabs(im)) * fabs(im);
	double t_1 = t_0 - 1.0;
	double t_2 = 0.5 * sin(re);
	double tmp;
	if (fabs(im) <= 23000000000.0) {
		tmp = t_2 * (fabs(im) * ((1.0 - (1.0 / t_1)) * t_1));
	} else if (fabs(im) <= 1.02e+62) {
		tmp = -1.0 * (fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_2 * (fabs(im) * (t_0 - 2.0));
	}
	return copysign(1.0, im) * tmp;
}
public static double code(double re, double im) {
	double t_0 = (((-0.016666666666666666 * (Math.abs(im) * Math.abs(im))) - 0.3333333333333333) * Math.abs(im)) * Math.abs(im);
	double t_1 = t_0 - 1.0;
	double t_2 = 0.5 * Math.sin(re);
	double tmp;
	if (Math.abs(im) <= 23000000000.0) {
		tmp = t_2 * (Math.abs(im) * ((1.0 - (1.0 / t_1)) * t_1));
	} else if (Math.abs(im) <= 1.02e+62) {
		tmp = -1.0 * (Math.abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_2 * (Math.abs(im) * (t_0 - 2.0));
	}
	return Math.copySign(1.0, im) * tmp;
}
def code(re, im):
	t_0 = (((-0.016666666666666666 * (math.fabs(im) * math.fabs(im))) - 0.3333333333333333) * math.fabs(im)) * math.fabs(im)
	t_1 = t_0 - 1.0
	t_2 = 0.5 * math.sin(re)
	tmp = 0
	if math.fabs(im) <= 23000000000.0:
		tmp = t_2 * (math.fabs(im) * ((1.0 - (1.0 / t_1)) * t_1))
	elif math.fabs(im) <= 1.02e+62:
		tmp = -1.0 * (math.fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666))
	else:
		tmp = t_2 * (math.fabs(im) * (t_0 - 2.0))
	return math.copysign(1.0, im) * tmp
function code(re, im)
	t_0 = Float64(Float64(Float64(Float64(-0.016666666666666666 * Float64(abs(im) * abs(im))) - 0.3333333333333333) * abs(im)) * abs(im))
	t_1 = Float64(t_0 - 1.0)
	t_2 = Float64(0.5 * sin(re))
	tmp = 0.0
	if (abs(im) <= 23000000000.0)
		tmp = Float64(t_2 * Float64(abs(im) * Float64(Float64(1.0 - Float64(1.0 / t_1)) * t_1)));
	elseif (abs(im) <= 1.02e+62)
		tmp = Float64(-1.0 * Float64(abs(im) * Float64(Float64(re * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(re * re))) * re) * re)) * -0.16666666666666666)));
	else
		tmp = Float64(t_2 * Float64(abs(im) * Float64(t_0 - 2.0)));
	end
	return Float64(copysign(1.0, im) * tmp)
end
function tmp_2 = code(re, im)
	t_0 = (((-0.016666666666666666 * (abs(im) * abs(im))) - 0.3333333333333333) * abs(im)) * abs(im);
	t_1 = t_0 - 1.0;
	t_2 = 0.5 * sin(re);
	tmp = 0.0;
	if (abs(im) <= 23000000000.0)
		tmp = t_2 * (abs(im) * ((1.0 - (1.0 / t_1)) * t_1));
	elseif (abs(im) <= 1.02e+62)
		tmp = -1.0 * (abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	else
		tmp = t_2 * (abs(im) * (t_0 - 2.0));
	end
	tmp_2 = (sign(im) * abs(1.0)) * tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[(N[(-0.016666666666666666 * N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[im], $MachinePrecision], 23000000000.0], N[(t$95$2 * N[(N[Abs[im], $MachinePrecision] * N[(N[(1.0 - N[(1.0 / t$95$1), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[im], $MachinePrecision], 1.02e+62], N[(-1.0 * N[(N[Abs[im], $MachinePrecision] * N[(N[(re * N[(N[(N[(1.0 - N[(6.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$2 * N[(N[Abs[im], $MachinePrecision] * N[(t$95$0 - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]]
\begin{array}{l}
t_0 := \left(\left(-0.016666666666666666 \cdot \left(\left|im\right| \cdot \left|im\right|\right) - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right|\\
t_1 := t\_0 - 1\\
t_2 := 0.5 \cdot \sin re\\
\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|im\right| \leq 23000000000:\\
\;\;\;\;t\_2 \cdot \left(\left|im\right| \cdot \left(\left(1 - \frac{1}{t\_1}\right) \cdot t\_1\right)\right)\\

\mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_2 \cdot \left(\left|im\right| \cdot \left(t\_0 - 2\right)\right)\\


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

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

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

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

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

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

    if 2.3e10 < im < 1.02e62

    1. Initial program 65.6%

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
      3. lower-sin.f6452.0%

        \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
    4. Applied rewrites52.0%

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
      4. lower-pow.f6435.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
    7. Applied rewrites35.5%

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
      8. lower-unsound-/.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      11. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
      12. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      14. lower-*.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      17. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
      18. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      20. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
    9. Applied rewrites23.5%

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
    11. Applied rewrites35.6%

      \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right) \]

    if 1.02e62 < im

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left(\left(\left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right)\right) \]
      8. lift-pow.f64N/A

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

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

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

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

Alternative 4: 93.9% accurate, 1.0× speedup?

\[\begin{array}{l} t_0 := \left|im\right| \cdot \left|im\right|\\ t_1 := 0.016666666666666666 \cdot t\_0\\ \mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;\left|im\right| \leq 23000000000:\\ \;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - \frac{t\_1 \cdot t\_1 - 0.3333333333333333 \cdot 0.3333333333333333}{t\_1 - 0.3333333333333333} \cdot t\_0\right) \cdot \left|im\right|\right)\\ \mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\ \;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot t\_0 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\ \end{array} \end{array} \]
(FPCore (re im)
  :precision binary64
  (let* ((t_0 (* (fabs im) (fabs im)))
       (t_1 (* 0.016666666666666666 t_0)))
  (*
   (copysign 1.0 im)
   (if (<= (fabs im) 23000000000.0)
     (*
      (* (sin re) 0.5)
      (*
       (-
        -2.0
        (*
         (/
          (- (* t_1 t_1) (* 0.3333333333333333 0.3333333333333333))
          (- t_1 0.3333333333333333))
         t_0))
       (fabs im)))
     (if (<= (fabs im) 1.02e+62)
       (*
        -1.0
        (*
         (fabs im)
         (*
          (* re (* (* (- 1.0 (/ 6.0 (* re re))) re) re))
          -0.16666666666666666)))
       (*
        (* 0.5 (sin re))
        (*
         (fabs im)
         (-
          (*
           (*
            (- (* -0.016666666666666666 t_0) 0.3333333333333333)
            (fabs im))
           (fabs im))
          2.0))))))))
double code(double re, double im) {
	double t_0 = fabs(im) * fabs(im);
	double t_1 = 0.016666666666666666 * t_0;
	double tmp;
	if (fabs(im) <= 23000000000.0) {
		tmp = (sin(re) * 0.5) * ((-2.0 - ((((t_1 * t_1) - (0.3333333333333333 * 0.3333333333333333)) / (t_1 - 0.3333333333333333)) * t_0)) * fabs(im));
	} else if (fabs(im) <= 1.02e+62) {
		tmp = -1.0 * (fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = (0.5 * sin(re)) * (fabs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * fabs(im)) * fabs(im)) - 2.0));
	}
	return copysign(1.0, im) * tmp;
}
public static double code(double re, double im) {
	double t_0 = Math.abs(im) * Math.abs(im);
	double t_1 = 0.016666666666666666 * t_0;
	double tmp;
	if (Math.abs(im) <= 23000000000.0) {
		tmp = (Math.sin(re) * 0.5) * ((-2.0 - ((((t_1 * t_1) - (0.3333333333333333 * 0.3333333333333333)) / (t_1 - 0.3333333333333333)) * t_0)) * Math.abs(im));
	} else if (Math.abs(im) <= 1.02e+62) {
		tmp = -1.0 * (Math.abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = (0.5 * Math.sin(re)) * (Math.abs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * Math.abs(im)) * Math.abs(im)) - 2.0));
	}
	return Math.copySign(1.0, im) * tmp;
}
def code(re, im):
	t_0 = math.fabs(im) * math.fabs(im)
	t_1 = 0.016666666666666666 * t_0
	tmp = 0
	if math.fabs(im) <= 23000000000.0:
		tmp = (math.sin(re) * 0.5) * ((-2.0 - ((((t_1 * t_1) - (0.3333333333333333 * 0.3333333333333333)) / (t_1 - 0.3333333333333333)) * t_0)) * math.fabs(im))
	elif math.fabs(im) <= 1.02e+62:
		tmp = -1.0 * (math.fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666))
	else:
		tmp = (0.5 * math.sin(re)) * (math.fabs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * math.fabs(im)) * math.fabs(im)) - 2.0))
	return math.copysign(1.0, im) * tmp
function code(re, im)
	t_0 = Float64(abs(im) * abs(im))
	t_1 = Float64(0.016666666666666666 * t_0)
	tmp = 0.0
	if (abs(im) <= 23000000000.0)
		tmp = Float64(Float64(sin(re) * 0.5) * Float64(Float64(-2.0 - Float64(Float64(Float64(Float64(t_1 * t_1) - Float64(0.3333333333333333 * 0.3333333333333333)) / Float64(t_1 - 0.3333333333333333)) * t_0)) * abs(im)));
	elseif (abs(im) <= 1.02e+62)
		tmp = Float64(-1.0 * Float64(abs(im) * Float64(Float64(re * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(re * re))) * re) * re)) * -0.16666666666666666)));
	else
		tmp = Float64(Float64(0.5 * sin(re)) * Float64(abs(im) * Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * t_0) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0)));
	end
	return Float64(copysign(1.0, im) * tmp)
end
function tmp_2 = code(re, im)
	t_0 = abs(im) * abs(im);
	t_1 = 0.016666666666666666 * t_0;
	tmp = 0.0;
	if (abs(im) <= 23000000000.0)
		tmp = (sin(re) * 0.5) * ((-2.0 - ((((t_1 * t_1) - (0.3333333333333333 * 0.3333333333333333)) / (t_1 - 0.3333333333333333)) * t_0)) * abs(im));
	elseif (abs(im) <= 1.02e+62)
		tmp = -1.0 * (abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	else
		tmp = (0.5 * sin(re)) * (abs(im) * (((((-0.016666666666666666 * t_0) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0));
	end
	tmp_2 = (sign(im) * abs(1.0)) * tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(0.016666666666666666 * t$95$0), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[im], $MachinePrecision], 23000000000.0], N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(-2.0 - N[(N[(N[(N[(t$95$1 * t$95$1), $MachinePrecision] - N[(0.3333333333333333 * 0.3333333333333333), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - 0.3333333333333333), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[Abs[im], $MachinePrecision], 1.02e+62], N[(-1.0 * N[(N[Abs[im], $MachinePrecision] * N[(N[(re * N[(N[(N[(1.0 - N[(6.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[im], $MachinePrecision] * N[(N[(N[(N[(N[(-0.016666666666666666 * t$95$0), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]]]
\begin{array}{l}
t_0 := \left|im\right| \cdot \left|im\right|\\
t_1 := 0.016666666666666666 \cdot t\_0\\
\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|im\right| \leq 23000000000:\\
\;\;\;\;\left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - \frac{t\_1 \cdot t\_1 - 0.3333333333333333 \cdot 0.3333333333333333}{t\_1 - 0.3333333333333333} \cdot t\_0\right) \cdot \left|im\right|\right)\\

\mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot t\_0 - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\


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

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. lower-*.f6490.8%

        \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
    6. Applied rewrites90.8%

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

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \left(\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) + \frac{1}{3}\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      4. flip-+N/A

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

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

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \frac{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) \cdot \left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3} \cdot \frac{1}{3}}{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3}} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      9. distribute-lft-neg-outN/A

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \frac{\left(\frac{1}{60} \cdot \left(im \cdot im\right)\right) \cdot \left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3} \cdot \frac{1}{3}}{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3}} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      12. lift-*.f64N/A

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \frac{\left(\frac{1}{60} \cdot \left(im \cdot im\right)\right) \cdot \left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3} \cdot \frac{1}{3}}{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3}} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      13. distribute-lft-neg-outN/A

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \frac{\left(\frac{1}{60} \cdot \left(im \cdot im\right)\right) \cdot \left(\left(\mathsf{neg}\left(\frac{-1}{60}\right)\right) \cdot \left(im \cdot im\right)\right) - \frac{1}{3} \cdot \frac{1}{3}}{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3}} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      15. metadata-evalN/A

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

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left(-2 - \frac{\left(\frac{1}{60} \cdot \left(im \cdot im\right)\right) \cdot \left(\frac{1}{60} \cdot \left(im \cdot im\right)\right) - \frac{1}{3} \cdot \frac{1}{3}}{\left(\mathsf{neg}\left(\frac{-1}{60} \cdot \left(im \cdot im\right)\right)\right) - \frac{1}{3}} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
    8. Applied rewrites65.4%

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

    if 2.3e10 < im < 1.02e62

    1. Initial program 65.6%

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
      3. lower-sin.f6452.0%

        \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
    4. Applied rewrites52.0%

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
      4. lower-pow.f6435.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
    7. Applied rewrites35.5%

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
      8. lower-unsound-/.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      11. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
      12. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      14. lower-*.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      17. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
      18. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      20. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
    9. Applied rewrites23.5%

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
    11. Applied rewrites35.6%

      \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right) \]

    if 1.02e62 < im

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left(\left(\left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right)\right) \]
      8. lift-pow.f64N/A

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

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

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

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

Alternative 5: 93.9% accurate, 1.2× speedup?

\[\begin{array}{l} t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot \left(\left|im\right| \cdot \left|im\right|\right) - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\ \mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;\left|im\right| \leq 23000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\ \;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
  :precision binary64
  (let* ((t_0
        (*
         (* 0.5 (sin re))
         (*
          (fabs im)
          (-
           (*
            (*
             (-
              (* -0.016666666666666666 (* (fabs im) (fabs im)))
              0.3333333333333333)
             (fabs im))
            (fabs im))
           2.0)))))
  (*
   (copysign 1.0 im)
   (if (<= (fabs im) 23000000000.0)
     t_0
     (if (<= (fabs im) 1.02e+62)
       (*
        -1.0
        (*
         (fabs im)
         (*
          (* re (* (* (- 1.0 (/ 6.0 (* re re))) re) re))
          -0.16666666666666666)))
       t_0)))))
double code(double re, double im) {
	double t_0 = (0.5 * sin(re)) * (fabs(im) * (((((-0.016666666666666666 * (fabs(im) * fabs(im))) - 0.3333333333333333) * fabs(im)) * fabs(im)) - 2.0));
	double tmp;
	if (fabs(im) <= 23000000000.0) {
		tmp = t_0;
	} else if (fabs(im) <= 1.02e+62) {
		tmp = -1.0 * (fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return copysign(1.0, im) * tmp;
}
public static double code(double re, double im) {
	double t_0 = (0.5 * Math.sin(re)) * (Math.abs(im) * (((((-0.016666666666666666 * (Math.abs(im) * Math.abs(im))) - 0.3333333333333333) * Math.abs(im)) * Math.abs(im)) - 2.0));
	double tmp;
	if (Math.abs(im) <= 23000000000.0) {
		tmp = t_0;
	} else if (Math.abs(im) <= 1.02e+62) {
		tmp = -1.0 * (Math.abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return Math.copySign(1.0, im) * tmp;
}
def code(re, im):
	t_0 = (0.5 * math.sin(re)) * (math.fabs(im) * (((((-0.016666666666666666 * (math.fabs(im) * math.fabs(im))) - 0.3333333333333333) * math.fabs(im)) * math.fabs(im)) - 2.0))
	tmp = 0
	if math.fabs(im) <= 23000000000.0:
		tmp = t_0
	elif math.fabs(im) <= 1.02e+62:
		tmp = -1.0 * (math.fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666))
	else:
		tmp = t_0
	return math.copysign(1.0, im) * tmp
function code(re, im)
	t_0 = Float64(Float64(0.5 * sin(re)) * Float64(abs(im) * Float64(Float64(Float64(Float64(Float64(-0.016666666666666666 * Float64(abs(im) * abs(im))) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0)))
	tmp = 0.0
	if (abs(im) <= 23000000000.0)
		tmp = t_0;
	elseif (abs(im) <= 1.02e+62)
		tmp = Float64(-1.0 * Float64(abs(im) * Float64(Float64(re * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(re * re))) * re) * re)) * -0.16666666666666666)));
	else
		tmp = t_0;
	end
	return Float64(copysign(1.0, im) * tmp)
end
function tmp_2 = code(re, im)
	t_0 = (0.5 * sin(re)) * (abs(im) * (((((-0.016666666666666666 * (abs(im) * abs(im))) - 0.3333333333333333) * abs(im)) * abs(im)) - 2.0));
	tmp = 0.0;
	if (abs(im) <= 23000000000.0)
		tmp = t_0;
	elseif (abs(im) <= 1.02e+62)
		tmp = -1.0 * (abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	else
		tmp = t_0;
	end
	tmp_2 = (sign(im) * abs(1.0)) * tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(0.5 * N[Sin[re], $MachinePrecision]), $MachinePrecision] * N[(N[Abs[im], $MachinePrecision] * N[(N[(N[(N[(N[(-0.016666666666666666 * N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 0.3333333333333333), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision] - 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[im], $MachinePrecision], 23000000000.0], t$95$0, If[LessEqual[N[Abs[im], $MachinePrecision], 1.02e+62], N[(-1.0 * N[(N[Abs[im], $MachinePrecision] * N[(N[(re * N[(N[(N[(1.0 - N[(6.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(0.5 \cdot \sin re\right) \cdot \left(\left|im\right| \cdot \left(\left(\left(-0.016666666666666666 \cdot \left(\left|im\right| \cdot \left|im\right|\right) - 0.3333333333333333\right) \cdot \left|im\right|\right) \cdot \left|im\right| - 2\right)\right)\\
\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|im\right| \leq 23000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\left|im\right| \leq 1.02 \cdot 10^{+62}:\\
\;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 2.3e10 or 1.02e62 < im

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

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

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

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

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

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left(\left(\left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) \cdot im\right) \cdot im - 2\right)\right) \]
      8. lift-pow.f64N/A

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

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

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

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

    if 2.3e10 < im < 1.02e62

    1. Initial program 65.6%

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
      3. lower-sin.f6452.0%

        \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
    4. Applied rewrites52.0%

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
      4. lower-pow.f6435.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
    7. Applied rewrites35.5%

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
      8. lower-unsound-/.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      11. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
      12. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
      14. lower-*.f6423.5%

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      17. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
      18. lift-pow.f64N/A

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

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
      20. lower-*.f6423.5%

        \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
    9. Applied rewrites23.5%

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

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

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

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

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

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

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
    11. Applied rewrites35.6%

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

Alternative 6: 91.7% accurate, 1.2× speedup?

\[\begin{array}{l} t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(\left|im\right| \cdot \left|im\right|\right)\right) \cdot \left|im\right|\right)\\ \mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;\left|im\right| \leq 23000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\left|im\right| \leq 8.2 \cdot 10^{+102}:\\ \;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (re im)
  :precision binary64
  (let* ((t_0
        (*
         (* (sin re) 0.5)
         (*
          (- -2.0 (* 0.3333333333333333 (* (fabs im) (fabs im))))
          (fabs im)))))
  (*
   (copysign 1.0 im)
   (if (<= (fabs im) 23000000000.0)
     t_0
     (if (<= (fabs im) 8.2e+102)
       (*
        -1.0
        (*
         (fabs im)
         (*
          (* re (* (* (- 1.0 (/ 6.0 (* re re))) re) re))
          -0.16666666666666666)))
       t_0)))))
double code(double re, double im) {
	double t_0 = (sin(re) * 0.5) * ((-2.0 - (0.3333333333333333 * (fabs(im) * fabs(im)))) * fabs(im));
	double tmp;
	if (fabs(im) <= 23000000000.0) {
		tmp = t_0;
	} else if (fabs(im) <= 8.2e+102) {
		tmp = -1.0 * (fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return copysign(1.0, im) * tmp;
}
public static double code(double re, double im) {
	double t_0 = (Math.sin(re) * 0.5) * ((-2.0 - (0.3333333333333333 * (Math.abs(im) * Math.abs(im)))) * Math.abs(im));
	double tmp;
	if (Math.abs(im) <= 23000000000.0) {
		tmp = t_0;
	} else if (Math.abs(im) <= 8.2e+102) {
		tmp = -1.0 * (Math.abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	} else {
		tmp = t_0;
	}
	return Math.copySign(1.0, im) * tmp;
}
def code(re, im):
	t_0 = (math.sin(re) * 0.5) * ((-2.0 - (0.3333333333333333 * (math.fabs(im) * math.fabs(im)))) * math.fabs(im))
	tmp = 0
	if math.fabs(im) <= 23000000000.0:
		tmp = t_0
	elif math.fabs(im) <= 8.2e+102:
		tmp = -1.0 * (math.fabs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666))
	else:
		tmp = t_0
	return math.copysign(1.0, im) * tmp
function code(re, im)
	t_0 = Float64(Float64(sin(re) * 0.5) * Float64(Float64(-2.0 - Float64(0.3333333333333333 * Float64(abs(im) * abs(im)))) * abs(im)))
	tmp = 0.0
	if (abs(im) <= 23000000000.0)
		tmp = t_0;
	elseif (abs(im) <= 8.2e+102)
		tmp = Float64(-1.0 * Float64(abs(im) * Float64(Float64(re * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(re * re))) * re) * re)) * -0.16666666666666666)));
	else
		tmp = t_0;
	end
	return Float64(copysign(1.0, im) * tmp)
end
function tmp_2 = code(re, im)
	t_0 = (sin(re) * 0.5) * ((-2.0 - (0.3333333333333333 * (abs(im) * abs(im)))) * abs(im));
	tmp = 0.0;
	if (abs(im) <= 23000000000.0)
		tmp = t_0;
	elseif (abs(im) <= 8.2e+102)
		tmp = -1.0 * (abs(im) * ((re * (((1.0 - (6.0 / (re * re))) * re) * re)) * -0.16666666666666666));
	else
		tmp = t_0;
	end
	tmp_2 = (sign(im) * abs(1.0)) * tmp;
end
code[re_, im_] := Block[{t$95$0 = N[(N[(N[Sin[re], $MachinePrecision] * 0.5), $MachinePrecision] * N[(N[(-2.0 - N[(0.3333333333333333 * N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[Abs[im], $MachinePrecision], 23000000000.0], t$95$0, If[LessEqual[N[Abs[im], $MachinePrecision], 8.2e+102], N[(-1.0 * N[(N[Abs[im], $MachinePrecision] * N[(N[(re * N[(N[(N[(1.0 - N[(6.0 / N[(re * re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * re), $MachinePrecision] * re), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]), $MachinePrecision]]
\begin{array}{l}
t_0 := \left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(\left|im\right| \cdot \left|im\right|\right)\right) \cdot \left|im\right|\right)\\
\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
\mathbf{if}\;\left|im\right| \leq 23000000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\left|im\right| \leq 8.2 \cdot 10^{+102}:\\
\;\;\;\;-1 \cdot \left(\left|im\right| \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right)\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if im < 2.3e10 or 8.1999999999999999e102 < im

    1. Initial program 65.6%

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

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

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

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

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

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

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

        \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
      7. lower-pow.f6490.8%

        \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
    4. Applied rewrites90.8%

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

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

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

        \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. lift-*.f64N/A

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

        \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. lower-*.f6490.8%

        \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
    6. Applied rewrites90.8%

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

      \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - \frac{1}{3} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
    8. Step-by-step derivation
      1. Applied rewrites84.4%

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

      if 2.3e10 < im < 8.1999999999999999e102

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
        4. lower-pow.f6435.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
      7. Applied rewrites35.5%

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

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

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

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
        8. lower-unsound-/.f6423.5%

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
        11. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
        12. lift-pow.f64N/A

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
        14. lower-*.f6423.5%

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
        17. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
        18. lift-pow.f64N/A

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
        20. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
      9. Applied rewrites23.5%

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

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

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
      11. Applied rewrites35.6%

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right) \]
    9. Recombined 2 regimes into one program.
    10. Add Preprocessing

    Alternative 7: 90.0% accurate, 0.3× speedup?

    \[\begin{array}{l} t_0 := \left|im\right| \cdot \left|im\right|\\ t_1 := -\left|im\right|\\ t_2 := \sin \left(\left|re\right|\right)\\ t_3 := \left(0.5 \cdot t\_2\right) \cdot \left(e^{t\_1} - e^{\left|im\right|}\right)\\ \mathsf{copysign}\left(1, re\right) \cdot \left(\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l} \mathbf{if}\;t\_3 \leq -\infty:\\ \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot t\_0\right) \cdot t\_0\right) \cdot \left|im\right|\right)\\ \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-7}:\\ \;\;\;\;t\_2 \cdot t\_1\\ \mathbf{else}:\\ \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot \left|im\right|\\ \end{array}\right) \end{array} \]
    (FPCore (re im)
      :precision binary64
      (let* ((t_0 (* (fabs im) (fabs im)))
           (t_1 (- (fabs im)))
           (t_2 (sin (fabs re)))
           (t_3 (* (* 0.5 t_2) (- (exp t_1) (exp (fabs im))))))
      (*
       (copysign 1.0 re)
       (*
        (copysign 1.0 im)
        (if (<= t_3 (- INFINITY))
          (*
           (* 0.5 (fabs re))
           (*
            (-
             -2.0
             (* (- 0.3333333333333333 (* -0.016666666666666666 t_0)) t_0))
            (fabs im)))
          (if (<= t_3 2e-7)
            (* t_2 t_1)
            (*
             (-
              (*
               (- (* (* (fabs re) (fabs re)) -0.16666666666666666) -1.0)
               (fabs re)))
             (fabs im))))))))
    double code(double re, double im) {
    	double t_0 = fabs(im) * fabs(im);
    	double t_1 = -fabs(im);
    	double t_2 = sin(fabs(re));
    	double t_3 = (0.5 * t_2) * (exp(t_1) - exp(fabs(im)));
    	double tmp;
    	if (t_3 <= -((double) INFINITY)) {
    		tmp = (0.5 * fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * t_0)) * t_0)) * fabs(im));
    	} else if (t_3 <= 2e-7) {
    		tmp = t_2 * t_1;
    	} else {
    		tmp = -((((fabs(re) * fabs(re)) * -0.16666666666666666) - -1.0) * fabs(re)) * fabs(im);
    	}
    	return copysign(1.0, re) * (copysign(1.0, im) * tmp);
    }
    
    public static double code(double re, double im) {
    	double t_0 = Math.abs(im) * Math.abs(im);
    	double t_1 = -Math.abs(im);
    	double t_2 = Math.sin(Math.abs(re));
    	double t_3 = (0.5 * t_2) * (Math.exp(t_1) - Math.exp(Math.abs(im)));
    	double tmp;
    	if (t_3 <= -Double.POSITIVE_INFINITY) {
    		tmp = (0.5 * Math.abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * t_0)) * t_0)) * Math.abs(im));
    	} else if (t_3 <= 2e-7) {
    		tmp = t_2 * t_1;
    	} else {
    		tmp = -((((Math.abs(re) * Math.abs(re)) * -0.16666666666666666) - -1.0) * Math.abs(re)) * Math.abs(im);
    	}
    	return Math.copySign(1.0, re) * (Math.copySign(1.0, im) * tmp);
    }
    
    def code(re, im):
    	t_0 = math.fabs(im) * math.fabs(im)
    	t_1 = -math.fabs(im)
    	t_2 = math.sin(math.fabs(re))
    	t_3 = (0.5 * t_2) * (math.exp(t_1) - math.exp(math.fabs(im)))
    	tmp = 0
    	if t_3 <= -math.inf:
    		tmp = (0.5 * math.fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * t_0)) * t_0)) * math.fabs(im))
    	elif t_3 <= 2e-7:
    		tmp = t_2 * t_1
    	else:
    		tmp = -((((math.fabs(re) * math.fabs(re)) * -0.16666666666666666) - -1.0) * math.fabs(re)) * math.fabs(im)
    	return math.copysign(1.0, re) * (math.copysign(1.0, im) * tmp)
    
    function code(re, im)
    	t_0 = Float64(abs(im) * abs(im))
    	t_1 = Float64(-abs(im))
    	t_2 = sin(abs(re))
    	t_3 = Float64(Float64(0.5 * t_2) * Float64(exp(t_1) - exp(abs(im))))
    	tmp = 0.0
    	if (t_3 <= Float64(-Inf))
    		tmp = Float64(Float64(0.5 * abs(re)) * Float64(Float64(-2.0 - Float64(Float64(0.3333333333333333 - Float64(-0.016666666666666666 * t_0)) * t_0)) * abs(im)));
    	elseif (t_3 <= 2e-7)
    		tmp = Float64(t_2 * t_1);
    	else
    		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re))) * abs(im));
    	end
    	return Float64(copysign(1.0, re) * Float64(copysign(1.0, im) * tmp))
    end
    
    function tmp_2 = code(re, im)
    	t_0 = abs(im) * abs(im);
    	t_1 = -abs(im);
    	t_2 = sin(abs(re));
    	t_3 = (0.5 * t_2) * (exp(t_1) - exp(abs(im)));
    	tmp = 0.0;
    	if (t_3 <= -Inf)
    		tmp = (0.5 * abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * t_0)) * t_0)) * abs(im));
    	elseif (t_3 <= 2e-7)
    		tmp = t_2 * t_1;
    	else
    		tmp = -((((abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re)) * abs(im);
    	end
    	tmp_2 = (sign(re) * abs(1.0)) * ((sign(im) * abs(1.0)) * tmp);
    end
    
    code[re_, im_] := Block[{t$95$0 = N[(N[Abs[im], $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = (-N[Abs[im], $MachinePrecision])}, Block[{t$95$2 = N[Sin[N[Abs[re], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[(0.5 * t$95$2), $MachinePrecision] * N[(N[Exp[t$95$1], $MachinePrecision] - N[Exp[N[Abs[im], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[im]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[t$95$3, (-Infinity)], N[(N[(0.5 * N[Abs[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 - N[(N[(0.3333333333333333 - N[(-0.016666666666666666 * t$95$0), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Abs[im], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 2e-7], N[(t$95$2 * t$95$1), $MachinePrecision], N[((-N[(N[(N[(N[(N[Abs[re], $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - -1.0), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]) * N[Abs[im], $MachinePrecision]), $MachinePrecision]]]), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    t_0 := \left|im\right| \cdot \left|im\right|\\
    t_1 := -\left|im\right|\\
    t_2 := \sin \left(\left|re\right|\right)\\
    t_3 := \left(0.5 \cdot t\_2\right) \cdot \left(e^{t\_1} - e^{\left|im\right|}\right)\\
    \mathsf{copysign}\left(1, re\right) \cdot \left(\mathsf{copysign}\left(1, im\right) \cdot \begin{array}{l}
    \mathbf{if}\;t\_3 \leq -\infty:\\
    \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot t\_0\right) \cdot t\_0\right) \cdot \left|im\right|\right)\\
    
    \mathbf{elif}\;t\_3 \leq 2 \cdot 10^{-7}:\\
    \;\;\;\;t\_2 \cdot t\_1\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot \left|im\right|\\
    
    
    \end{array}\right)
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if (*.f64 (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) (-.f64 (exp.f64 (neg.f64 im)) (exp.f64 im))) < -inf.0

      1. Initial program 65.6%

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
        7. lower-pow.f6490.8%

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. Applied rewrites90.8%

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

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

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

          \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
        4. lift-*.f64N/A

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

          \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        6. lower-*.f6490.8%

          \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. Applied rewrites90.8%

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

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      8. Step-by-step derivation
        1. lower-*.f6457.8%

          \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      9. Applied rewrites57.8%

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

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

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

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

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

          \[\leadsto \sin re \cdot \left(-im\right) \]
        7. lower-*.f6452.0%

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

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

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

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
        4. lower-pow.f6435.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
      7. Applied rewrites35.5%

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

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

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

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

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

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

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

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

    Alternative 8: 67.5% accurate, 1.1× speedup?

    \[\mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq 10^{-305}:\\ \;\;\;\;-1 \cdot \left(im \cdot \left(\left(\left|re\right| \cdot \left(\left(\left(1 - \frac{6}{\left|re\right| \cdot \left|re\right|}\right) \cdot \left|re\right|\right) \cdot \left|re\right|\right)\right) \cdot -0.16666666666666666\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \end{array} \]
    (FPCore (re im)
      :precision binary64
      (*
     (copysign 1.0 re)
     (if (<= (* 0.5 (sin (fabs re))) 1e-305)
       (*
        -1.0
        (*
         im
         (*
          (*
           (fabs re)
           (*
            (* (- 1.0 (/ 6.0 (* (fabs re) (fabs re)))) (fabs re))
            (fabs re)))
          -0.16666666666666666)))
       (*
        (* 0.5 (fabs re))
        (*
         (-
          -2.0
          (*
           (- 0.3333333333333333 (* -0.016666666666666666 (* im im)))
           (* im im)))
         im)))))
    double code(double re, double im) {
    	double tmp;
    	if ((0.5 * sin(fabs(re))) <= 1e-305) {
    		tmp = -1.0 * (im * ((fabs(re) * (((1.0 - (6.0 / (fabs(re) * fabs(re)))) * fabs(re)) * fabs(re))) * -0.16666666666666666));
    	} else {
    		tmp = (0.5 * fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	}
    	return copysign(1.0, re) * tmp;
    }
    
    public static double code(double re, double im) {
    	double tmp;
    	if ((0.5 * Math.sin(Math.abs(re))) <= 1e-305) {
    		tmp = -1.0 * (im * ((Math.abs(re) * (((1.0 - (6.0 / (Math.abs(re) * Math.abs(re)))) * Math.abs(re)) * Math.abs(re))) * -0.16666666666666666));
    	} else {
    		tmp = (0.5 * Math.abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	}
    	return Math.copySign(1.0, re) * tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if (0.5 * math.sin(math.fabs(re))) <= 1e-305:
    		tmp = -1.0 * (im * ((math.fabs(re) * (((1.0 - (6.0 / (math.fabs(re) * math.fabs(re)))) * math.fabs(re)) * math.fabs(re))) * -0.16666666666666666))
    	else:
    		tmp = (0.5 * math.fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im)
    	return math.copysign(1.0, re) * tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (Float64(0.5 * sin(abs(re))) <= 1e-305)
    		tmp = Float64(-1.0 * Float64(im * Float64(Float64(abs(re) * Float64(Float64(Float64(1.0 - Float64(6.0 / Float64(abs(re) * abs(re)))) * abs(re)) * abs(re))) * -0.16666666666666666)));
    	else
    		tmp = Float64(Float64(0.5 * abs(re)) * Float64(Float64(-2.0 - Float64(Float64(0.3333333333333333 - Float64(-0.016666666666666666 * Float64(im * im))) * Float64(im * im))) * im));
    	end
    	return Float64(copysign(1.0, re) * tmp)
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if ((0.5 * sin(abs(re))) <= 1e-305)
    		tmp = -1.0 * (im * ((abs(re) * (((1.0 - (6.0 / (abs(re) * abs(re)))) * abs(re)) * abs(re))) * -0.16666666666666666));
    	else
    		tmp = (0.5 * abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	end
    	tmp_2 = (sign(re) * abs(1.0)) * tmp;
    end
    
    code[re_, im_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(0.5 * N[Sin[N[Abs[re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-305], N[(-1.0 * N[(im * N[(N[(N[Abs[re], $MachinePrecision] * N[(N[(N[(1.0 - N[(6.0 / N[(N[Abs[re], $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(0.5 * N[Abs[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 - N[(N[(0.3333333333333333 - N[(-0.016666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
    
    \mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l}
    \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq 10^{-305}:\\
    \;\;\;\;-1 \cdot \left(im \cdot \left(\left(\left|re\right| \cdot \left(\left(\left(1 - \frac{6}{\left|re\right| \cdot \left|re\right|}\right) \cdot \left|re\right|\right) \cdot \left|re\right|\right)\right) \cdot -0.16666666666666666\right)\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < 1e-305

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
        4. lower-pow.f6435.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
      7. Applied rewrites35.5%

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

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

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

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\frac{-1}{6} \cdot {re}^{2}}\right) \cdot \left(\frac{-1}{6} \cdot {\color{blue}{re}}^{2}\right)\right)\right)\right) \]
        8. lower-unsound-/.f6423.5%

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
        11. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{{re}^{2} \cdot -0.16666666666666666}\right) \cdot \left(-0.16666666666666666 \cdot {re}^{2}\right)\right)\right)\right) \]
        12. lift-pow.f64N/A

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\frac{-1}{6} \cdot {re}^{2}\right)\right)\right)\right) \]
        14. lower-*.f6423.5%

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left({re}^{2} \cdot \frac{-1}{6}\right)\right)\right)\right) \]
        17. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left({re}^{2} \cdot -0.16666666666666666\right)\right)\right)\right) \]
        18. lift-pow.f64N/A

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(\left(re \cdot re\right) \cdot \frac{-1}{6}\right)\right)\right)\right) \]
        20. lower-*.f6423.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot -0.16666666666666666}\right) \cdot \left(\left(re \cdot re\right) \cdot -0.16666666666666666\right)\right)\right)\right) \]
      9. Applied rewrites23.5%

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

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

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(1 - \frac{-1}{\left(re \cdot re\right) \cdot \frac{-1}{6}}\right) \cdot \left(re \cdot re\right)\right)\right) \cdot \frac{-1}{6}\right)\right) \]
      11. Applied rewrites35.6%

        \[\leadsto -1 \cdot \left(im \cdot \left(\left(re \cdot \left(\left(\left(1 - \frac{6}{re \cdot re}\right) \cdot re\right) \cdot re\right)\right) \cdot -0.16666666666666666\right)\right) \]

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

      1. Initial program 65.6%

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
        7. lower-pow.f6490.8%

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. Applied rewrites90.8%

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

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

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

          \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
        4. lift-*.f64N/A

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

          \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        6. lower-*.f6490.8%

          \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. Applied rewrites90.8%

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

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      8. Step-by-step derivation
        1. lower-*.f6457.8%

          \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      9. Applied rewrites57.8%

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

    Alternative 9: 67.4% accurate, 1.2× speedup?

    \[\mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\ \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \end{array} \]
    (FPCore (re im)
      :precision binary64
      (*
     (copysign 1.0 re)
     (if (<= (* 0.5 (sin (fabs re))) -0.005)
       (*
        (-
         (*
          (- (* (* (fabs re) (fabs re)) -0.16666666666666666) -1.0)
          (fabs re)))
        im)
       (*
        (* 0.5 (fabs re))
        (*
         (-
          -2.0
          (*
           (- 0.3333333333333333 (* -0.016666666666666666 (* im im)))
           (* im im)))
         im)))))
    double code(double re, double im) {
    	double tmp;
    	if ((0.5 * sin(fabs(re))) <= -0.005) {
    		tmp = -((((fabs(re) * fabs(re)) * -0.16666666666666666) - -1.0) * fabs(re)) * im;
    	} else {
    		tmp = (0.5 * fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	}
    	return copysign(1.0, re) * tmp;
    }
    
    public static double code(double re, double im) {
    	double tmp;
    	if ((0.5 * Math.sin(Math.abs(re))) <= -0.005) {
    		tmp = -((((Math.abs(re) * Math.abs(re)) * -0.16666666666666666) - -1.0) * Math.abs(re)) * im;
    	} else {
    		tmp = (0.5 * Math.abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	}
    	return Math.copySign(1.0, re) * tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if (0.5 * math.sin(math.fabs(re))) <= -0.005:
    		tmp = -((((math.fabs(re) * math.fabs(re)) * -0.16666666666666666) - -1.0) * math.fabs(re)) * im
    	else:
    		tmp = (0.5 * math.fabs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im)
    	return math.copysign(1.0, re) * tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (Float64(0.5 * sin(abs(re))) <= -0.005)
    		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re))) * im);
    	else
    		tmp = Float64(Float64(0.5 * abs(re)) * Float64(Float64(-2.0 - Float64(Float64(0.3333333333333333 - Float64(-0.016666666666666666 * Float64(im * im))) * Float64(im * im))) * im));
    	end
    	return Float64(copysign(1.0, re) * tmp)
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if ((0.5 * sin(abs(re))) <= -0.005)
    		tmp = -((((abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re)) * im;
    	else
    		tmp = (0.5 * abs(re)) * ((-2.0 - ((0.3333333333333333 - (-0.016666666666666666 * (im * im))) * (im * im))) * im);
    	end
    	tmp_2 = (sign(re) * abs(1.0)) * tmp;
    end
    
    code[re_, im_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(0.5 * N[Sin[N[Abs[re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.005], N[((-N[(N[(N[(N[(N[Abs[re], $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - -1.0), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]) * im), $MachinePrecision], N[(N[(0.5 * N[Abs[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 - N[(N[(0.3333333333333333 - N[(-0.016666666666666666 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
    
    \mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l}
    \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\
    \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0050000000000000001

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
        4. lower-pow.f6435.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
      7. Applied rewrites35.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 65.6%

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
        7. lower-pow.f6490.8%

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. Applied rewrites90.8%

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

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

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

          \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
        4. lift-*.f64N/A

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

          \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        6. lower-*.f6490.8%

          \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. Applied rewrites90.8%

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

        \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      8. Step-by-step derivation
        1. lower-*.f6457.8%

          \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(-2 - \left(0.3333333333333333 - -0.016666666666666666 \cdot \left(im \cdot im\right)\right) \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      9. Applied rewrites57.8%

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

    Alternative 10: 63.2% accurate, 1.3× speedup?

    \[\mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\ \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\ \end{array} \]
    (FPCore (re im)
      :precision binary64
      (*
     (copysign 1.0 re)
     (if (<= (* 0.5 (sin (fabs re))) -0.005)
       (*
        (-
         (*
          (- (* (* (fabs re) (fabs re)) -0.16666666666666666) -1.0)
          (fabs re)))
        im)
       (*
        (* 0.5 (fabs re))
        (* (- -2.0 (* 0.3333333333333333 (* im im))) im)))))
    double code(double re, double im) {
    	double tmp;
    	if ((0.5 * sin(fabs(re))) <= -0.005) {
    		tmp = -((((fabs(re) * fabs(re)) * -0.16666666666666666) - -1.0) * fabs(re)) * im;
    	} else {
    		tmp = (0.5 * fabs(re)) * ((-2.0 - (0.3333333333333333 * (im * im))) * im);
    	}
    	return copysign(1.0, re) * tmp;
    }
    
    public static double code(double re, double im) {
    	double tmp;
    	if ((0.5 * Math.sin(Math.abs(re))) <= -0.005) {
    		tmp = -((((Math.abs(re) * Math.abs(re)) * -0.16666666666666666) - -1.0) * Math.abs(re)) * im;
    	} else {
    		tmp = (0.5 * Math.abs(re)) * ((-2.0 - (0.3333333333333333 * (im * im))) * im);
    	}
    	return Math.copySign(1.0, re) * tmp;
    }
    
    def code(re, im):
    	tmp = 0
    	if (0.5 * math.sin(math.fabs(re))) <= -0.005:
    		tmp = -((((math.fabs(re) * math.fabs(re)) * -0.16666666666666666) - -1.0) * math.fabs(re)) * im
    	else:
    		tmp = (0.5 * math.fabs(re)) * ((-2.0 - (0.3333333333333333 * (im * im))) * im)
    	return math.copysign(1.0, re) * tmp
    
    function code(re, im)
    	tmp = 0.0
    	if (Float64(0.5 * sin(abs(re))) <= -0.005)
    		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re))) * im);
    	else
    		tmp = Float64(Float64(0.5 * abs(re)) * Float64(Float64(-2.0 - Float64(0.3333333333333333 * Float64(im * im))) * im));
    	end
    	return Float64(copysign(1.0, re) * tmp)
    end
    
    function tmp_2 = code(re, im)
    	tmp = 0.0;
    	if ((0.5 * sin(abs(re))) <= -0.005)
    		tmp = -((((abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re)) * im;
    	else
    		tmp = (0.5 * abs(re)) * ((-2.0 - (0.3333333333333333 * (im * im))) * im);
    	end
    	tmp_2 = (sign(re) * abs(1.0)) * tmp;
    end
    
    code[re_, im_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(0.5 * N[Sin[N[Abs[re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.005], N[((-N[(N[(N[(N[(N[Abs[re], $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - -1.0), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]) * im), $MachinePrecision], N[(N[(0.5 * N[Abs[re], $MachinePrecision]), $MachinePrecision] * N[(N[(-2.0 - N[(0.3333333333333333 * N[(im * im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * im), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]
    
    \mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l}
    \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\
    \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(0.5 \cdot \left|re\right|\right) \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right)\\
    
    
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0050000000000000001

      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
        4. lower-pow.f6435.5%

          \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
      7. Applied rewrites35.5%

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

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

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

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

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

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

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

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

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

      1. Initial program 65.6%

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

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

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

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

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

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

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

          \[\leadsto \left(\frac{1}{2} \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right)\right) \]
        7. lower-pow.f6490.8%

          \[\leadsto \left(0.5 \cdot \sin re\right) \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
      4. Applied rewrites90.8%

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

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

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

          \[\leadsto \color{blue}{\left(\sin re \cdot 0.5\right)} \cdot \left(im \cdot \left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right)\right) \]
        4. lift-*.f64N/A

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

          \[\leadsto \left(\sin re \cdot \frac{1}{2}\right) \cdot \left(\left({im}^{2} \cdot \left(\frac{-1}{60} \cdot {im}^{2} - \frac{1}{3}\right) - 2\right) \cdot \color{blue}{im}\right) \]
        6. lower-*.f6490.8%

          \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left({im}^{2} \cdot \left(-0.016666666666666666 \cdot {im}^{2} - 0.3333333333333333\right) - 2\right) \cdot \color{blue}{im}\right) \]
      6. Applied rewrites90.8%

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

        \[\leadsto \left(\sin re \cdot 0.5\right) \cdot \left(\left(-2 - \frac{1}{3} \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
      8. Step-by-step derivation
        1. Applied rewrites84.4%

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

          \[\leadsto \color{blue}{\left(\frac{1}{2} \cdot re\right)} \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
        3. Step-by-step derivation
          1. lower-*.f6453.5%

            \[\leadsto \left(0.5 \cdot \color{blue}{re}\right) \cdot \left(\left(-2 - 0.3333333333333333 \cdot \left(im \cdot im\right)\right) \cdot im\right) \]
        4. Applied rewrites53.5%

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

      Alternative 11: 42.5% accurate, 1.3× speedup?

      \[\mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l} \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\ \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\ \mathbf{else}:\\ \;\;\;\;-im \cdot \left|re\right|\\ \end{array} \]
      (FPCore (re im)
        :precision binary64
        (*
       (copysign 1.0 re)
       (if (<= (* 0.5 (sin (fabs re))) -0.005)
         (*
          (-
           (*
            (- (* (* (fabs re) (fabs re)) -0.16666666666666666) -1.0)
            (fabs re)))
          im)
         (- (* im (fabs re))))))
      double code(double re, double im) {
      	double tmp;
      	if ((0.5 * sin(fabs(re))) <= -0.005) {
      		tmp = -((((fabs(re) * fabs(re)) * -0.16666666666666666) - -1.0) * fabs(re)) * im;
      	} else {
      		tmp = -(im * fabs(re));
      	}
      	return copysign(1.0, re) * tmp;
      }
      
      public static double code(double re, double im) {
      	double tmp;
      	if ((0.5 * Math.sin(Math.abs(re))) <= -0.005) {
      		tmp = -((((Math.abs(re) * Math.abs(re)) * -0.16666666666666666) - -1.0) * Math.abs(re)) * im;
      	} else {
      		tmp = -(im * Math.abs(re));
      	}
      	return Math.copySign(1.0, re) * tmp;
      }
      
      def code(re, im):
      	tmp = 0
      	if (0.5 * math.sin(math.fabs(re))) <= -0.005:
      		tmp = -((((math.fabs(re) * math.fabs(re)) * -0.16666666666666666) - -1.0) * math.fabs(re)) * im
      	else:
      		tmp = -(im * math.fabs(re))
      	return math.copysign(1.0, re) * tmp
      
      function code(re, im)
      	tmp = 0.0
      	if (Float64(0.5 * sin(abs(re))) <= -0.005)
      		tmp = Float64(Float64(-Float64(Float64(Float64(Float64(abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re))) * im);
      	else
      		tmp = Float64(-Float64(im * abs(re)));
      	end
      	return Float64(copysign(1.0, re) * tmp)
      end
      
      function tmp_2 = code(re, im)
      	tmp = 0.0;
      	if ((0.5 * sin(abs(re))) <= -0.005)
      		tmp = -((((abs(re) * abs(re)) * -0.16666666666666666) - -1.0) * abs(re)) * im;
      	else
      		tmp = -(im * abs(re));
      	end
      	tmp_2 = (sign(re) * abs(1.0)) * tmp;
      end
      
      code[re_, im_] := N[(N[With[{TMP1 = Abs[1.0], TMP2 = Sign[re]}, TMP1 * If[TMP2 == 0, 1, TMP2]], $MachinePrecision] * If[LessEqual[N[(0.5 * N[Sin[N[Abs[re], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], -0.005], N[((-N[(N[(N[(N[(N[Abs[re], $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision] * -0.16666666666666666), $MachinePrecision] - -1.0), $MachinePrecision] * N[Abs[re], $MachinePrecision]), $MachinePrecision]) * im), $MachinePrecision], (-N[(im * N[Abs[re], $MachinePrecision]), $MachinePrecision])]), $MachinePrecision]
      
      \mathsf{copysign}\left(1, re\right) \cdot \begin{array}{l}
      \mathbf{if}\;0.5 \cdot \sin \left(\left|re\right|\right) \leq -0.005:\\
      \;\;\;\;\left(-\left(\left(\left|re\right| \cdot \left|re\right|\right) \cdot -0.16666666666666666 - -1\right) \cdot \left|re\right|\right) \cdot im\\
      
      \mathbf{else}:\\
      \;\;\;\;-im \cdot \left|re\right|\\
      
      
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 #s(literal 1/2 binary64) (sin.f64 re)) < -0.0050000000000000001

        1. Initial program 65.6%

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

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

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

            \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
          3. lower-sin.f6452.0%

            \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
        4. Applied rewrites52.0%

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

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

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

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

            \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + \frac{-1}{6} \cdot {re}^{\color{blue}{2}}\right)\right)\right) \]
          4. lower-pow.f6435.5%

            \[\leadsto -1 \cdot \left(im \cdot \left(re \cdot \left(1 + -0.16666666666666666 \cdot {re}^{2}\right)\right)\right) \]
        7. Applied rewrites35.5%

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

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

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

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

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

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

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

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

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

        1. Initial program 65.6%

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

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

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

            \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
          3. lower-sin.f6452.0%

            \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
        4. Applied rewrites52.0%

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{re}\right) \]
        6. Step-by-step derivation
          1. lower-*.f6432.8%

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

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

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

            \[\leadsto \mathsf{neg}\left(im \cdot re\right) \]
          3. lower-neg.f6432.8%

            \[\leadsto -im \cdot re \]
        9. Applied rewrites32.8%

          \[\leadsto -im \cdot re \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 12: 32.8% accurate, 39.5× speedup?

      \[-im \cdot re \]
      (FPCore (re im)
        :precision binary64
        (- (* im re)))
      double code(double re, double im) {
      	return -(im * re);
      }
      
      module fmin_fmax_functions
          implicit none
          private
          public fmax
          public fmin
      
          interface fmax
              module procedure fmax88
              module procedure fmax44
              module procedure fmax84
              module procedure fmax48
          end interface
          interface fmin
              module procedure fmin88
              module procedure fmin44
              module procedure fmin84
              module procedure fmin48
          end interface
      contains
          real(8) function fmax88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(4) function fmax44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, max(x, y), y /= y), x /= x)
          end function
          real(8) function fmax84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmax48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
          end function
          real(8) function fmin88(x, y) result (res)
              real(8), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(4) function fmin44(x, y) result (res)
              real(4), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(y, merge(x, min(x, y), y /= y), x /= x)
          end function
          real(8) function fmin84(x, y) result(res)
              real(8), intent (in) :: x
              real(4), intent (in) :: y
              res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
          end function
          real(8) function fmin48(x, y) result(res)
              real(4), intent (in) :: x
              real(8), intent (in) :: y
              res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
          end function
      end module
      
      real(8) function code(re, im)
      use fmin_fmax_functions
          real(8), intent (in) :: re
          real(8), intent (in) :: im
          code = -(im * re)
      end function
      
      public static double code(double re, double im) {
      	return -(im * re);
      }
      
      def code(re, im):
      	return -(im * re)
      
      function code(re, im)
      	return Float64(-Float64(im * re))
      end
      
      function tmp = code(re, im)
      	tmp = -(im * re);
      end
      
      code[re_, im_] := (-N[(im * re), $MachinePrecision])
      
      -im \cdot re
      
      Derivation
      1. Initial program 65.6%

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

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

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

          \[\leadsto -1 \cdot \left(im \cdot \color{blue}{\sin re}\right) \]
        3. lower-sin.f6452.0%

          \[\leadsto -1 \cdot \left(im \cdot \sin re\right) \]
      4. Applied rewrites52.0%

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

        \[\leadsto -1 \cdot \left(im \cdot \color{blue}{re}\right) \]
      6. Step-by-step derivation
        1. lower-*.f6432.8%

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

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

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

          \[\leadsto \mathsf{neg}\left(im \cdot re\right) \]
        3. lower-neg.f6432.8%

          \[\leadsto -im \cdot re \]
      9. Applied rewrites32.8%

        \[\leadsto -im \cdot re \]
      10. Add Preprocessing

      Reproduce

      ?
      herbie shell --seed 2025258 
      (FPCore (re im)
        :name "math.cos on complex, imaginary part"
        :precision binary64
        (* (* 0.5 (sin re)) (- (exp (- im)) (exp im))))