Complex division, imag part

Percentage Accurate: 63.4% → 85.1%
Time: 5.0s
Alternatives: 8
Speedup: N/A×

Specification

?
\[\begin{array}{l} \\ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
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(a, b, c, d)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\[\begin{array}{l} \\ \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
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(a, b, c, d)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((b * c) - (a * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
code[a_, b_, c_, d_] := N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\end{array}

Alternative 1: 85.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\ t_2 := \mathsf{fma}\left(a \cdot \frac{d}{t\_0}, -1, b \cdot \frac{c}{t\_0}\right)\\ \mathbf{if}\;d \leq -1.18 \cdot 10^{+154}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -3.15 \cdot 10^{-96}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 2.7 \cdot 10^{-140}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}\\ \mathbf{elif}\;d \leq 2.3 \cdot 10^{+175}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (fma d d (* c c)))
        (t_1
         (/ (+ (fma (/ c d) b (* a (pow (* (/ c d) -1.0) 2.0))) (* -1.0 a)) d))
        (t_2 (fma (* a (/ d t_0)) -1.0 (* b (/ c t_0)))))
   (if (<= d -1.18e+154)
     t_1
     (if (<= d -3.15e-96)
       t_2
       (if (<= d 2.7e-140)
         (/ (fma (/ (* d a) c) -1.0 b) c)
         (if (<= d 2.3e+175) t_2 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = fma(d, d, (c * c));
	double t_1 = (fma((c / d), b, (a * pow(((c / d) * -1.0), 2.0))) + (-1.0 * a)) / d;
	double t_2 = fma((a * (d / t_0)), -1.0, (b * (c / t_0)));
	double tmp;
	if (d <= -1.18e+154) {
		tmp = t_1;
	} else if (d <= -3.15e-96) {
		tmp = t_2;
	} else if (d <= 2.7e-140) {
		tmp = fma(((d * a) / c), -1.0, b) / c;
	} else if (d <= 2.3e+175) {
		tmp = t_2;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = fma(d, d, Float64(c * c))
	t_1 = Float64(Float64(fma(Float64(c / d), b, Float64(a * (Float64(Float64(c / d) * -1.0) ^ 2.0))) + Float64(-1.0 * a)) / d)
	t_2 = fma(Float64(a * Float64(d / t_0)), -1.0, Float64(b * Float64(c / t_0)))
	tmp = 0.0
	if (d <= -1.18e+154)
		tmp = t_1;
	elseif (d <= -3.15e-96)
		tmp = t_2;
	elseif (d <= 2.7e-140)
		tmp = Float64(fma(Float64(Float64(d * a) / c), -1.0, b) / c);
	elseif (d <= 2.3e+175)
		tmp = t_2;
	else
		tmp = t_1;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(c / d), $MachinePrecision] * b + N[(a * N[Power[N[(N[(c / d), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(b * N[(c / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -1.18e+154], t$95$1, If[LessEqual[d, -3.15e-96], t$95$2, If[LessEqual[d, 2.7e-140], N[(N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0 + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.3e+175], t$95$2, t$95$1]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\
t_2 := \mathsf{fma}\left(a \cdot \frac{d}{t\_0}, -1, b \cdot \frac{c}{t\_0}\right)\\
\mathbf{if}\;d \leq -1.18 \cdot 10^{+154}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;d \leq -3.15 \cdot 10^{-96}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;d \leq 2.7 \cdot 10^{-140}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}\\

\mathbf{elif}\;d \leq 2.3 \cdot 10^{+175}:\\
\;\;\;\;t\_2\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.18000000000000004e154 or 2.3e175 < d

    1. Initial program 32.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6483.7

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites83.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6479.9

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites79.9%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{d}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{\color{blue}{d}} \]
    10. Applied rewrites89.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}} \]

    if -1.18000000000000004e154 < d < -3.1499999999999998e-96 or 2.7e-140 < d < 2.3e175

    1. Initial program 73.1%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}} \]
      2. lift--.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c} - a \cdot d}{c \cdot c + d \cdot d} \]
      4. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c - \color{blue}{a \cdot d}}{c \cdot c + d \cdot d} \]
      5. lift-+.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c + d \cdot d}} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c} + d \cdot d} \]
      7. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{c \cdot c + \color{blue}{d \cdot d}} \]
      8. fp-cancel-sub-sign-invN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a\right)\right) \cdot d}}{c \cdot c + d \cdot d} \]
      9. mul-1-negN/A

        \[\leadsto \frac{b \cdot c + \color{blue}{\left(-1 \cdot a\right)} \cdot d}{c \cdot c + d \cdot d} \]
      10. associate-*r*N/A

        \[\leadsto \frac{b \cdot c + \color{blue}{-1 \cdot \left(a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      11. pow2N/A

        \[\leadsto \frac{b \cdot c + -1 \cdot \left(a \cdot d\right)}{\color{blue}{{c}^{2}} + d \cdot d} \]
      12. pow2N/A

        \[\leadsto \frac{b \cdot c + -1 \cdot \left(a \cdot d\right)}{{c}^{2} + \color{blue}{{d}^{2}}} \]
      13. div-add-revN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{{c}^{2} + {d}^{2}} + \frac{-1 \cdot \left(a \cdot d\right)}{{c}^{2} + {d}^{2}}} \]
      14. associate-*r/N/A

        \[\leadsto \frac{b \cdot c}{{c}^{2} + {d}^{2}} + \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2} + {d}^{2}}} \]
      15. +-commutativeN/A

        \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2} + {d}^{2}} + \frac{b \cdot c}{{c}^{2} + {d}^{2}}} \]
      16. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{a \cdot d}{{c}^{2} + {d}^{2}} \cdot -1} + \frac{b \cdot c}{{c}^{2} + {d}^{2}} \]
      17. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{a \cdot d}{{c}^{2} + {d}^{2}}, -1, \frac{b \cdot c}{{c}^{2} + {d}^{2}}\right)} \]
    3. Applied rewrites79.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(a \cdot \frac{d}{\mathsf{fma}\left(d, d, c \cdot c\right)}, -1, b \cdot \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)} \]

    if -3.1499999999999998e-96 < d < 2.7e-140

    1. Initial program 71.9%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + -1 \cdot \frac{a \cdot d}{c}}{\color{blue}{c}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{-1 \cdot \frac{a \cdot d}{c} + b}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{a \cdot d}{c} \cdot -1 + b}{c} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
      7. lower-*.f6490.7

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
    4. Applied rewrites90.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 82.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -5.7 \cdot 10^{+113}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-92}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 2.7 \cdot 10^{-140}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}\\ \mathbf{elif}\;d \leq 2.7 \cdot 10^{+159}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d)))))
   (if (<= d -5.7e+113)
     (/ (fma b (/ c d) (* -1.0 a)) d)
     (if (<= d -1.15e-92)
       t_0
       (if (<= d 2.7e-140)
         (/ (fma (/ (* d a) c) -1.0 b) c)
         (if (<= d 2.7e+159)
           t_0
           (/
            (+ (fma (/ c d) b (* a (pow (* (/ c d) -1.0) 2.0))) (* -1.0 a))
            d)))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
	double tmp;
	if (d <= -5.7e+113) {
		tmp = fma(b, (c / d), (-1.0 * a)) / d;
	} else if (d <= -1.15e-92) {
		tmp = t_0;
	} else if (d <= 2.7e-140) {
		tmp = fma(((d * a) / c), -1.0, b) / c;
	} else if (d <= 2.7e+159) {
		tmp = t_0;
	} else {
		tmp = (fma((c / d), b, (a * pow(((c / d) * -1.0), 2.0))) + (-1.0 * a)) / d;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
	tmp = 0.0
	if (d <= -5.7e+113)
		tmp = Float64(fma(b, Float64(c / d), Float64(-1.0 * a)) / d);
	elseif (d <= -1.15e-92)
		tmp = t_0;
	elseif (d <= 2.7e-140)
		tmp = Float64(fma(Float64(Float64(d * a) / c), -1.0, b) / c);
	elseif (d <= 2.7e+159)
		tmp = t_0;
	else
		tmp = Float64(Float64(fma(Float64(c / d), b, Float64(a * (Float64(Float64(c / d) * -1.0) ^ 2.0))) + Float64(-1.0 * a)) / d);
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -5.7e+113], N[(N[(b * N[(c / d), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -1.15e-92], t$95$0, If[LessEqual[d, 2.7e-140], N[(N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0 + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.7e+159], t$95$0, N[(N[(N[(N[(c / d), $MachinePrecision] * b + N[(a * N[Power[N[(N[(c / d), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
\mathbf{if}\;d \leq -5.7 \cdot 10^{+113}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\

\mathbf{elif}\;d \leq -1.15 \cdot 10^{-92}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq 2.7 \cdot 10^{-140}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}\\

\mathbf{elif}\;d \leq 2.7 \cdot 10^{+159}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if d < -5.6999999999999998e113

    1. Initial program 39.5%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6481.4

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites81.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{c \cdot b}{d} + -1 \cdot a}{d} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{b \cdot c}{d} + -1 \cdot a}{d} \]
      6. associate-/l*N/A

        \[\leadsto \frac{b \cdot \frac{c}{d} + -1 \cdot a}{d} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      9. lower-*.f6486.3

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
    6. Applied rewrites86.3%

      \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{\color{blue}{d}} \]

    if -5.6999999999999998e113 < d < -1.15000000000000008e-92 or 2.7e-140 < d < 2.70000000000000008e159

    1. Initial program 74.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]

    if -1.15000000000000008e-92 < d < 2.7e-140

    1. Initial program 72.0%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + -1 \cdot \frac{a \cdot d}{c}}{\color{blue}{c}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{-1 \cdot \frac{a \cdot d}{c} + b}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{a \cdot d}{c} \cdot -1 + b}{c} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
      7. lower-*.f6490.6

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
    4. Applied rewrites90.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}} \]

    if 2.70000000000000008e159 < d

    1. Initial program 32.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6483.1

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites83.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6479.1

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites79.1%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{d}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{\color{blue}{d}} \]
    10. Applied rewrites88.4%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 77.5% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c}\\ \mathbf{if}\;c \leq -350000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 7 \cdot 10^{-41}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (fma (* a (/ d c)) -1.0 b) c)))
   (if (<= c -350000000.0)
     t_0
     (if (<= c 7e-41) (/ (fma b (/ c d) (* -1.0 a)) d) t_0))))
double code(double a, double b, double c, double d) {
	double t_0 = fma((a * (d / c)), -1.0, b) / c;
	double tmp;
	if (c <= -350000000.0) {
		tmp = t_0;
	} else if (c <= 7e-41) {
		tmp = fma(b, (c / d), (-1.0 * a)) / d;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(fma(Float64(a * Float64(d / c)), -1.0, b) / c)
	tmp = 0.0
	if (c <= -350000000.0)
		tmp = t_0;
	elseif (c <= 7e-41)
		tmp = Float64(fma(b, Float64(c / d), Float64(-1.0 * a)) / d);
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision] * -1.0 + b), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -350000000.0], t$95$0, If[LessEqual[c, 7e-41], N[(N[(b * N[(c / d), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c}\\
\mathbf{if}\;c \leq -350000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;c \leq 7 \cdot 10^{-41}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.5e8 or 6.9999999999999999e-41 < c

    1. Initial program 53.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + -1 \cdot \frac{a \cdot d}{c}}{\color{blue}{c}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{-1 \cdot \frac{a \cdot d}{c} + b}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{a \cdot d}{c} \cdot -1 + b}{c} \]
      4. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      5. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      6. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
      7. lower-*.f6470.6

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
    4. Applied rewrites70.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c}} \]
    5. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{d \cdot a}{c}, -1, b\right)}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(\frac{a \cdot d}{c}, -1, b\right)}{c} \]
      4. associate-/l*N/A

        \[\leadsto \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c} \]
      6. lower-/.f6474.0

        \[\leadsto \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c} \]
    6. Applied rewrites74.0%

      \[\leadsto \frac{\mathsf{fma}\left(a \cdot \frac{d}{c}, -1, b\right)}{c} \]

    if -3.5e8 < c < 6.9999999999999999e-41

    1. Initial program 74.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6481.5

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites81.5%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{c \cdot b}{d} + -1 \cdot a}{d} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{b \cdot c}{d} + -1 \cdot a}{d} \]
      6. associate-/l*N/A

        \[\leadsto \frac{b \cdot \frac{c}{d} + -1 \cdot a}{d} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      9. lower-*.f6481.4

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
    6. Applied rewrites81.4%

      \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{\color{blue}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 76.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\ \mathbf{if}\;c \leq -350000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 12.6:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0
         (/
          (+
           (fma (* b (pow (* (/ d c) -1.0) 2.0)) -1.0 (* (/ (* d a) c) -1.0))
           b)
          c)))
   (if (<= c -350000000.0)
     t_0
     (if (<= c 12.6) (/ (fma b (/ c d) (* -1.0 a)) d) t_0))))
double code(double a, double b, double c, double d) {
	double t_0 = (fma((b * pow(((d / c) * -1.0), 2.0)), -1.0, (((d * a) / c) * -1.0)) + b) / c;
	double tmp;
	if (c <= -350000000.0) {
		tmp = t_0;
	} else if (c <= 12.6) {
		tmp = fma(b, (c / d), (-1.0 * a)) / d;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(fma(Float64(b * (Float64(Float64(d / c) * -1.0) ^ 2.0)), -1.0, Float64(Float64(Float64(d * a) / c) * -1.0)) + b) / c)
	tmp = 0.0
	if (c <= -350000000.0)
		tmp = t_0;
	elseif (c <= 12.6)
		tmp = Float64(fma(b, Float64(c / d), Float64(-1.0 * a)) / d);
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(b * N[Power[N[(N[(d / c), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -350000000.0], t$95$0, If[LessEqual[c, 12.6], N[(N[(b * N[(c / d), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\
\mathbf{if}\;c \leq -350000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;c \leq 12.6:\\
\;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.5e8 or 12.5999999999999996 < c

    1. Initial program 51.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6424.0

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites24.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6424.8

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites24.8%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{\color{blue}{c}} \]
    10. Applied rewrites71.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}} \]

    if -3.5e8 < c < 12.5999999999999996

    1. Initial program 74.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6480.2

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites80.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      2. lift-*.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{c \cdot b}{d}}{d} \]
      4. +-commutativeN/A

        \[\leadsto \frac{\frac{c \cdot b}{d} + -1 \cdot a}{d} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\frac{b \cdot c}{d} + -1 \cdot a}{d} \]
      6. associate-/l*N/A

        \[\leadsto \frac{b \cdot \frac{c}{d} + -1 \cdot a}{d} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      8. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
      9. lower-*.f6480.1

        \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{d} \]
    6. Applied rewrites80.1%

      \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, -1 \cdot a\right)}{\color{blue}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 76.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\ \mathbf{if}\;c \leq -350000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 12.6:\\ \;\;\;\;\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0
         (/
          (+
           (fma (* b (pow (* (/ d c) -1.0) 2.0)) -1.0 (* (/ (* d a) c) -1.0))
           b)
          c)))
   (if (<= c -350000000.0)
     t_0
     (if (<= c 12.6) (/ (fma -1.0 a (/ (* c b) d)) d) t_0))))
double code(double a, double b, double c, double d) {
	double t_0 = (fma((b * pow(((d / c) * -1.0), 2.0)), -1.0, (((d * a) / c) * -1.0)) + b) / c;
	double tmp;
	if (c <= -350000000.0) {
		tmp = t_0;
	} else if (c <= 12.6) {
		tmp = fma(-1.0, a, ((c * b) / d)) / d;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(fma(Float64(b * (Float64(Float64(d / c) * -1.0) ^ 2.0)), -1.0, Float64(Float64(Float64(d * a) / c) * -1.0)) + b) / c)
	tmp = 0.0
	if (c <= -350000000.0)
		tmp = t_0;
	elseif (c <= 12.6)
		tmp = Float64(fma(-1.0, a, Float64(Float64(c * b) / d)) / d);
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(b * N[Power[N[(N[(d / c), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -350000000.0], t$95$0, If[LessEqual[c, 12.6], N[(N[(-1.0 * a + N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\
\mathbf{if}\;c \leq -350000000:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;c \leq 12.6:\\
\;\;\;\;\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.5e8 or 12.5999999999999996 < c

    1. Initial program 51.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6424.0

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites24.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6424.8

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites24.8%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{\color{blue}{c}} \]
    10. Applied rewrites71.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}} \]

    if -3.5e8 < c < 12.5999999999999996

    1. Initial program 74.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6480.2

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites80.2%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 6: 76.0% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\ \mathbf{if}\;d \leq -6.5 \cdot 10^{+49}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 2.3 \cdot 10^{+62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0
         (/
          (+ (fma (/ c d) b (* a (pow (* (/ c d) -1.0) 2.0))) (* -1.0 a))
          d)))
   (if (<= d -6.5e+49)
     t_0
     (if (<= d 2.3e+62)
       (/
        (+
         (fma (* b (pow (* (/ d c) -1.0) 2.0)) -1.0 (* (/ (* d a) c) -1.0))
         b)
        c)
       t_0))))
double code(double a, double b, double c, double d) {
	double t_0 = (fma((c / d), b, (a * pow(((c / d) * -1.0), 2.0))) + (-1.0 * a)) / d;
	double tmp;
	if (d <= -6.5e+49) {
		tmp = t_0;
	} else if (d <= 2.3e+62) {
		tmp = (fma((b * pow(((d / c) * -1.0), 2.0)), -1.0, (((d * a) / c) * -1.0)) + b) / c;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(fma(Float64(c / d), b, Float64(a * (Float64(Float64(c / d) * -1.0) ^ 2.0))) + Float64(-1.0 * a)) / d)
	tmp = 0.0
	if (d <= -6.5e+49)
		tmp = t_0;
	elseif (d <= 2.3e+62)
		tmp = Float64(Float64(fma(Float64(b * (Float64(Float64(d / c) * -1.0) ^ 2.0)), -1.0, Float64(Float64(Float64(d * a) / c) * -1.0)) + b) / c);
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(c / d), $MachinePrecision] * b + N[(a * N[Power[N[(N[(c / d), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 * a), $MachinePrecision]), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -6.5e+49], t$95$0, If[LessEqual[d, 2.3e+62], N[(N[(N[(N[(b * N[Power[N[(N[(d / c), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}\\
\mathbf{if}\;d \leq -6.5 \cdot 10^{+49}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq 2.3 \cdot 10^{+62}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -6.5000000000000005e49 or 2.29999999999999984e62 < d

    1. Initial program 46.5%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6477.1

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites77.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6472.2

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites72.2%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{d}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \left(\frac{a \cdot {c}^{2}}{{d}^{2}} + \frac{b \cdot c}{d}\right)}{\color{blue}{d}} \]
    10. Applied rewrites80.3%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c}{d}, b, a \cdot {\left(\frac{c}{d} \cdot -1\right)}^{2}\right) + -1 \cdot a}{d}} \]

    if -6.5000000000000005e49 < d < 2.29999999999999984e62

    1. Initial program 75.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6435.7

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites35.7%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6433.0

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites33.0%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{\color{blue}{c}} \]
    10. Applied rewrites72.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 74.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.02 \cdot 10^{+48}:\\ \;\;\;\;\frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d}\\ \mathbf{elif}\;d \leq 2.3 \cdot 10^{+62}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= d -1.02e+48)
   (/ (* (- (* b (/ c (* d a))) 1.0) a) d)
   (if (<= d 2.3e+62)
     (/
      (+ (fma (* b (pow (* (/ d c) -1.0) 2.0)) -1.0 (* (/ (* d a) c) -1.0)) b)
      c)
     (/ (* (- (* (/ b a) (/ c d)) 1.0) a) d))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (d <= -1.02e+48) {
		tmp = (((b * (c / (d * a))) - 1.0) * a) / d;
	} else if (d <= 2.3e+62) {
		tmp = (fma((b * pow(((d / c) * -1.0), 2.0)), -1.0, (((d * a) / c) * -1.0)) + b) / c;
	} else {
		tmp = ((((b / a) * (c / d)) - 1.0) * a) / d;
	}
	return tmp;
}
function code(a, b, c, d)
	tmp = 0.0
	if (d <= -1.02e+48)
		tmp = Float64(Float64(Float64(Float64(b * Float64(c / Float64(d * a))) - 1.0) * a) / d);
	elseif (d <= 2.3e+62)
		tmp = Float64(Float64(fma(Float64(b * (Float64(Float64(d / c) * -1.0) ^ 2.0)), -1.0, Float64(Float64(Float64(d * a) / c) * -1.0)) + b) / c);
	else
		tmp = Float64(Float64(Float64(Float64(Float64(b / a) * Float64(c / d)) - 1.0) * a) / d);
	end
	return tmp
end
code[a_, b_, c_, d_] := If[LessEqual[d, -1.02e+48], N[(N[(N[(N[(b * N[(c / N[(d * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, 2.3e+62], N[(N[(N[(N[(b * N[Power[N[(N[(d / c), $MachinePrecision] * -1.0), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision] * -1.0), $MachinePrecision]), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(N[(N[(b / a), $MachinePrecision] * N[(c / d), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * a), $MachinePrecision] / d), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.02 \cdot 10^{+48}:\\
\;\;\;\;\frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d}\\

\mathbf{elif}\;d \leq 2.3 \cdot 10^{+62}:\\
\;\;\;\;\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}\\

\mathbf{else}:\\
\;\;\;\;\frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.02e48

    1. Initial program 47.9%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6477.0

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites77.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6471.7

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites71.7%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Step-by-step derivation
      1. lift-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      2. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      3. lift-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      4. frac-timesN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      5. associate-/l*N/A

        \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
      6. lower-*.f64N/A

        \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
      7. lower-/.f64N/A

        \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
      8. *-commutativeN/A

        \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]
      9. lift-*.f6478.6

        \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]
    9. Applied rewrites78.6%

      \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]

    if -1.02e48 < d < 2.29999999999999984e62

    1. Initial program 75.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6435.6

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites35.6%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6433.0

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites33.0%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    8. Taylor expanded in c around inf

      \[\leadsto \color{blue}{\frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{b + \left(-1 \cdot \frac{a \cdot d}{c} + -1 \cdot \frac{b \cdot {d}^{2}}{{c}^{2}}\right)}{\color{blue}{c}} \]
    10. Applied rewrites73.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(b \cdot {\left(\frac{d}{c} \cdot -1\right)}^{2}, -1, \frac{d \cdot a}{c} \cdot -1\right) + b}{c}} \]

    if 2.29999999999999984e62 < d

    1. Initial program 45.3%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
    3. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
      2. lower-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      3. lower-/.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
      5. lower-*.f6477.0

        \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    4. Applied rewrites77.0%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
    5. Taylor expanded in a around inf

      \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      3. lower--.f64N/A

        \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
      4. times-fracN/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      6. lower-/.f64N/A

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
      7. lower-/.f6472.5

        \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. Applied rewrites72.5%

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 8: 51.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \end{array} \]
(FPCore (a b c d) :precision binary64 (/ (* (- (* b (/ c (* d a))) 1.0) a) d))
double code(double a, double b, double c, double d) {
	return (((b * (c / (d * a))) - 1.0) * a) / d;
}
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(a, b, c, d)
use fmin_fmax_functions
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = (((b * (c / (d * a))) - 1.0d0) * a) / d
end function
public static double code(double a, double b, double c, double d) {
	return (((b * (c / (d * a))) - 1.0) * a) / d;
}
def code(a, b, c, d):
	return (((b * (c / (d * a))) - 1.0) * a) / d
function code(a, b, c, d)
	return Float64(Float64(Float64(Float64(b * Float64(c / Float64(d * a))) - 1.0) * a) / d)
end
function tmp = code(a, b, c, d)
	tmp = (((b * (c / (d * a))) - 1.0) * a) / d;
end
code[a_, b_, c_, d_] := N[(N[(N[(N[(b * N[(c / N[(d * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - 1.0), $MachinePrecision] * a), $MachinePrecision] / d), $MachinePrecision]
\begin{array}{l}

\\
\frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d}
\end{array}
Derivation
  1. Initial program 63.4%

    \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
  2. Taylor expanded in d around inf

    \[\leadsto \color{blue}{\frac{-1 \cdot a + \frac{b \cdot c}{d}}{d}} \]
  3. Step-by-step derivation
    1. lower-/.f64N/A

      \[\leadsto \frac{-1 \cdot a + \frac{b \cdot c}{d}}{\color{blue}{d}} \]
    2. lower-fma.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
    3. lower-/.f64N/A

      \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{b \cdot c}{d}\right)}{d} \]
    4. *-commutativeN/A

      \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
    5. lower-*.f6452.7

      \[\leadsto \frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d} \]
  4. Applied rewrites52.7%

    \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(-1, a, \frac{c \cdot b}{d}\right)}{d}} \]
  5. Taylor expanded in a around inf

    \[\leadsto \frac{a \cdot \left(\frac{b \cdot c}{a \cdot d} - 1\right)}{d} \]
  6. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
    2. lower-*.f64N/A

      \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
    3. lower--.f64N/A

      \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
    4. times-fracN/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    5. lower-*.f64N/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    6. lower-/.f64N/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    7. lower-/.f6449.2

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
  7. Applied rewrites49.2%

    \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
  8. Step-by-step derivation
    1. lift-*.f64N/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    2. lift-/.f64N/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    3. lift-/.f64N/A

      \[\leadsto \frac{\left(\frac{b}{a} \cdot \frac{c}{d} - 1\right) \cdot a}{d} \]
    4. frac-timesN/A

      \[\leadsto \frac{\left(\frac{b \cdot c}{a \cdot d} - 1\right) \cdot a}{d} \]
    5. associate-/l*N/A

      \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
    6. lower-*.f64N/A

      \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
    7. lower-/.f64N/A

      \[\leadsto \frac{\left(b \cdot \frac{c}{a \cdot d} - 1\right) \cdot a}{d} \]
    8. *-commutativeN/A

      \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]
    9. lift-*.f6451.8

      \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]
  9. Applied rewrites51.8%

    \[\leadsto \frac{\left(b \cdot \frac{c}{d \cdot a} - 1\right) \cdot a}{d} \]
  10. Add Preprocessing

Reproduce

?
herbie shell --seed 2025093 
(FPCore (a b c d)
  :name "Complex division, imag part"
  :precision binary64
  (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))