_divideComplex, imaginary part

Percentage Accurate: 62.2% → 84.0%
Time: 4.7s
Alternatives: 14
Speedup: 1.7×

Specification

?
\[\begin{array}{l} \\ \frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 14 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: 62.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = ((x_46im * y_46re) - (x_46re * y_46im)) / ((y_46re * y_46re) + (y_46im * y_46im))
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im))
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)))
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}
\end{array}

Alternative 1: 84.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\ \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\ \mathbf{elif}\;y.re \leq 9 \cdot 10^{-84}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-y.im}{t\_0}, x.re, \frac{x.im}{t\_0} \cdot y.re\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.im y.im (* y.re y.re))))
   (if (<= y.re -2.6e+41)
     (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
     (if (<= y.re -1.06e-135)
       (/ (fma (* x.re y.im) (* (/ -1.0 y.re) y.re) (* x.im y.re)) t_0)
       (if (<= y.re 9e-84)
         (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
         (if (<= y.re 1.5e+117)
           (fma (/ (- y.im) t_0) x.re (* (/ x.im t_0) y.re))
           (/ (- x.im (* (/ y.im y.re) x.re)) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = fma((x_46_re * y_46_im), ((-1.0 / y_46_re) * y_46_re), (x_46_im * y_46_re)) / t_0;
	} else if (y_46_re <= 9e-84) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 1.5e+117) {
		tmp = fma((-y_46_im / t_0), x_46_re, ((x_46_im / t_0) * y_46_re));
	} else {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = Float64(fma(Float64(x_46_re * y_46_im), Float64(Float64(-1.0 / y_46_re) * y_46_re), Float64(x_46_im * y_46_re)) / t_0);
	elseif (y_46_re <= 9e-84)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 1.5e+117)
		tmp = fma(Float64(Float64(-y_46_im) / t_0), x_46_re, Float64(Float64(x_46_im / t_0) * y_46_re));
	else
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], N[(N[(N[(x$46$re * y$46$im), $MachinePrecision] * N[(N[(-1.0 / y$46$re), $MachinePrecision] * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 9e-84], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.5e+117], N[(N[((-y$46$im) / t$95$0), $MachinePrecision] * x$46$re + N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$re), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\

\mathbf{elif}\;y.re \leq 9 \cdot 10^{-84}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y.im}{t\_0}, x.re, \frac{x.im}{t\_0} \cdot y.re\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    4. Applied rewrites62.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \]

    if -1.06000000000000004e-135 < y.re < 9.00000000000000031e-84

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 9.00000000000000031e-84 < y.re < 1.5e117

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Applied rewrites62.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{-y.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}, x.re, \frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.re\right)} \]

    if 1.5e117 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 2: 83.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\ \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\ \mathbf{elif}\;y.re \leq 1.35 \cdot 10^{-83}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 3.7 \cdot 10^{+118}:\\ \;\;\;\;\frac{x.im}{t\_0} \cdot y.re - \frac{x.re}{t\_0} \cdot y.im\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.im y.im (* y.re y.re))))
   (if (<= y.re -2.6e+41)
     (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
     (if (<= y.re -1.06e-135)
       (/ (fma (* x.re y.im) (* (/ -1.0 y.re) y.re) (* x.im y.re)) t_0)
       (if (<= y.re 1.35e-83)
         (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
         (if (<= y.re 3.7e+118)
           (- (* (/ x.im t_0) y.re) (* (/ x.re t_0) y.im))
           (/ (- x.im (* (/ y.im y.re) x.re)) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = fma((x_46_re * y_46_im), ((-1.0 / y_46_re) * y_46_re), (x_46_im * y_46_re)) / t_0;
	} else if (y_46_re <= 1.35e-83) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 3.7e+118) {
		tmp = ((x_46_im / t_0) * y_46_re) - ((x_46_re / t_0) * y_46_im);
	} else {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = Float64(fma(Float64(x_46_re * y_46_im), Float64(Float64(-1.0 / y_46_re) * y_46_re), Float64(x_46_im * y_46_re)) / t_0);
	elseif (y_46_re <= 1.35e-83)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 3.7e+118)
		tmp = Float64(Float64(Float64(x_46_im / t_0) * y_46_re) - Float64(Float64(x_46_re / t_0) * y_46_im));
	else
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], N[(N[(N[(x$46$re * y$46$im), $MachinePrecision] * N[(N[(-1.0 / y$46$re), $MachinePrecision] * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.35e-83], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 3.7e+118], N[(N[(N[(x$46$im / t$95$0), $MachinePrecision] * y$46$re), $MachinePrecision] - N[(N[(x$46$re / t$95$0), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\

\mathbf{elif}\;y.re \leq 1.35 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 3.7 \cdot 10^{+118}:\\
\;\;\;\;\frac{x.im}{t\_0} \cdot y.re - \frac{x.re}{t\_0} \cdot y.im\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    4. Applied rewrites62.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \]

    if -1.06000000000000004e-135 < y.re < 1.34999999999999996e-83

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 1.34999999999999996e-83 < y.re < 3.69999999999999987e118

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re - x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. div-subN/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
      4. lower--.f64N/A

        \[\leadsto \color{blue}{\frac{x.im \cdot y.re}{y.re \cdot y.re + y.im \cdot y.im} - \frac{x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}} \]
    3. Applied rewrites59.5%

      \[\leadsto \color{blue}{\frac{x.im}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.re - \frac{x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \cdot y.im} \]

    if 3.69999999999999987e118 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 3: 83.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\ \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\ \mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-83}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\ \;\;\;\;y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.im y.im (* y.re y.re))))
   (if (<= y.re -2.6e+41)
     (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
     (if (<= y.re -1.06e-135)
       (/ (fma (* x.re y.im) (* (/ -1.0 y.re) y.re) (* x.im y.re)) t_0)
       (if (<= y.re 1.9e-83)
         (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
         (if (<= y.re 1.5e+117)
           (* y.re (/ (- x.im (* y.im (/ x.re y.re))) t_0))
           (/ (- x.im (* (/ y.im y.re) x.re)) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = fma((x_46_re * y_46_im), ((-1.0 / y_46_re) * y_46_re), (x_46_im * y_46_re)) / t_0;
	} else if (y_46_re <= 1.9e-83) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 1.5e+117) {
		tmp = y_46_re * ((x_46_im - (y_46_im * (x_46_re / y_46_re))) / t_0);
	} else {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = Float64(fma(Float64(x_46_re * y_46_im), Float64(Float64(-1.0 / y_46_re) * y_46_re), Float64(x_46_im * y_46_re)) / t_0);
	elseif (y_46_re <= 1.9e-83)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 1.5e+117)
		tmp = Float64(y_46_re * Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / t_0));
	else
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], N[(N[(N[(x$46$re * y$46$im), $MachinePrecision] * N[(N[(-1.0 / y$46$re), $MachinePrecision] * y$46$re), $MachinePrecision] + N[(x$46$im * y$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.9e-83], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.5e+117], N[(y$46$re * N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}{t\_0}\\

\mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\
\;\;\;\;y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    4. Applied rewrites62.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \]

    if -1.06000000000000004e-135 < y.re < 1.89999999999999988e-83

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 1.89999999999999988e-83 < y.re < 1.5e117

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    4. Applied rewrites62.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \]
    5. Applied rewrites55.1%

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]

    if 1.5e117 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 4: 83.4% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\ \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\ \mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-83}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\ \;\;\;\;y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (fma y.im y.im (* y.re y.re))))
   (if (<= y.re -2.6e+41)
     (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
     (if (<= y.re -1.06e-135)
       (/ (- (* y.re x.im) (* y.im x.re)) t_0)
       (if (<= y.re 1.9e-83)
         (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
         (if (<= y.re 1.5e+117)
           (* y.re (/ (- x.im (* y.im (/ x.re y.re))) t_0))
           (/ (- x.im (* (/ y.im y.re) x.re)) y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / t_0;
	} else if (y_46_re <= 1.9e-83) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 1.5e+117) {
		tmp = y_46_re * ((x_46_im - (y_46_im * (x_46_re / y_46_re))) / t_0);
	} else {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re))
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / t_0);
	elseif (y_46_re <= 1.9e-83)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 1.5e+117)
		tmp = Float64(y_46_re * Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / t_0));
	else
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[y$46$re, 1.9e-83], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 1.5e+117], N[(y$46$re * N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{t\_0}\\

\mathbf{elif}\;y.re \leq 1.9 \cdot 10^{-83}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 1.5 \cdot 10^{+117}:\\
\;\;\;\;y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]

    if -1.06000000000000004e-135 < y.re < 1.89999999999999988e-83

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 1.89999999999999988e-83 < y.re < 1.5e117

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    4. Applied rewrites62.1%

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(x.re \cdot y.im, \frac{-1}{y.re} \cdot y.re, x.im \cdot y.re\right)}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)} \]
    5. Applied rewrites55.1%

      \[\leadsto \color{blue}{y.re \cdot \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]

    if 1.5e117 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 5: 83.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \mathbf{elif}\;y.re \leq 2.5 \cdot 10^{-140}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 3.55 \cdot 10^{+50}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-y.im}{y.re}, \frac{x.re}{y.re}, \frac{x.im}{y.re}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.re -2.6e+41)
   (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
   (if (<= y.re -1.06e-135)
     (/ (- (* y.re x.im) (* y.im x.re)) (fma y.im y.im (* y.re y.re)))
     (if (<= y.re 2.5e-140)
       (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
       (if (<= y.re 3.55e+50)
         (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im)))
         (fma (/ (- y.im) y.re) (/ x.re y.re) (/ x.im y.re)))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	} else if (y_46_re <= 2.5e-140) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 3.55e+50) {
		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / ((y_46_re * y_46_re) + (y_46_im * y_46_im));
	} else {
		tmp = fma((-y_46_im / y_46_re), (x_46_re / y_46_re), (x_46_im / y_46_re));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)));
	elseif (y_46_re <= 2.5e-140)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 3.55e+50)
		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(Float64(y_46_re * y_46_re) + Float64(y_46_im * y_46_im)));
	else
		tmp = fma(Float64(Float64(-y_46_im) / y_46_re), Float64(x_46_re / y_46_re), Float64(x_46_im / y_46_re));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$re, 2.5e-140], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 3.55e+50], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(N[(y$46$re * y$46$re), $MachinePrecision] + N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-y$46$im) / y$46$re), $MachinePrecision] * N[(x$46$re / y$46$re), $MachinePrecision] + N[(x$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\

\mathbf{elif}\;y.re \leq 2.5 \cdot 10^{-140}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 3.55 \cdot 10^{+50}:\\
\;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y.im}{y.re}, \frac{x.re}{y.re}, \frac{x.im}{y.re}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]

    if -1.06000000000000004e-135 < y.re < 2.50000000000000007e-140

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 2.50000000000000007e-140 < y.re < 3.54999999999999996e50

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]

    if 3.54999999999999996e50 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)\right)}{\color{blue}{\mathsf{neg}\left(y.re\right)}} \]
      3. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)\right)\right)\right)}{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)}} \]
      4. remove-double-negN/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.re\right)\right)}\right)} \]
      5. lift-+.f64N/A

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

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re} + x.im}{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.re\right)\right)}\right)} \]
      7. div-addN/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} + \color{blue}{\frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)}} \]
      8. remove-double-negN/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      10. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      11. lift-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      12. distribute-neg-fracN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      13. associate-/l/N/A

        \[\leadsto \frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re \cdot y.re} + \frac{\color{blue}{x.im}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      15. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(y.im \cdot x.re\right)}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      16. distribute-lft-neg-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.re}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      17. times-fracN/A

        \[\leadsto \frac{\mathsf{neg}\left(y.im\right)}{y.re} \cdot \frac{x.re}{y.re} + \frac{\color{blue}{x.im}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      18. distribute-neg-fracN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      19. distribute-neg-frac2N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \left(\mathsf{neg}\left(\frac{x.im}{\mathsf{neg}\left(y.re\right)}\right)\right) \]
      20. distribute-frac-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{\mathsf{neg}\left(x.im\right)}{\color{blue}{\mathsf{neg}\left(y.re\right)}} \]
      21. frac-2negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\color{blue}{y.re}} \]
      22. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\color{blue}{y.re}} \]
    6. Applied rewrites53.7%

      \[\leadsto \mathsf{fma}\left(\frac{-y.im}{y.re}, \color{blue}{\frac{x.re}{y.re}}, \frac{x.im}{y.re}\right) \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 6: 83.3% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 2.5 \cdot 10^{-140}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{elif}\;y.re \leq 3.55 \cdot 10^{+50}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-y.im}{y.re}, \frac{x.re}{y.re}, \frac{x.im}{y.re}\right)\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0
         (/ (- (* y.re x.im) (* y.im x.re)) (fma y.im y.im (* y.re y.re)))))
   (if (<= y.re -2.6e+41)
     (/ (- x.im (* (/ x.re y.re) y.im)) y.re)
     (if (<= y.re -1.06e-135)
       t_0
       (if (<= y.re 2.5e-140)
         (/ (- (/ (* x.im y.re) y.im) x.re) y.im)
         (if (<= y.re 3.55e+50)
           t_0
           (fma (/ (- y.im) y.re) (/ x.re y.re) (/ x.im y.re))))))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = ((y_46_re * x_46_im) - (y_46_im * x_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	double tmp;
	if (y_46_re <= -2.6e+41) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else if (y_46_re <= -1.06e-135) {
		tmp = t_0;
	} else if (y_46_re <= 2.5e-140) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else if (y_46_re <= 3.55e+50) {
		tmp = t_0;
	} else {
		tmp = fma((-y_46_im / y_46_re), (x_46_re / y_46_re), (x_46_im / y_46_re));
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(y_46_re * x_46_im) - Float64(y_46_im * x_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)))
	tmp = 0.0
	if (y_46_re <= -2.6e+41)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	elseif (y_46_re <= -1.06e-135)
		tmp = t_0;
	elseif (y_46_re <= 2.5e-140)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	elseif (y_46_re <= 3.55e+50)
		tmp = t_0;
	else
		tmp = fma(Float64(Float64(-y_46_im) / y_46_re), Float64(x_46_re / y_46_re), Float64(x_46_im / y_46_re));
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(y$46$re * x$46$im), $MachinePrecision] - N[(y$46$im * x$46$re), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im + N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$re, -2.6e+41], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$re, -1.06e-135], t$95$0, If[LessEqual[y$46$re, 2.5e-140], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$re, 3.55e+50], t$95$0, N[(N[((-y$46$im) / y$46$re), $MachinePrecision] * N[(x$46$re / y$46$re), $MachinePrecision] + N[(x$46$im / y$46$re), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\
\mathbf{if}\;y.re \leq -2.6 \cdot 10^{+41}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

\mathbf{elif}\;y.re \leq -1.06 \cdot 10^{-135}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 2.5 \cdot 10^{-140}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

\mathbf{elif}\;y.re \leq 3.55 \cdot 10^{+50}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-y.im}{y.re}, \frac{x.re}{y.re}, \frac{x.im}{y.re}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.re < -2.6000000000000001e41

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -2.6000000000000001e41 < y.re < -1.06000000000000004e-135 or 2.50000000000000007e-140 < y.re < 3.54999999999999996e50

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{x.im \cdot y.re} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. lower-*.f6462.2

        \[\leadsto \frac{\color{blue}{y.re \cdot x.im} - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-*.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - \color{blue}{y.im \cdot x.re}}{y.re \cdot y.re + y.im \cdot y.im} \]
      7. lift-+.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.re \cdot y.re + y.im \cdot y.im}} \]
      8. +-commutativeN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + y.re \cdot y.re}} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      10. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      11. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left(\mathsf{neg}\left(\left|y.re\right|\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      12. fp-cancel-sign-sub-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      13. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)}} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{y.im \cdot y.im} + \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\left|y.re\right|\right)\right)\right)\right)\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      15. remove-double-negN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \left(\mathsf{neg}\left(\color{blue}{\left|y.re\right|}\right)\right) \cdot \left(\mathsf{neg}\left(\left|y.re\right|\right)\right)} \]
      16. sqr-neg-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{\left|y.re\right| \cdot \left|y.re\right|}} \]
      17. sqr-abs-revN/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      18. lift-*.f64N/A

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{y.im \cdot y.im + \color{blue}{y.re \cdot y.re}} \]
      19. lower-fma.f6462.2

        \[\leadsto \frac{y.re \cdot x.im - y.im \cdot x.re}{\color{blue}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]
    3. Applied rewrites62.2%

      \[\leadsto \color{blue}{\frac{y.re \cdot x.im - y.im \cdot x.re}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}} \]

    if -1.06000000000000004e-135 < y.re < 2.50000000000000007e-140

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]

    if 3.54999999999999996e50 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)\right)}{\color{blue}{\mathsf{neg}\left(y.re\right)}} \]
      3. frac-2negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(\left(x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}\right)\right)\right)\right)}{\color{blue}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)}} \]
      4. remove-double-negN/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.re\right)\right)}\right)} \]
      5. lift-+.f64N/A

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

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re} + x.im}{\mathsf{neg}\left(\color{blue}{\left(\mathsf{neg}\left(y.re\right)\right)}\right)} \]
      7. div-addN/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} + \color{blue}{\frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)}} \]
      8. remove-double-negN/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      10. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      11. lift-/.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      12. distribute-neg-fracN/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re}}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      13. associate-/l/N/A

        \[\leadsto \frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re \cdot y.re} + \frac{\color{blue}{x.im}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      14. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{neg}\left(x.re \cdot y.im\right)}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      15. *-commutativeN/A

        \[\leadsto \frac{\mathsf{neg}\left(y.im \cdot x.re\right)}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      16. distribute-lft-neg-outN/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(y.im\right)\right) \cdot x.re}{y.re \cdot y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      17. times-fracN/A

        \[\leadsto \frac{\mathsf{neg}\left(y.im\right)}{y.re} \cdot \frac{x.re}{y.re} + \frac{\color{blue}{x.im}}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      18. distribute-neg-fracN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\mathsf{neg}\left(\left(\mathsf{neg}\left(y.re\right)\right)\right)} \]
      19. distribute-neg-frac2N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \left(\mathsf{neg}\left(\frac{x.im}{\mathsf{neg}\left(y.re\right)}\right)\right) \]
      20. distribute-frac-negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{\mathsf{neg}\left(x.im\right)}{\color{blue}{\mathsf{neg}\left(y.re\right)}} \]
      21. frac-2negN/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\color{blue}{y.re}} \]
      22. lift-/.f64N/A

        \[\leadsto \left(\mathsf{neg}\left(\frac{y.im}{y.re}\right)\right) \cdot \frac{x.re}{y.re} + \frac{x.im}{\color{blue}{y.re}} \]
    6. Applied rewrites53.7%

      \[\leadsto \mathsf{fma}\left(\frac{-y.im}{y.re}, \color{blue}{\frac{x.re}{y.re}}, \frac{x.im}{y.re}\right) \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 7: 77.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re, x.im\right)}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
   (if (<= y.im -1.7e+41)
     t_0
     (if (<= y.im 9e+81) (/ (fma (/ (- y.im) y.re) x.re x.im) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
	double tmp;
	if (y_46_im <= -1.7e+41) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = fma((-y_46_im / y_46_re), x_46_re, x_46_im) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.7e+41)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(fma(Float64(Float64(-y_46_im) / y_46_re), x_46_re, x_46_im) / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+41], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(N[((-y$46$im) / y$46$re), $MachinePrecision] * x$46$re + x$46$im), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re, x.im\right)}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.69999999999999999e41 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{y.re \cdot x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      6. associate-/l*N/A

        \[\leadsto \frac{y.re \cdot \frac{x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re + -1 \cdot x.re}{y.im} \]
      8. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      10. mul-1-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      11. *-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot 1\right)\right)}{y.im} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)\right)}{y.im} \]
      13. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)\right)}{y.im} \]
      15. lower-neg.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{y.im} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.im} \]
      18. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot 1\right)}{y.im} \]
      19. *-rgt-identity53.0

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]
    6. Applied rewrites53.0%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]

    if -1.69999999999999999e41 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. +-commutativeN/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re} + x.im}{y.re} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re} + x.im}{y.re} \]
      4. lift-/.f64N/A

        \[\leadsto \frac{-1 \cdot \frac{x.re \cdot y.im}{y.re} + x.im}{y.re} \]
      5. associate-*r/N/A

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

        \[\leadsto \frac{\frac{\mathsf{neg}\left(-1 \cdot \left(x.re \cdot y.im\right)\right)}{\mathsf{neg}\left(y.re\right)} + x.im}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(-1 \cdot \left(x.re \cdot y.im\right)\right)}{\mathsf{neg}\left(y.re\right)} + x.im}{y.re} \]
      8. associate-*l*N/A

        \[\leadsto \frac{\frac{\mathsf{neg}\left(\left(-1 \cdot x.re\right) \cdot y.im\right)}{\mathsf{neg}\left(y.re\right)} + x.im}{y.re} \]
      9. distribute-lft-neg-outN/A

        \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im}{\mathsf{neg}\left(y.re\right)} + x.im}{y.re} \]
      10. associate-/l*N/A

        \[\leadsto \frac{\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{\mathsf{neg}\left(y.re\right)} + x.im}{y.re} \]
      11. distribute-neg-frac2N/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{neg}\left(\frac{y.im}{y.re}\right), \mathsf{neg}\left(-1 \cdot x.re\right), x.im\right)}{y.re} \]
      14. distribute-neg-fracN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{\mathsf{neg}\left(y.im\right)}{y.re}, \mathsf{neg}\left(-1 \cdot x.re\right), x.im\right)}{y.re} \]
      15. lower-/.f64N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, \mathsf{neg}\left(-1 \cdot x.re\right), x.im\right)}{y.re} \]
      17. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, \mathsf{neg}\left(x.re \cdot -1\right), x.im\right)}{y.re} \]
      18. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re \cdot \left(\mathsf{neg}\left(-1\right)\right), x.im\right)}{y.re} \]
      19. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re \cdot 1, x.im\right)}{y.re} \]
      20. *-rgt-identity55.1

        \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re, x.im\right)}{y.re} \]
    6. Applied rewrites55.1%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{-y.im}{y.re}, x.re, x.im\right)}{y.re} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 77.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\ \mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (fma (/ x.im y.im) y.re (- x.re)) y.im)))
   (if (<= y.im -1.7e+41)
     t_0
     (if (<= y.im 9e+81) (/ (- x.im (* (/ y.im y.re) x.re)) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = fma((x_46_im / y_46_im), y_46_re, -x_46_re) / y_46_im;
	double tmp;
	if (y_46_im <= -1.7e+41) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(fma(Float64(x_46_im / y_46_im), y_46_re, Float64(-x_46_re)) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.7e+41)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(x$46$im / y$46$im), $MachinePrecision] * y$46$re + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+41], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.69999999999999999e41 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{y.re \cdot x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      6. associate-/l*N/A

        \[\leadsto \frac{y.re \cdot \frac{x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re + -1 \cdot x.re}{y.im} \]
      8. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      10. mul-1-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      11. *-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot 1\right)\right)}{y.im} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)\right)}{y.im} \]
      13. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)\right)}{y.im} \]
      15. lower-neg.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{y.im} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.im} \]
      18. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot 1\right)}{y.im} \]
      19. *-rgt-identity53.0

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]
    6. Applied rewrites53.0%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]

    if -1.69999999999999999e41 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 77.4% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{if}\;y.re \leq -1.22 \cdot 10^{-28}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.re \leq 5.2 \cdot 10^{-79}:\\ \;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- x.im (* (/ x.re y.re) y.im)) y.re)))
   (if (<= y.re -1.22e-28)
     t_0
     (if (<= y.re 5.2e-79) (/ (- (/ (* x.im y.re) y.im) x.re) y.im) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	double tmp;
	if (y_46_re <= -1.22e-28) {
		tmp = t_0;
	} else if (y_46_re <= 5.2e-79) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (x_46im - ((x_46re / y_46re) * y_46im)) / y_46re
    if (y_46re <= (-1.22d-28)) then
        tmp = t_0
    else if (y_46re <= 5.2d-79) then
        tmp = (((x_46im * y_46re) / y_46im) - x_46re) / y_46im
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	double tmp;
	if (y_46_re <= -1.22e-28) {
		tmp = t_0;
	} else if (y_46_re <= 5.2e-79) {
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re
	tmp = 0
	if y_46_re <= -1.22e-28:
		tmp = t_0
	elif y_46_re <= 5.2e-79:
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re)
	tmp = 0.0
	if (y_46_re <= -1.22e-28)
		tmp = t_0;
	elseif (y_46_re <= 5.2e-79)
		tmp = Float64(Float64(Float64(Float64(x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	tmp = 0.0;
	if (y_46_re <= -1.22e-28)
		tmp = t_0;
	elseif (y_46_re <= 5.2e-79)
		tmp = (((x_46_im * y_46_re) / y_46_im) - x_46_re) / y_46_im;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]}, If[LessEqual[y$46$re, -1.22e-28], t$95$0, If[LessEqual[y$46$re, 5.2e-79], N[(N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] / y$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\
\mathbf{if}\;y.re \leq -1.22 \cdot 10^{-28}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.re \leq 5.2 \cdot 10^{-79}:\\
\;\;\;\;\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.re < -1.22e-28 or 5.19999999999999987e-79 < y.re

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]

    if -1.22e-28 < y.re < 5.19999999999999987e-79

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. add-flipN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      6. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.im} \]
      7. metadata-evalN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re \cdot 1}{y.im} \]
      8. *-rgt-identity51.8

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
    6. Applied rewrites51.8%

      \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 77.0% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im}\\ \mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- (* (/ y.re y.im) x.im) x.re) y.im)))
   (if (<= y.im -1.7e+41)
     t_0
     (if (<= y.im 9e+81) (/ (- x.im (* (/ y.im y.re) x.re)) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (((y_46_re / y_46_im) * x_46_im) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_im <= -1.7e+41) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((y_46re / y_46im) * x_46im) - x_46re) / y_46im
    if (y_46im <= (-1.7d+41)) then
        tmp = t_0
    else if (y_46im <= 9d+81) then
        tmp = (x_46im - ((y_46im / y_46re) * x_46re)) / y_46re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = (((y_46_re / y_46_im) * x_46_im) - x_46_re) / y_46_im;
	double tmp;
	if (y_46_im <= -1.7e+41) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = (((y_46_re / y_46_im) * x_46_im) - x_46_re) / y_46_im
	tmp = 0
	if y_46_im <= -1.7e+41:
		tmp = t_0
	elif y_46_im <= 9e+81:
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(Float64(Float64(y_46_re / y_46_im) * x_46_im) - x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -1.7e+41)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = (((y_46_re / y_46_im) * x_46_im) - x_46_re) / y_46_im;
	tmp = 0.0;
	if (y_46_im <= -1.7e+41)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[(N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$im), $MachinePrecision] - x$46$re), $MachinePrecision] / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -1.7e+41], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im}\\
\mathbf{if}\;y.im \leq -1.7 \cdot 10^{+41}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -1.69999999999999999e41 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

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

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}{y.im} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{y.re \cdot x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      6. associate-/l*N/A

        \[\leadsto \frac{y.re \cdot \frac{x.im}{y.im} + -1 \cdot x.re}{y.im} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re + -1 \cdot x.re}{y.im} \]
      8. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      9. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -1 \cdot x.re\right)}{y.im} \]
      10. mul-1-negN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      11. *-rgt-identityN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot 1\right)\right)}{y.im} \]
      12. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)\right)}{y.im} \]
      13. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, \mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)\right)}{y.im} \]
      15. lower-neg.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      16. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{y.im} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.im} \]
      18. metadata-evalN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re \cdot 1\right)}{y.im} \]
      19. *-rgt-identity53.0

        \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]
    6. Applied rewrites53.0%

      \[\leadsto \frac{\mathsf{fma}\left(\frac{x.im}{y.im}, y.re, -x.re\right)}{y.im} \]
    7. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re + \left(-x.re\right)}{y.im} \]
      2. lift-neg.f64N/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re + \left(\mathsf{neg}\left(x.re\right)\right)}{y.im} \]
      3. sub-flip-reverseN/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im} \]
      4. lower--.f64N/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im} \]
      5. lift-/.f64N/A

        \[\leadsto \frac{\frac{x.im}{y.im} \cdot y.re - x.re}{y.im} \]
      6. associate-*l/N/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\frac{y.re \cdot x.im}{y.im} - x.re}{y.im} \]
      8. associate-*l/N/A

        \[\leadsto \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im} \]
      9. lift-/.f64N/A

        \[\leadsto \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im} \]
      10. lower-*.f6453.6

        \[\leadsto \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im} \]
    8. Applied rewrites53.6%

      \[\leadsto \frac{\frac{y.re}{y.im} \cdot x.im - x.re}{y.im} \]

    if -1.69999999999999999e41 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 11: 73.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.6 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- x.re) y.im)))
   (if (<= y.im -2.6e+44)
     t_0
     (if (<= y.im 9e+81) (/ (- x.im (* (/ y.im y.re) x.re)) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.6e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -x_46re / y_46im
    if (y_46im <= (-2.6d+44)) then
        tmp = t_0
    else if (y_46im <= 9d+81) then
        tmp = (x_46im - ((y_46im / y_46re) * x_46re)) / y_46re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.6e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = -x_46_re / y_46_im
	tmp = 0
	if y_46_im <= -2.6e+44:
		tmp = t_0
	elif y_46_im <= 9e+81:
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(-x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -2.6e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(Float64(x_46_im - Float64(Float64(y_46_im / y_46_re) * x_46_re)) / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = -x_46_re / y_46_im;
	tmp = 0.0;
	if (y_46_im <= -2.6e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = (x_46_im - ((y_46_im / y_46_re) * x_46_re)) / y_46_re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.6e+44], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(x$46$im - N[(N[(y$46$im / y$46$re), $MachinePrecision] * x$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.6 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -2.5999999999999999e44 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}} \]
    5. Taylor expanded in x.re around inf

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    6. Step-by-step derivation
      1. lower-*.f6442.5

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    7. Applied rewrites42.5%

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
      2. remove-double-negN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot x.re\right)}{y.im} \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      5. lift-*.f64N/A

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

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      8. *-commutativeN/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      9. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{-x.re \cdot 1}{y.im} \]
      11. *-rgt-identity42.5

        \[\leadsto \frac{-x.re}{y.im} \]
    9. Applied rewrites42.5%

      \[\leadsto \frac{-x.re}{\color{blue}{y.im}} \]

    if -2.5999999999999999e44 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    7. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      3. associate-*l/N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. mult-flipN/A

        \[\leadsto \frac{x.im - \left(x.re \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      5. remove-double-negN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot y.im\right)\right)\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      6. distribute-lft-neg-outN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re\right)\right) \cdot y.im\right)\right) \cdot \frac{1}{y.re}}{y.re} \]
      7. mul-1-negN/A

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

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

        \[\leadsto \frac{x.im - \left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot y.im\right) \cdot \frac{1}{y.re}}{y.re} \]
      10. associate-*l*N/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \left(y.im \cdot \frac{1}{y.re}\right)}{y.re} \]
      11. mult-flipN/A

        \[\leadsto \frac{x.im - \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right) \cdot \frac{y.im}{y.re}}{y.re} \]
      12. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      13. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      14. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      15. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.re} \]
      17. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{y.re} \]
      18. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot \left(x.re \cdot 1\right)}{y.re} \]
      19. *-rgt-identity55.1

        \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
    8. Applied rewrites55.1%

      \[\leadsto \frac{x.im - \frac{y.im}{y.re} \cdot x.re}{y.re} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 12: 72.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.6 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- x.re) y.im)))
   (if (<= y.im -2.6e+44)
     t_0
     (if (<= y.im 9e+81) (/ (- x.im (* (/ x.re y.re) y.im)) y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.6e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -x_46re / y_46im
    if (y_46im <= (-2.6d+44)) then
        tmp = t_0
    else if (y_46im <= 9d+81) then
        tmp = (x_46im - ((x_46re / y_46re) * y_46im)) / y_46re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.6e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = -x_46_re / y_46_im
	tmp = 0
	if y_46_im <= -2.6e+44:
		tmp = t_0
	elif y_46_im <= 9e+81:
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(-x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -2.6e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re / y_46_re) * y_46_im)) / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = -x_46_re / y_46_im;
	tmp = 0.0;
	if (y_46_im <= -2.6e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = (x_46_im - ((x_46_re / y_46_re) * y_46_im)) / y_46_re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.6e+44], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(N[(x$46$im - N[(N[(x$46$re / y$46$re), $MachinePrecision] * y$46$im), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.6 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -2.5999999999999999e44 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}} \]
    5. Taylor expanded in x.re around inf

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    6. Step-by-step derivation
      1. lower-*.f6442.5

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    7. Applied rewrites42.5%

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
      2. remove-double-negN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot x.re\right)}{y.im} \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      5. lift-*.f64N/A

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

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      8. *-commutativeN/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      9. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{-x.re \cdot 1}{y.im} \]
      11. *-rgt-identity42.5

        \[\leadsto \frac{-x.re}{y.im} \]
    9. Applied rewrites42.5%

      \[\leadsto \frac{-x.re}{\color{blue}{y.im}} \]

    if -2.5999999999999999e44 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{\color{blue}{y.re}} \]
      2. lower-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. lower-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. lower-/.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower-*.f6453.3

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
    4. Applied rewrites53.3%

      \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    5. Step-by-step derivation
      1. lift-+.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      3. mul-1-negN/A

        \[\leadsto \frac{x.im + \left(\mathsf{neg}\left(\frac{x.re \cdot y.im}{y.re}\right)\right)}{y.re} \]
      4. sub-flip-reverseN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      5. lower--.f6453.3

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      6. lift-/.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      8. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{y.im \cdot x.re}{y.re}}{y.re} \]
      9. associate-/l*N/A

        \[\leadsto \frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re} \]
      10. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      11. lower-*.f64N/A

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
      12. frac-2negN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      13. *-rgt-identityN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot 1\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      14. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      15. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      16. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{\mathsf{neg}\left(y.re\right)} \cdot y.im}{y.re} \]
      17. frac-2neg-revN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      18. lower-/.f64N/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(-1 \cdot x.re\right)}{y.re} \cdot y.im}{y.re} \]
      19. *-commutativeN/A

        \[\leadsto \frac{x.im - \frac{\mathsf{neg}\left(x.re \cdot -1\right)}{y.re} \cdot y.im}{y.re} \]
      20. distribute-rgt-neg-outN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot \left(\mathsf{neg}\left(-1\right)\right)}{y.re} \cdot y.im}{y.re} \]
      21. metadata-evalN/A

        \[\leadsto \frac{x.im - \frac{x.re \cdot 1}{y.re} \cdot y.im}{y.re} \]
      22. *-rgt-identity54.5

        \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
    6. Applied rewrites54.5%

      \[\leadsto \frac{x.im - \frac{x.re}{y.re} \cdot y.im}{y.re} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 13: 63.5% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -2.35 \cdot 10^{+44}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (let* ((t_0 (/ (- x.re) y.im)))
   (if (<= y.im -2.35e+44) t_0 (if (<= y.im 9e+81) (/ x.im y.re) t_0))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.35e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

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

real(8) function code(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    real(8) :: t_0
    real(8) :: tmp
    t_0 = -x_46re / y_46im
    if (y_46im <= (-2.35d+44)) then
        tmp = t_0
    else if (y_46im <= 9d+81) then
        tmp = x_46im / y_46re
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double t_0 = -x_46_re / y_46_im;
	double tmp;
	if (y_46_im <= -2.35e+44) {
		tmp = t_0;
	} else if (y_46_im <= 9e+81) {
		tmp = x_46_im / y_46_re;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	t_0 = -x_46_re / y_46_im
	tmp = 0
	if y_46_im <= -2.35e+44:
		tmp = t_0
	elif y_46_im <= 9e+81:
		tmp = x_46_im / y_46_re
	else:
		tmp = t_0
	return tmp
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = Float64(Float64(-x_46_re) / y_46_im)
	tmp = 0.0
	if (y_46_im <= -2.35e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = Float64(x_46_im / y_46_re);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
	t_0 = -x_46_re / y_46_im;
	tmp = 0.0;
	if (y_46_im <= -2.35e+44)
		tmp = t_0;
	elseif (y_46_im <= 9e+81)
		tmp = x_46_im / y_46_re;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := Block[{t$95$0 = N[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -2.35e+44], t$95$0, If[LessEqual[y$46$im, 9e+81], N[(x$46$im / y$46$re), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-x.re}{y.im}\\
\mathbf{if}\;y.im \leq -2.35 \cdot 10^{+44}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;y.im \leq 9 \cdot 10^{+81}:\\
\;\;\;\;\frac{x.im}{y.re}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if y.im < -2.35000000000000009e44 or 9.00000000000000034e81 < y.im

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.im around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{y.im}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot x.re + \frac{x.im \cdot y.re}{y.im}}{\color{blue}{y.im}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
      4. lower-*.f6451.8

        \[\leadsto \frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im} \]
    4. Applied rewrites51.8%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, x.re, \frac{x.im \cdot y.re}{y.im}\right)}{y.im}} \]
    5. Taylor expanded in x.re around inf

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    6. Step-by-step derivation
      1. lower-*.f6442.5

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    7. Applied rewrites42.5%

      \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot x.re}{y.im} \]
      2. remove-double-negN/A

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

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1\right)\right) \cdot x.re\right)}{y.im} \]
      4. distribute-lft-neg-outN/A

        \[\leadsto \frac{\mathsf{neg}\left(\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)\right)}{y.im} \]
      5. lift-*.f64N/A

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

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(-1 \cdot x.re\right)\right)}{y.im} \]
      8. *-commutativeN/A

        \[\leadsto \frac{-\left(\mathsf{neg}\left(x.re \cdot -1\right)\right)}{y.im} \]
      9. distribute-rgt-neg-outN/A

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

        \[\leadsto \frac{-x.re \cdot 1}{y.im} \]
      11. *-rgt-identity42.5

        \[\leadsto \frac{-x.re}{y.im} \]
    9. Applied rewrites42.5%

      \[\leadsto \frac{-x.re}{\color{blue}{y.im}} \]

    if -2.35000000000000009e44 < y.im < 9.00000000000000034e81

    1. Initial program 62.2%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Taylor expanded in y.re around inf

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    3. Step-by-step derivation
      1. lower-/.f6443.4

        \[\leadsto \frac{x.im}{\color{blue}{y.re}} \]
    4. Applied rewrites43.4%

      \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 14: 43.4% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \frac{x.im}{y.re} \end{array} \]
(FPCore (x.re x.im y.re y.im) :precision binary64 (/ x.im y.re))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im / y_46_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(x_46re, x_46im, y_46re, y_46im)
use fmin_fmax_functions
    real(8), intent (in) :: x_46re
    real(8), intent (in) :: x_46im
    real(8), intent (in) :: y_46re
    real(8), intent (in) :: y_46im
    code = x_46im / y_46re
end function
public static double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	return x_46_im / y_46_re;
}
def code(x_46_re, x_46_im, y_46_re, y_46_im):
	return x_46_im / y_46_re
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	return Float64(x_46_im / y_46_re)
end
function tmp = code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = x_46_im / y_46_re;
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := N[(x$46$im / y$46$re), $MachinePrecision]
\begin{array}{l}

\\
\frac{x.im}{y.re}
\end{array}
Derivation
  1. Initial program 62.2%

    \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
  2. Taylor expanded in y.re around inf

    \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  3. Step-by-step derivation
    1. lower-/.f6443.4

      \[\leadsto \frac{x.im}{\color{blue}{y.re}} \]
  4. Applied rewrites43.4%

    \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
  5. Add Preprocessing

Reproduce

?
herbie shell --seed 2025156 
(FPCore (x.re x.im y.re y.im)
  :name "_divideComplex, imaginary part"
  :precision binary64
  (/ (- (* x.im y.re) (* x.re y.im)) (+ (* y.re y.re) (* y.im y.im))))