_divideComplex, imaginary part

Percentage Accurate: 61.2% → 80.5%
Time: 6.3s
Alternatives: 9
Speedup: 1.5×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 9 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: 61.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: 80.5% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -2.1 \cdot 10^{+147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, -x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq -9.2 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-x.re, y.im, x.im \cdot y.re\right)}{\mathsf{fma}\left(y.im, y.im, y.re \cdot y.re\right)}\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\ \end{array} \end{array} \]
(FPCore (x.re x.im y.re y.im)
 :precision binary64
 (if (<= y.im -2.1e+147)
   (/ (fma (/ y.re y.im) x.im (- x.re)) y.im)
   (if (<= y.im -9.2e-97)
     (/ (fma (- x.re) y.im (* x.im y.re)) (fma y.im y.im (* y.re y.re)))
     (if (<= y.im 4e-9)
       (/ (- x.im (/ (* x.re y.im) y.re)) y.re)
       (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)))))
double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
	double tmp;
	if (y_46_im <= -2.1e+147) {
		tmp = fma((y_46_re / y_46_im), x_46_im, -x_46_re) / y_46_im;
	} else if (y_46_im <= -9.2e-97) {
		tmp = fma(-x_46_re, y_46_im, (x_46_im * y_46_re)) / fma(y_46_im, y_46_im, (y_46_re * y_46_re));
	} else if (y_46_im <= 4e-9) {
		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
	} else {
		tmp = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
	}
	return tmp;
}
function code(x_46_re, x_46_im, y_46_re, y_46_im)
	tmp = 0.0
	if (y_46_im <= -2.1e+147)
		tmp = Float64(fma(Float64(y_46_re / y_46_im), x_46_im, Float64(-x_46_re)) / y_46_im);
	elseif (y_46_im <= -9.2e-97)
		tmp = Float64(fma(Float64(-x_46_re), y_46_im, Float64(x_46_im * y_46_re)) / fma(y_46_im, y_46_im, Float64(y_46_re * y_46_re)));
	elseif (y_46_im <= 4e-9)
		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
	else
		tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im);
	end
	return tmp
end
code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -2.1e+147], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$im + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, -9.2e-97], N[(N[((-x$46$re) * y$46$im + N[(x$46$im * y$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$im, 4e-9], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if y.im < -2.10000000000000006e147

    1. Initial program 29.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. Taylor expanded in y.re around 0

      \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \frac{-1 \cdot x.re}{y.im} + \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} \]
      3. associate-/r*N/A

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

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

        \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}}{y.im} \]
      6. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1} \cdot x.re}{y.im} \]
      8. *-lft-identityN/A

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

        \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
      10. *-lft-identityN/A

        \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1 \cdot x.re}}{y.im} \]
      11. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
      18. lower-neg.f6487.5

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

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

    if -2.10000000000000006e147 < y.im < -9.19999999999999976e-97

    1. Initial program 83.3%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. 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. lift-*.f64N/A

        \[\leadsto \frac{x.im \cdot y.re - \color{blue}{x.re \cdot y.im}}{y.re \cdot y.re + y.im \cdot y.im} \]
      3. fp-cancel-sub-sign-invN/A

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

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

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\mathsf{neg}\left(x.re\right), y.im, x.im \cdot y.re\right)}}{y.re \cdot y.re + y.im \cdot y.im} \]
      6. lower-neg.f6483.3

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

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

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

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

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

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

    if -9.19999999999999976e-97 < y.im < 4.00000000000000025e-9

    1. Initial program 73.5%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      2. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. *-lft-identityN/A

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

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

        \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
      7. lower-*.f6488.9

        \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
    5. Applied rewrites88.9%

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

    if 4.00000000000000025e-9 < y.im

    1. Initial program 54.1%

      \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
    2. Add Preprocessing
    3. 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}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      2. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
      4. *-lft-identityN/A

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

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

        \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
      7. lower-*.f6414.7

        \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
    5. Applied rewrites14.7%

      \[\leadsto \color{blue}{\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
    6. Step-by-step derivation
      1. Applied rewrites16.5%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
      3. Step-by-step derivation
        1. associate-*r/N/A

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

          \[\leadsto \frac{-1 \cdot x.re}{y.im} + \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} \]
        3. associate-/r*N/A

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

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

          \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}}{y.im} \]
        6. fp-cancel-sign-sub-invN/A

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

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1} \cdot x.re}{y.im} \]
        8. *-lft-identityN/A

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

          \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
        10. *-lft-identityN/A

          \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1 \cdot x.re}}{y.im} \]
        11. metadata-evalN/A

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

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

          \[\leadsto \frac{\frac{\color{blue}{y.re \cdot x.im}}{y.im} + -1 \cdot x.re}{y.im} \]
        14. associate-/l*N/A

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
        18. lower-neg.f6486.9

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

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

    Alternative 2: 65.4% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ t_1 := x.im \cdot y.re - x.re \cdot y.im\\ t_2 := \frac{t\_1}{y.im \cdot y.im}\\ \mathbf{if}\;y.im \leq -2 \cdot 10^{+147}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq -200000:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;y.im \leq -2.2 \cdot 10^{-207}:\\ \;\;\;\;\frac{t\_1}{y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;t\_2\\ \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))
            (t_1 (- (* x.im y.re) (* x.re y.im)))
            (t_2 (/ t_1 (* y.im y.im))))
       (if (<= y.im -2e+147)
         t_0
         (if (<= y.im -200000.0)
           t_2
           (if (<= y.im -2.2e-207)
             (/ t_1 (* y.re y.re))
             (if (<= y.im 2.15e-10)
               (/ x.im y.re)
               (if (<= y.im 2.3e+135) t_2 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 t_1 = (x_46_im * y_46_re) - (x_46_re * y_46_im);
    	double t_2 = t_1 / (y_46_im * y_46_im);
    	double tmp;
    	if (y_46_im <= -2e+147) {
    		tmp = t_0;
    	} else if (y_46_im <= -200000.0) {
    		tmp = t_2;
    	} else if (y_46_im <= -2.2e-207) {
    		tmp = t_1 / (y_46_re * y_46_re);
    	} else if (y_46_im <= 2.15e-10) {
    		tmp = x_46_im / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = t_2;
    	} 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) :: t_1
        real(8) :: t_2
        real(8) :: tmp
        t_0 = -x_46re / y_46im
        t_1 = (x_46im * y_46re) - (x_46re * y_46im)
        t_2 = t_1 / (y_46im * y_46im)
        if (y_46im <= (-2d+147)) then
            tmp = t_0
        else if (y_46im <= (-200000.0d0)) then
            tmp = t_2
        else if (y_46im <= (-2.2d-207)) then
            tmp = t_1 / (y_46re * y_46re)
        else if (y_46im <= 2.15d-10) then
            tmp = x_46im / y_46re
        else if (y_46im <= 2.3d+135) then
            tmp = t_2
        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 t_1 = (x_46_im * y_46_re) - (x_46_re * y_46_im);
    	double t_2 = t_1 / (y_46_im * y_46_im);
    	double tmp;
    	if (y_46_im <= -2e+147) {
    		tmp = t_0;
    	} else if (y_46_im <= -200000.0) {
    		tmp = t_2;
    	} else if (y_46_im <= -2.2e-207) {
    		tmp = t_1 / (y_46_re * y_46_re);
    	} else if (y_46_im <= 2.15e-10) {
    		tmp = x_46_im / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = t_2;
    	} 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
    	t_1 = (x_46_im * y_46_re) - (x_46_re * y_46_im)
    	t_2 = t_1 / (y_46_im * y_46_im)
    	tmp = 0
    	if y_46_im <= -2e+147:
    		tmp = t_0
    	elif y_46_im <= -200000.0:
    		tmp = t_2
    	elif y_46_im <= -2.2e-207:
    		tmp = t_1 / (y_46_re * y_46_re)
    	elif y_46_im <= 2.15e-10:
    		tmp = x_46_im / y_46_re
    	elif y_46_im <= 2.3e+135:
    		tmp = t_2
    	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)
    	t_1 = Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im))
    	t_2 = Float64(t_1 / Float64(y_46_im * y_46_im))
    	tmp = 0.0
    	if (y_46_im <= -2e+147)
    		tmp = t_0;
    	elseif (y_46_im <= -200000.0)
    		tmp = t_2;
    	elseif (y_46_im <= -2.2e-207)
    		tmp = Float64(t_1 / Float64(y_46_re * y_46_re));
    	elseif (y_46_im <= 2.15e-10)
    		tmp = Float64(x_46_im / y_46_re);
    	elseif (y_46_im <= 2.3e+135)
    		tmp = t_2;
    	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;
    	t_1 = (x_46_im * y_46_re) - (x_46_re * y_46_im);
    	t_2 = t_1 / (y_46_im * y_46_im);
    	tmp = 0.0;
    	if (y_46_im <= -2e+147)
    		tmp = t_0;
    	elseif (y_46_im <= -200000.0)
    		tmp = t_2;
    	elseif (y_46_im <= -2.2e-207)
    		tmp = t_1 / (y_46_re * y_46_re);
    	elseif (y_46_im <= 2.15e-10)
    		tmp = x_46_im / y_46_re;
    	elseif (y_46_im <= 2.3e+135)
    		tmp = t_2;
    	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]}, Block[{t$95$1 = N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t$95$1 / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y$46$im, -2e+147], t$95$0, If[LessEqual[y$46$im, -200000.0], t$95$2, If[LessEqual[y$46$im, -2.2e-207], N[(t$95$1 / N[(y$46$re * y$46$re), $MachinePrecision]), $MachinePrecision], If[LessEqual[y$46$im, 2.15e-10], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+135], t$95$2, t$95$0]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    t_1 := x.im \cdot y.re - x.re \cdot y.im\\
    t_2 := \frac{t\_1}{y.im \cdot y.im}\\
    \mathbf{if}\;y.im \leq -2 \cdot 10^{+147}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq -200000:\\
    \;\;\;\;t\_2\\
    
    \mathbf{elif}\;y.im \leq -2.2 \cdot 10^{-207}:\\
    \;\;\;\;\frac{t\_1}{y.re \cdot y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\
    \;\;\;\;\frac{x.im}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\
    \;\;\;\;t\_2\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if y.im < -2e147 or 2.3000000000000001e135 < y.im

      1. Initial program 29.8%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

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

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

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

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

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6481.6

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites81.6%

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

      if -2e147 < y.im < -2e5 or 2.15000000000000007e-10 < y.im < 2.3000000000000001e135

      1. Initial program 79.6%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 0

        \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{{y.im}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
        2. lower-*.f6468.4

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
      5. Applied rewrites68.4%

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

      if -2e5 < y.im < -2.1999999999999999e-207

      1. Initial program 87.3%

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

        \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{{y.re}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.re \cdot y.re}} \]
        2. lower-*.f6472.1

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.re \cdot y.re}} \]
      5. Applied rewrites72.1%

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

      if -2.1999999999999999e-207 < y.im < 2.15000000000000007e-10

      1. Initial program 72.0%

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

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      4. Step-by-step derivation
        1. lower-/.f6471.6

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
      5. Applied rewrites71.6%

        \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
    3. Recombined 4 regimes into one program.
    4. Final simplification73.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -2 \cdot 10^{+147}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq -200000:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{elif}\;y.im \leq -2.2 \cdot 10^{-207}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re}\\ \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 3: 73.7% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot 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.re) y.im)))
       (if (<= y.im -4.2e+81)
         t_0
         (if (<= y.im 4e-9)
           (/ (- x.im (/ (* x.re y.im) y.re)) y.re)
           (if (<= y.im 2.3e+135)
             (/ (- (* x.im y.re) (* x.re y.im)) (* y.im 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_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.2e+81) {
    		tmp = t_0;
    	} else if (y_46_im <= 4e-9) {
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_46re / y_46im
        if (y_46im <= (-4.2d+81)) then
            tmp = t_0
        else if (y_46im <= 4d-9) then
            tmp = (x_46im - ((x_46re * y_46im) / y_46re)) / y_46re
        else if (y_46im <= 2.3d+135) then
            tmp = ((x_46im * y_46re) - (x_46re * y_46im)) / (y_46im * 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_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.2e+81) {
    		tmp = t_0;
    	} else if (y_46_im <= 4e-9) {
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re / y_46_im
    	tmp = 0
    	if y_46_im <= -4.2e+81:
    		tmp = t_0
    	elif y_46_im <= 4e-9:
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re
    	elif y_46_im <= 2.3e+135:
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -4.2e+81)
    		tmp = t_0;
    	elseif (y_46_im <= 4e-9)
    		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
    	elseif (y_46_im <= 2.3e+135)
    		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * 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_re / y_46_im;
    	tmp = 0.0;
    	if (y_46_im <= -4.2e+81)
    		tmp = t_0;
    	elseif (y_46_im <= 4e-9)
    		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
    	elseif (y_46_im <= 2.3e+135)
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+81], t$95$0, If[LessEqual[y$46$im, 4e-9], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+135], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\
    \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\
    \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -4.1999999999999997e81 or 2.3000000000000001e135 < y.im

      1. Initial program 38.2%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

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

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

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

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

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6480.6

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites80.6%

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

      if -4.1999999999999997e81 < y.im < 4.00000000000000025e-9

      1. Initial program 75.0%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. 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}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        2. fp-cancel-sign-sub-invN/A

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

          \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
        4. *-lft-identityN/A

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

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

          \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        7. lower-*.f6482.2

          \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
      5. Applied rewrites82.2%

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

      if 4.00000000000000025e-9 < y.im < 2.3000000000000001e135

      1. Initial program 80.9%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 0

        \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{{y.im}^{2}}} \]
      4. Step-by-step derivation
        1. unpow2N/A

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

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
      5. Applied rewrites75.2%

        \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification81.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 73.1% accurate, 0.8× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot 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.re) y.im)))
       (if (<= y.im -4.2e+81)
         t_0
         (if (<= y.im 4e-9)
           (/ (- x.im (* y.im (/ x.re y.re))) y.re)
           (if (<= y.im 2.3e+135)
             (/ (- (* x.im y.re) (* x.re y.im)) (* y.im 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_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.2e+81) {
    		tmp = t_0;
    	} else if (y_46_im <= 4e-9) {
    		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_46re / y_46im
        if (y_46im <= (-4.2d+81)) then
            tmp = t_0
        else if (y_46im <= 4d-9) then
            tmp = (x_46im - (y_46im * (x_46re / y_46re))) / y_46re
        else if (y_46im <= 2.3d+135) then
            tmp = ((x_46im * y_46re) - (x_46re * y_46im)) / (y_46im * 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_re / y_46_im;
    	double tmp;
    	if (y_46_im <= -4.2e+81) {
    		tmp = t_0;
    	} else if (y_46_im <= 4e-9) {
    		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
    	} else if (y_46_im <= 2.3e+135) {
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re / y_46_im
    	tmp = 0
    	if y_46_im <= -4.2e+81:
    		tmp = t_0
    	elif y_46_im <= 4e-9:
    		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re
    	elif y_46_im <= 2.3e+135:
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re) / y_46_im)
    	tmp = 0.0
    	if (y_46_im <= -4.2e+81)
    		tmp = t_0;
    	elseif (y_46_im <= 4e-9)
    		tmp = Float64(Float64(x_46_im - Float64(y_46_im * Float64(x_46_re / y_46_re))) / y_46_re);
    	elseif (y_46_im <= 2.3e+135)
    		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * 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_re / y_46_im;
    	tmp = 0.0;
    	if (y_46_im <= -4.2e+81)
    		tmp = t_0;
    	elseif (y_46_im <= 4e-9)
    		tmp = (x_46_im - (y_46_im * (x_46_re / y_46_re))) / y_46_re;
    	elseif (y_46_im <= 2.3e+135)
    		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+81], t$95$0, If[LessEqual[y$46$im, 4e-9], N[(N[(x$46$im - N[(y$46$im * N[(x$46$re / y$46$re), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+135], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{-x.re}{y.im}\\
    \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\
    \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\
    
    \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\
    \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if y.im < -4.1999999999999997e81 or 2.3000000000000001e135 < y.im

      1. Initial program 38.2%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. Taylor expanded in y.re around 0

        \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
      4. Step-by-step derivation
        1. mul-1-negN/A

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

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

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

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

          \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
        6. lower-neg.f6480.6

          \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
      5. Applied rewrites80.6%

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

      if -4.1999999999999997e81 < y.im < 4.00000000000000025e-9

      1. Initial program 75.0%

        \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
      2. Add Preprocessing
      3. 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}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        2. fp-cancel-sign-sub-invN/A

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

          \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
        4. *-lft-identityN/A

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

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

          \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
        7. lower-*.f6482.2

          \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
      5. Applied rewrites82.2%

        \[\leadsto \color{blue}{\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
      6. Step-by-step derivation
        1. Applied rewrites79.6%

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

        if 4.00000000000000025e-9 < y.im < 2.3000000000000001e135

        1. Initial program 80.9%

          \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
        2. Add Preprocessing
        3. Taylor expanded in y.re around 0

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{{y.im}^{2}}} \]
        4. Step-by-step derivation
          1. unpow2N/A

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

            \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
        5. Applied rewrites75.2%

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
      7. Recombined 3 regimes into one program.
      8. Final simplification79.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - y.im \cdot \frac{x.re}{y.re}}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 5: 64.7% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-x.re}{y.im}\\ \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot 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.re) y.im)))
         (if (<= y.im -4.2e+81)
           t_0
           (if (<= y.im 2.15e-10)
             (/ x.im y.re)
             (if (<= y.im 2.3e+135)
               (/ (- (* x.im y.re) (* x.re y.im)) (* y.im 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_re / y_46_im;
      	double tmp;
      	if (y_46_im <= -4.2e+81) {
      		tmp = t_0;
      	} else if (y_46_im <= 2.15e-10) {
      		tmp = x_46_im / y_46_re;
      	} else if (y_46_im <= 2.3e+135) {
      		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_46re / y_46im
          if (y_46im <= (-4.2d+81)) then
              tmp = t_0
          else if (y_46im <= 2.15d-10) then
              tmp = x_46im / y_46re
          else if (y_46im <= 2.3d+135) then
              tmp = ((x_46im * y_46re) - (x_46re * y_46im)) / (y_46im * 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_re / y_46_im;
      	double tmp;
      	if (y_46_im <= -4.2e+81) {
      		tmp = t_0;
      	} else if (y_46_im <= 2.15e-10) {
      		tmp = x_46_im / y_46_re;
      	} else if (y_46_im <= 2.3e+135) {
      		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re / y_46_im
      	tmp = 0
      	if y_46_im <= -4.2e+81:
      		tmp = t_0
      	elif y_46_im <= 2.15e-10:
      		tmp = x_46_im / y_46_re
      	elif y_46_im <= 2.3e+135:
      		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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_re) / y_46_im)
      	tmp = 0.0
      	if (y_46_im <= -4.2e+81)
      		tmp = t_0;
      	elseif (y_46_im <= 2.15e-10)
      		tmp = Float64(x_46_im / y_46_re);
      	elseif (y_46_im <= 2.3e+135)
      		tmp = Float64(Float64(Float64(x_46_im * y_46_re) - Float64(x_46_re * y_46_im)) / Float64(y_46_im * 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_re / y_46_im;
      	tmp = 0.0;
      	if (y_46_im <= -4.2e+81)
      		tmp = t_0;
      	elseif (y_46_im <= 2.15e-10)
      		tmp = x_46_im / y_46_re;
      	elseif (y_46_im <= 2.3e+135)
      		tmp = ((x_46_im * y_46_re) - (x_46_re * y_46_im)) / (y_46_im * 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[((-x$46$re) / y$46$im), $MachinePrecision]}, If[LessEqual[y$46$im, -4.2e+81], t$95$0, If[LessEqual[y$46$im, 2.15e-10], N[(x$46$im / y$46$re), $MachinePrecision], If[LessEqual[y$46$im, 2.3e+135], N[(N[(N[(x$46$im * y$46$re), $MachinePrecision] - N[(x$46$re * y$46$im), $MachinePrecision]), $MachinePrecision] / N[(y$46$im * y$46$im), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{-x.re}{y.im}\\
      \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\
      \;\;\;\;\frac{x.im}{y.re}\\
      
      \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\
      \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if y.im < -4.1999999999999997e81 or 2.3000000000000001e135 < y.im

        1. Initial program 38.2%

          \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
        2. Add Preprocessing
        3. Taylor expanded in y.re around 0

          \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
        4. Step-by-step derivation
          1. mul-1-negN/A

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

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

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

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

            \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
          6. lower-neg.f6480.6

            \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
        5. Applied rewrites80.6%

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

        if -4.1999999999999997e81 < y.im < 2.15000000000000007e-10

        1. Initial program 75.0%

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

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
        4. Step-by-step derivation
          1. lower-/.f6464.0

            \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
        5. Applied rewrites64.0%

          \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]

        if 2.15000000000000007e-10 < y.im < 2.3000000000000001e135

        1. Initial program 80.9%

          \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
        2. Add Preprocessing
        3. Taylor expanded in y.re around 0

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{{y.im}^{2}}} \]
        4. Step-by-step derivation
          1. unpow2N/A

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

            \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
        5. Applied rewrites75.2%

          \[\leadsto \frac{x.im \cdot y.re - x.re \cdot y.im}{\color{blue}{y.im \cdot y.im}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification70.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{elif}\;y.im \leq 2.15 \cdot 10^{-10}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \mathbf{elif}\;y.im \leq 2.3 \cdot 10^{+135}:\\ \;\;\;\;\frac{x.im \cdot y.re - x.re \cdot y.im}{y.im \cdot y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{-x.re}{y.im}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 6: 78.2% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -7.7 \cdot 10^{+68} \lor \neg \left(y.im \leq 4 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \end{array} \end{array} \]
      (FPCore (x.re x.im y.re y.im)
       :precision binary64
       (if (or (<= y.im -7.7e+68) (not (<= y.im 4e-9)))
         (/ (fma y.re (/ x.im y.im) (- x.re)) y.im)
         (/ (- x.im (/ (* x.re y.im) y.re)) 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_im <= -7.7e+68) || !(y_46_im <= 4e-9)) {
      		tmp = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
      	} else {
      		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / 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_im <= -7.7e+68) || !(y_46_im <= 4e-9))
      		tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im);
      	else
      		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
      	end
      	return tmp
      end
      
      code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -7.7e+68], N[Not[LessEqual[y$46$im, 4e-9]], $MachinePrecision]], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;y.im \leq -7.7 \cdot 10^{+68} \lor \neg \left(y.im \leq 4 \cdot 10^{-9}\right):\\
      \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if y.im < -7.6999999999999998e68 or 4.00000000000000025e-9 < y.im

        1. Initial program 49.5%

          \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
        2. Add Preprocessing
        3. 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}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
          2. fp-cancel-sign-sub-invN/A

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

            \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
          4. *-lft-identityN/A

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

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

            \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
          7. lower-*.f6413.5

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

          \[\leadsto \color{blue}{\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        6. Step-by-step derivation
          1. Applied rewrites16.6%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
          3. Step-by-step derivation
            1. associate-*r/N/A

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

              \[\leadsto \frac{-1 \cdot x.re}{y.im} + \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} \]
            3. associate-/r*N/A

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

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

              \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}}{y.im} \]
            6. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1} \cdot x.re}{y.im} \]
            8. *-lft-identityN/A

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

              \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
            10. *-lft-identityN/A

              \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1 \cdot x.re}}{y.im} \]
            11. metadata-evalN/A

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

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

              \[\leadsto \frac{\frac{\color{blue}{y.re \cdot x.im}}{y.im} + -1 \cdot x.re}{y.im} \]
            14. associate-/l*N/A

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
            18. lower-neg.f6486.9

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

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

          if -7.6999999999999998e68 < y.im < 4.00000000000000025e-9

          1. Initial program 74.6%

            \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
          2. Add Preprocessing
          3. 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}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
            2. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
            4. *-lft-identityN/A

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

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

              \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
            7. lower-*.f6483.3

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

            \[\leadsto \color{blue}{\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
        7. Recombined 2 regimes into one program.
        8. Final simplification84.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -7.7 \cdot 10^{+68} \lor \neg \left(y.im \leq 4 \cdot 10^{-9}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 7: 78.0% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -7.7 \cdot 10^{+68}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, -x.re\right)}{y.im}\\ \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\ \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\ \end{array} \end{array} \]
        (FPCore (x.re x.im y.re y.im)
         :precision binary64
         (if (<= y.im -7.7e+68)
           (/ (fma (/ y.re y.im) x.im (- x.re)) y.im)
           (if (<= y.im 4e-9)
             (/ (- x.im (/ (* x.re y.im) y.re)) y.re)
             (/ (fma y.re (/ x.im y.im) (- x.re)) y.im))))
        double code(double x_46_re, double x_46_im, double y_46_re, double y_46_im) {
        	double tmp;
        	if (y_46_im <= -7.7e+68) {
        		tmp = fma((y_46_re / y_46_im), x_46_im, -x_46_re) / y_46_im;
        	} else if (y_46_im <= 4e-9) {
        		tmp = (x_46_im - ((x_46_re * y_46_im) / y_46_re)) / y_46_re;
        	} else {
        		tmp = fma(y_46_re, (x_46_im / y_46_im), -x_46_re) / y_46_im;
        	}
        	return tmp;
        }
        
        function code(x_46_re, x_46_im, y_46_re, y_46_im)
        	tmp = 0.0
        	if (y_46_im <= -7.7e+68)
        		tmp = Float64(fma(Float64(y_46_re / y_46_im), x_46_im, Float64(-x_46_re)) / y_46_im);
        	elseif (y_46_im <= 4e-9)
        		tmp = Float64(Float64(x_46_im - Float64(Float64(x_46_re * y_46_im) / y_46_re)) / y_46_re);
        	else
        		tmp = Float64(fma(y_46_re, Float64(x_46_im / y_46_im), Float64(-x_46_re)) / y_46_im);
        	end
        	return tmp
        end
        
        code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[LessEqual[y$46$im, -7.7e+68], N[(N[(N[(y$46$re / y$46$im), $MachinePrecision] * x$46$im + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision], If[LessEqual[y$46$im, 4e-9], N[(N[(x$46$im - N[(N[(x$46$re * y$46$im), $MachinePrecision] / y$46$re), $MachinePrecision]), $MachinePrecision] / y$46$re), $MachinePrecision], N[(N[(y$46$re * N[(x$46$im / y$46$im), $MachinePrecision] + (-x$46$re)), $MachinePrecision] / y$46$im), $MachinePrecision]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;y.im \leq -7.7 \cdot 10^{+68}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, -x.re\right)}{y.im}\\
        
        \mathbf{elif}\;y.im \leq 4 \cdot 10^{-9}:\\
        \;\;\;\;\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, -x.re\right)}{y.im}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if y.im < -7.6999999999999998e68

          1. Initial program 44.6%

            \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
          2. Add Preprocessing
          3. Taylor expanded in y.re around 0

            \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

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

              \[\leadsto \frac{-1 \cdot x.re}{y.im} + \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} \]
            3. associate-/r*N/A

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

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

              \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}}{y.im} \]
            6. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1} \cdot x.re}{y.im} \]
            8. *-lft-identityN/A

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

              \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
            10. *-lft-identityN/A

              \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1 \cdot x.re}}{y.im} \]
            11. fp-cancel-sub-sign-invN/A

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

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(\frac{y.re}{y.im}, x.im, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
            18. lower-neg.f6486.9

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

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

          if -7.6999999999999998e68 < y.im < 4.00000000000000025e-9

          1. Initial program 74.6%

            \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
          2. Add Preprocessing
          3. 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}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
            2. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
            4. *-lft-identityN/A

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

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

              \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
            7. lower-*.f6483.3

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

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

          if 4.00000000000000025e-9 < y.im

          1. Initial program 54.1%

            \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
          2. Add Preprocessing
          3. 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}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{x.im + -1 \cdot \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
            2. fp-cancel-sign-sub-invN/A

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

              \[\leadsto \frac{x.im - \color{blue}{1} \cdot \frac{x.re \cdot y.im}{y.re}}{y.re} \]
            4. *-lft-identityN/A

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

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

              \[\leadsto \frac{x.im - \color{blue}{\frac{x.re \cdot y.im}{y.re}}}{y.re} \]
            7. lower-*.f6414.7

              \[\leadsto \frac{x.im - \frac{\color{blue}{x.re \cdot y.im}}{y.re}}{y.re} \]
          5. Applied rewrites14.7%

            \[\leadsto \color{blue}{\frac{x.im - \frac{x.re \cdot y.im}{y.re}}{y.re}} \]
          6. Step-by-step derivation
            1. Applied rewrites16.5%

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

              \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im} + \frac{x.im \cdot y.re}{{y.im}^{2}}} \]
            3. Step-by-step derivation
              1. associate-*r/N/A

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

                \[\leadsto \frac{-1 \cdot x.re}{y.im} + \frac{x.im \cdot y.re}{\color{blue}{y.im \cdot y.im}} \]
              3. associate-/r*N/A

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

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

                \[\leadsto \frac{\color{blue}{\frac{x.im \cdot y.re}{y.im} + -1 \cdot x.re}}{y.im} \]
              6. fp-cancel-sign-sub-invN/A

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

                \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1} \cdot x.re}{y.im} \]
              8. *-lft-identityN/A

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

                \[\leadsto \color{blue}{\frac{\frac{x.im \cdot y.re}{y.im} - x.re}{y.im}} \]
              10. *-lft-identityN/A

                \[\leadsto \frac{\frac{x.im \cdot y.re}{y.im} - \color{blue}{1 \cdot x.re}}{y.im} \]
              11. metadata-evalN/A

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

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

                \[\leadsto \frac{\frac{\color{blue}{y.re \cdot x.im}}{y.im} + -1 \cdot x.re}{y.im} \]
              14. associate-/l*N/A

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(y.re, \frac{x.im}{y.im}, \color{blue}{\mathsf{neg}\left(x.re\right)}\right)}{y.im} \]
              18. lower-neg.f6486.9

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

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

          Alternative 8: 63.7% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81} \lor \neg \left(y.im \leq 2.3 \cdot 10^{-10}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \end{array} \]
          (FPCore (x.re x.im y.re y.im)
           :precision binary64
           (if (or (<= y.im -4.2e+81) (not (<= y.im 2.3e-10)))
             (/ (- x.re) y.im)
             (/ 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_im <= -4.2e+81) || !(y_46_im <= 2.3e-10)) {
          		tmp = -x_46_re / y_46_im;
          	} else {
          		tmp = x_46_im / y_46_re;
          	}
          	return tmp;
          }
          
          module fmin_fmax_functions
              implicit none
              private
              public fmax
              public fmin
          
              interface fmax
                  module procedure fmax88
                  module procedure fmax44
                  module procedure fmax84
                  module procedure fmax48
              end interface
              interface fmin
                  module procedure fmin88
                  module procedure fmin44
                  module procedure fmin84
                  module procedure fmin48
              end interface
          contains
              real(8) function fmax88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(4) function fmax44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, max(x, y), y /= y), x /= x)
              end function
              real(8) function fmax84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmax48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
              end function
              real(8) function fmin88(x, y) result (res)
                  real(8), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(4) function fmin44(x, y) result (res)
                  real(4), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(y, merge(x, min(x, y), y /= y), x /= x)
              end function
              real(8) function fmin84(x, y) result(res)
                  real(8), intent (in) :: x
                  real(4), intent (in) :: y
                  res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
              end function
              real(8) function fmin48(x, y) result(res)
                  real(4), intent (in) :: x
                  real(8), intent (in) :: y
                  res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
              end function
          end module
          
          real(8) function code(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) :: tmp
              if ((y_46im <= (-4.2d+81)) .or. (.not. (y_46im <= 2.3d-10))) then
                  tmp = -x_46re / y_46im
              else
                  tmp = x_46im / y_46re
              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 tmp;
          	if ((y_46_im <= -4.2e+81) || !(y_46_im <= 2.3e-10)) {
          		tmp = -x_46_re / y_46_im;
          	} else {
          		tmp = x_46_im / y_46_re;
          	}
          	return tmp;
          }
          
          def code(x_46_re, x_46_im, y_46_re, y_46_im):
          	tmp = 0
          	if (y_46_im <= -4.2e+81) or not (y_46_im <= 2.3e-10):
          		tmp = -x_46_re / y_46_im
          	else:
          		tmp = 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_im <= -4.2e+81) || !(y_46_im <= 2.3e-10))
          		tmp = Float64(Float64(-x_46_re) / y_46_im);
          	else
          		tmp = Float64(x_46_im / y_46_re);
          	end
          	return tmp
          end
          
          function tmp_2 = code(x_46_re, x_46_im, y_46_re, y_46_im)
          	tmp = 0.0;
          	if ((y_46_im <= -4.2e+81) || ~((y_46_im <= 2.3e-10)))
          		tmp = -x_46_re / y_46_im;
          	else
          		tmp = x_46_im / y_46_re;
          	end
          	tmp_2 = tmp;
          end
          
          code[x$46$re_, x$46$im_, y$46$re_, y$46$im_] := If[Or[LessEqual[y$46$im, -4.2e+81], N[Not[LessEqual[y$46$im, 2.3e-10]], $MachinePrecision]], N[((-x$46$re) / y$46$im), $MachinePrecision], N[(x$46$im / y$46$re), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81} \lor \neg \left(y.im \leq 2.3 \cdot 10^{-10}\right):\\
          \;\;\;\;\frac{-x.re}{y.im}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{x.im}{y.re}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if y.im < -4.1999999999999997e81 or 2.30000000000000007e-10 < y.im

            1. Initial program 48.6%

              \[\frac{x.im \cdot y.re - x.re \cdot y.im}{y.re \cdot y.re + y.im \cdot y.im} \]
            2. Add Preprocessing
            3. Taylor expanded in y.re around 0

              \[\leadsto \color{blue}{-1 \cdot \frac{x.re}{y.im}} \]
            4. Step-by-step derivation
              1. mul-1-negN/A

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

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

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

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

                \[\leadsto \frac{x.re}{\color{blue}{\mathsf{neg}\left(y.im\right)}} \]
              6. lower-neg.f6473.7

                \[\leadsto \frac{x.re}{\color{blue}{-y.im}} \]
            5. Applied rewrites73.7%

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

            if -4.1999999999999997e81 < y.im < 2.30000000000000007e-10

            1. Initial program 75.0%

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

              \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
            4. Step-by-step derivation
              1. lower-/.f6464.0

                \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
            5. Applied rewrites64.0%

              \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification68.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;y.im \leq -4.2 \cdot 10^{+81} \lor \neg \left(y.im \leq 2.3 \cdot 10^{-10}\right):\\ \;\;\;\;\frac{-x.re}{y.im}\\ \mathbf{else}:\\ \;\;\;\;\frac{x.im}{y.re}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 9: 42.3% accurate, 3.2× 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 63.9%

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

            \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
          4. Step-by-step derivation
            1. lower-/.f6442.6

              \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
          5. Applied rewrites42.6%

            \[\leadsto \color{blue}{\frac{x.im}{y.re}} \]
          6. Add Preprocessing

          Reproduce

          ?
          herbie shell --seed 2024360 
          (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))))