Complex division, imag part

Percentage Accurate: 62.4% → 80.9%
Time: 3.7s
Alternatives: 8
Speedup: 1.7×

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: 62.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: 80.9% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := a \cdot \frac{d}{t\_0}\\ t_2 := -\frac{\mathsf{fma}\left(a, \frac{d}{c}, -b\right)}{c}\\ \mathbf{if}\;d \leq -3.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;d \leq -6.2 \cdot 10^{-10}:\\ \;\;\;\;\frac{b}{t\_0} \cdot c - t\_1\\ \mathbf{elif}\;d \leq 1.25 \cdot 10^{-97}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 5.5 \cdot 10^{+123}:\\ \;\;\;\;b \cdot \frac{c}{t\_0} - t\_1\\ \mathbf{elif}\;d \leq 4 \cdot 10^{+154}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (fma d d (* c c)))
        (t_1 (* a (/ d t_0)))
        (t_2 (- (/ (fma a (/ d c) (- b)) c))))
   (if (<= d -3.3e+153)
     (/ (- (/ (* c b) d) a) d)
     (if (<= d -6.2e-10)
       (- (* (/ b t_0) c) t_1)
       (if (<= d 1.25e-97)
         t_2
         (if (<= d 5.5e+123)
           (- (* b (/ c t_0)) t_1)
           (if (<= d 4e+154) t_2 (/ (- a) d))))))))
double code(double a, double b, double c, double d) {
	double t_0 = fma(d, d, (c * c));
	double t_1 = a * (d / t_0);
	double t_2 = -(fma(a, (d / c), -b) / c);
	double tmp;
	if (d <= -3.3e+153) {
		tmp = (((c * b) / d) - a) / d;
	} else if (d <= -6.2e-10) {
		tmp = ((b / t_0) * c) - t_1;
	} else if (d <= 1.25e-97) {
		tmp = t_2;
	} else if (d <= 5.5e+123) {
		tmp = (b * (c / t_0)) - t_1;
	} else if (d <= 4e+154) {
		tmp = t_2;
	} else {
		tmp = -a / d;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = fma(d, d, Float64(c * c))
	t_1 = Float64(a * Float64(d / t_0))
	t_2 = Float64(-Float64(fma(a, Float64(d / c), Float64(-b)) / c))
	tmp = 0.0
	if (d <= -3.3e+153)
		tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d);
	elseif (d <= -6.2e-10)
		tmp = Float64(Float64(Float64(b / t_0) * c) - t_1);
	elseif (d <= 1.25e-97)
		tmp = t_2;
	elseif (d <= 5.5e+123)
		tmp = Float64(Float64(b * Float64(c / t_0)) - t_1);
	elseif (d <= 4e+154)
		tmp = t_2;
	else
		tmp = Float64(Float64(-a) / d);
	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[(a * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(a * N[(d / c), $MachinePrecision] + (-b)), $MachinePrecision] / c), $MachinePrecision])}, If[LessEqual[d, -3.3e+153], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -6.2e-10], N[(N[(N[(b / t$95$0), $MachinePrecision] * c), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[d, 1.25e-97], t$95$2, If[LessEqual[d, 5.5e+123], N[(N[(b * N[(c / t$95$0), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision], If[LessEqual[d, 4e+154], t$95$2, N[((-a) / d), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -6.2 \cdot 10^{-10}:\\
\;\;\;\;\frac{b}{t\_0} \cdot c - t\_1\\

\mathbf{elif}\;d \leq 1.25 \cdot 10^{-97}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;d \leq 5.5 \cdot 10^{+123}:\\
\;\;\;\;b \cdot \frac{c}{t\_0} - t\_1\\

\mathbf{elif}\;d \leq 4 \cdot 10^{+154}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -3.29999999999999994e153

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]

    if -3.29999999999999994e153 < d < -6.2000000000000003e-10

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

    if -6.2000000000000003e-10 < d < 1.2499999999999999e-97 or 5.5000000000000002e123 < d < 4.00000000000000015e154

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\mathsf{fma}\left(a, \frac{d}{c}, \mathsf{neg}\left(b\right)\right)}{c} \]
      9. lower-neg.f6453.6

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

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

    if 1.2499999999999999e-97 < d < 5.5000000000000002e123

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

    if 4.00000000000000015e154 < d

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \frac{-1 \cdot a}{\color{blue}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(a\right)}{d} \]
      4. lower-neg.f6443.4

        \[\leadsto \frac{-a}{d} \]
    10. Applied rewrites43.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
  3. Recombined 5 regimes into one program.
  4. Add Preprocessing

Alternative 2: 80.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := b \cdot \frac{c}{t\_0} - a \cdot \frac{d}{t\_0}\\ t_2 := -\frac{\mathsf{fma}\left(a, \frac{d}{c}, -b\right)}{c}\\ \mathbf{if}\;d \leq -3.3 \cdot 10^{+153}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{elif}\;d \leq -6.2 \cdot 10^{-10}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 1.25 \cdot 10^{-97}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 5.5 \cdot 10^{+123}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 4 \cdot 10^{+154}:\\ \;\;\;\;t\_2\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (fma d d (* c c)))
        (t_1 (- (* b (/ c t_0)) (* a (/ d t_0))))
        (t_2 (- (/ (fma a (/ d c) (- b)) c))))
   (if (<= d -3.3e+153)
     (/ (- (/ (* c b) d) a) d)
     (if (<= d -6.2e-10)
       t_1
       (if (<= d 1.25e-97)
         t_2
         (if (<= d 5.5e+123) t_1 (if (<= d 4e+154) t_2 (/ (- a) d))))))))
double code(double a, double b, double c, double d) {
	double t_0 = fma(d, d, (c * c));
	double t_1 = (b * (c / t_0)) - (a * (d / t_0));
	double t_2 = -(fma(a, (d / c), -b) / c);
	double tmp;
	if (d <= -3.3e+153) {
		tmp = (((c * b) / d) - a) / d;
	} else if (d <= -6.2e-10) {
		tmp = t_1;
	} else if (d <= 1.25e-97) {
		tmp = t_2;
	} else if (d <= 5.5e+123) {
		tmp = t_1;
	} else if (d <= 4e+154) {
		tmp = t_2;
	} else {
		tmp = -a / d;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = fma(d, d, Float64(c * c))
	t_1 = Float64(Float64(b * Float64(c / t_0)) - Float64(a * Float64(d / t_0)))
	t_2 = Float64(-Float64(fma(a, Float64(d / c), Float64(-b)) / c))
	tmp = 0.0
	if (d <= -3.3e+153)
		tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d);
	elseif (d <= -6.2e-10)
		tmp = t_1;
	elseif (d <= 1.25e-97)
		tmp = t_2;
	elseif (d <= 5.5e+123)
		tmp = t_1;
	elseif (d <= 4e+154)
		tmp = t_2;
	else
		tmp = Float64(Float64(-a) / d);
	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[(b * N[(c / t$95$0), $MachinePrecision]), $MachinePrecision] - N[(a * N[(d / t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = (-N[(N[(a * N[(d / c), $MachinePrecision] + (-b)), $MachinePrecision] / c), $MachinePrecision])}, If[LessEqual[d, -3.3e+153], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -6.2e-10], t$95$1, If[LessEqual[d, 1.25e-97], t$95$2, If[LessEqual[d, 5.5e+123], t$95$1, If[LessEqual[d, 4e+154], t$95$2, N[((-a) / d), $MachinePrecision]]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;d \leq -6.2 \cdot 10^{-10}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;d \leq 1.25 \cdot 10^{-97}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;d \leq 5.5 \cdot 10^{+123}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;d \leq 4 \cdot 10^{+154}:\\
\;\;\;\;t\_2\\

\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\


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

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]

    if -3.29999999999999994e153 < d < -6.2000000000000003e-10 or 1.2499999999999999e-97 < d < 5.5000000000000002e123

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

    if -6.2000000000000003e-10 < d < 1.2499999999999999e-97 or 5.5000000000000002e123 < d < 4.00000000000000015e154

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\mathsf{fma}\left(a, \frac{d}{c}, \mathsf{neg}\left(b\right)\right)}{c} \]
      9. lower-neg.f6453.6

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

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

    if 4.00000000000000015e154 < d

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \frac{-1 \cdot a}{\color{blue}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(a\right)}{d} \]
      4. lower-neg.f6443.4

        \[\leadsto \frac{-a}{d} \]
    10. Applied rewrites43.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 3: 79.8% accurate, 0.6× speedup?

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

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

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

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

\mathbf{elif}\;d \leq 6.5 \cdot 10^{+65}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;b \cdot \frac{c}{d \cdot d} - \frac{a}{d}\\


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

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]

    if -7.0000000000000001e85 < d < -6.2000000000000003e-10 or 1.55000000000000007e-111 < d < 6.5000000000000003e65

    1. Initial program 62.4%

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

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

        \[\leadsto \frac{\color{blue}{c \cdot b} - a \cdot d}{c \cdot c + d \cdot d} \]
      3. lower-*.f6462.4

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

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

        \[\leadsto \frac{c \cdot b - \color{blue}{d \cdot a}}{c \cdot c + d \cdot d} \]
      6. lower-*.f6462.4

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

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

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

        \[\leadsto \frac{c \cdot b - d \cdot a}{\color{blue}{d \cdot d} + c \cdot c} \]
      10. lower-fma.f6462.4

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

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

    if -6.2000000000000003e-10 < d < 1.55000000000000007e-111

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\mathsf{fma}\left(a, \frac{d}{c}, \mathsf{neg}\left(b\right)\right)}{c} \]
      9. lower-neg.f6453.6

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

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

    if 6.5000000000000003e65 < d

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} - \color{blue}{\frac{a}{d}} \]
      2. associate-/l*N/A

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

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

        \[\leadsto b \cdot \frac{c}{{d}^{2}} - \frac{a}{d} \]
      5. pow2N/A

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

        \[\leadsto b \cdot \frac{c}{d \cdot d} - \frac{a}{d} \]
      7. lower-/.f6449.2

        \[\leadsto b \cdot \frac{c}{d \cdot d} - \frac{a}{\color{blue}{d}} \]
    10. Applied rewrites49.2%

      \[\leadsto \color{blue}{b \cdot \frac{c}{d \cdot d} - \frac{a}{d}} \]
  3. Recombined 4 regimes into one program.
  4. Add Preprocessing

Alternative 4: 78.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;c \leq 8.5 \cdot 10^{+26}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -9.59999999999999986e-23 or 8.5e26 < c

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -\frac{\mathsf{fma}\left(a, \frac{d}{c}, \mathsf{neg}\left(b\right)\right)}{c} \]
      9. lower-neg.f6453.6

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

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

    if -9.59999999999999986e-23 < c < 8.5e26

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 5: 75.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{if}\;d \leq -0.021:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{+48}:\\ \;\;\;\;\frac{\frac{\left(-a\right) \cdot d}{c} + b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (/ (* c b) d) a) d)))
   (if (<= d -0.021)
     t_0
     (if (<= d 1.05e+48) (/ (+ (/ (* (- a) d) c) b) c) t_0))))
double code(double a, double b, double c, double d) {
	double t_0 = (((c * b) / d) - a) / d;
	double tmp;
	if (d <= -0.021) {
		tmp = t_0;
	} else if (d <= 1.05e+48) {
		tmp = (((-a * d) / c) + b) / c;
	} 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(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
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (((c * b) / d) - a) / d
    if (d <= (-0.021d0)) then
        tmp = t_0
    else if (d <= 1.05d+48) then
        tmp = (((-a * d) / c) + b) / c
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = (((c * b) / d) - a) / d;
	double tmp;
	if (d <= -0.021) {
		tmp = t_0;
	} else if (d <= 1.05e+48) {
		tmp = (((-a * d) / c) + b) / c;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (((c * b) / d) - a) / d
	tmp = 0
	if d <= -0.021:
		tmp = t_0
	elif d <= 1.05e+48:
		tmp = (((-a * d) / c) + b) / c
	else:
		tmp = t_0
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(Float64(c * b) / d) - a) / d)
	tmp = 0.0
	if (d <= -0.021)
		tmp = t_0;
	elseif (d <= 1.05e+48)
		tmp = Float64(Float64(Float64(Float64(Float64(-a) * d) / c) + b) / c);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (((c * b) / d) - a) / d;
	tmp = 0.0;
	if (d <= -0.021)
		tmp = t_0;
	elseif (d <= 1.05e+48)
		tmp = (((-a * d) / c) + b) / c;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -0.021], t$95$0, If[LessEqual[d, 1.05e+48], N[(N[(N[(N[((-a) * d), $MachinePrecision] / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\
\mathbf{if}\;d \leq -0.021:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq 1.05 \cdot 10^{+48}:\\
\;\;\;\;\frac{\frac{\left(-a\right) \cdot d}{c} + b}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -0.0210000000000000013 or 1.0499999999999999e48 < d

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]

    if -0.0210000000000000013 < d < 1.0499999999999999e48

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    9. 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. lower-+.f64N/A

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

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

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

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

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

        \[\leadsto \frac{\frac{\left(\mathsf{neg}\left(a\right)\right) \cdot d}{c} + b}{c} \]
      9. lower-neg.f6451.7

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

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

Alternative 6: 73.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -14500000000:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 10^{+29}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -14500000000.0)
   (/ b c)
   (if (<= c 1e+29) (/ (- (/ (* c b) d) a) d) (/ b c))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -14500000000.0) {
		tmp = b / c;
	} else if (c <= 1e+29) {
		tmp = (((c * b) / d) - a) / d;
	} else {
		tmp = b / c;
	}
	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(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
    real(8) :: tmp
    if (c <= (-14500000000.0d0)) then
        tmp = b / c
    else if (c <= 1d+29) then
        tmp = (((c * b) / d) - a) / d
    else
        tmp = b / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -14500000000.0) {
		tmp = b / c;
	} else if (c <= 1e+29) {
		tmp = (((c * b) / d) - a) / d;
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -14500000000.0:
		tmp = b / c
	elif c <= 1e+29:
		tmp = (((c * b) / d) - a) / d
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -14500000000.0)
		tmp = Float64(b / c);
	elseif (c <= 1e+29)
		tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d);
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -14500000000.0)
		tmp = b / c;
	elseif (c <= 1e+29)
		tmp = (((c * b) / d) - a) / d;
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -14500000000.0], N[(b / c), $MachinePrecision], If[LessEqual[c, 1e+29], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -14500000000:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 10^{+29}:\\
\;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.45e10 or 9.99999999999999914e28 < c

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f6442.1

        \[\leadsto \frac{b}{\color{blue}{c}} \]
    10. Applied rewrites42.1%

      \[\leadsto \color{blue}{\frac{b}{c}} \]

    if -1.45e10 < c < 9.99999999999999914e28

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
      5. lift-*.f6452.7

        \[\leadsto \frac{\frac{c \cdot b}{d} - a}{d} \]
    10. Applied rewrites52.7%

      \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 7: 64.8% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -360000:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 7.8 \cdot 10^{+27}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -360000.0) (/ b c) (if (<= c 7.8e+27) (/ (- a) d) (/ b c))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -360000.0) {
		tmp = b / c;
	} else if (c <= 7.8e+27) {
		tmp = -a / d;
	} else {
		tmp = b / c;
	}
	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(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
    real(8) :: tmp
    if (c <= (-360000.0d0)) then
        tmp = b / c
    else if (c <= 7.8d+27) then
        tmp = -a / d
    else
        tmp = b / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -360000.0) {
		tmp = b / c;
	} else if (c <= 7.8e+27) {
		tmp = -a / d;
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -360000.0:
		tmp = b / c
	elif c <= 7.8e+27:
		tmp = -a / d
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -360000.0)
		tmp = Float64(b / c);
	elseif (c <= 7.8e+27)
		tmp = Float64(Float64(-a) / d);
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -360000.0)
		tmp = b / c;
	elseif (c <= 7.8e+27)
		tmp = -a / d;
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -360000.0], N[(b / c), $MachinePrecision], If[LessEqual[c, 7.8e+27], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -360000:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 7.8 \cdot 10^{+27}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -3.6e5 or 7.7999999999999997e27 < c

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b}{c}} \]
    9. Step-by-step derivation
      1. lower-/.f6442.1

        \[\leadsto \frac{b}{\color{blue}{c}} \]
    10. Applied rewrites42.1%

      \[\leadsto \color{blue}{\frac{b}{c}} \]

    if -3.6e5 < c < 7.7999999999999997e27

    1. Initial program 62.4%

      \[\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. sub-flipN/A

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      4. div-addN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      6. associate-/l*N/A

        \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
      7. lower-fma.f64N/A

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

        \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      9. lift-+.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      10. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      11. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      12. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
      13. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
      14. lift-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
      16. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      17. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
      18. lower-neg.f6463.0

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

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
      21. lift-*.f64N/A

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      7. add-flipN/A

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

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

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

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
      12. distribute-neg-frac2N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
      13. lift-*.f64N/A

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

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      15. distribute-lft-neg-outN/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      16. lift-*.f64N/A

        \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
      17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    9. Step-by-step derivation
      1. associate-*r/N/A

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

        \[\leadsto \frac{-1 \cdot a}{\color{blue}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\mathsf{neg}\left(a\right)}{d} \]
      4. lower-neg.f6443.4

        \[\leadsto \frac{-a}{d} \]
    10. Applied rewrites43.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 8: 42.1% accurate, 4.9× speedup?

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

\\
\frac{b}{c}
\end{array}
Derivation
  1. Initial program 62.4%

    \[\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. sub-flipN/A

      \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
    4. div-addN/A

      \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}} \]
    5. lift-*.f64N/A

      \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
    6. associate-/l*N/A

      \[\leadsto \color{blue}{b \cdot \frac{c}{c \cdot c + d \cdot d}} + \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d} \]
    7. lower-fma.f64N/A

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

      \[\leadsto \mathsf{fma}\left(b, \color{blue}{\frac{c}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
    9. lift-+.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{c \cdot c + d \cdot d}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
    10. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d + c \cdot c}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
    11. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{d \cdot d} + c \cdot c}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
    12. lower-fma.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\color{blue}{\mathsf{fma}\left(d, d, c \cdot c\right)}}, \frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}\right) \]
    13. lower-/.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{c \cdot c + d \cdot d}}\right) \]
    14. lift-*.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{c \cdot c + d \cdot d}\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{c \cdot c + d \cdot d}\right) \]
    16. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
    17. lower-*.f64N/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{c \cdot c + d \cdot d}\right) \]
    18. lower-neg.f6463.0

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

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{c \cdot c + d \cdot d}}\right) \]
    20. +-commutativeN/A

      \[\leadsto \mathsf{fma}\left(b, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{\left(-d\right) \cdot a}{\color{blue}{d \cdot d + c \cdot c}}\right) \]
    21. lift-*.f64N/A

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{c \cdot \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)}} + \frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    7. add-flipN/A

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

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

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

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

      \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \left(\mathsf{neg}\left(\color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right)\right) \]
    12. distribute-neg-frac2N/A

      \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \color{blue}{\frac{\left(-d\right) \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)}} \]
    13. lift-*.f64N/A

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

      \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right)} \cdot a}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
    15. distribute-lft-neg-outN/A

      \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\color{blue}{\mathsf{neg}\left(d \cdot a\right)}}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
    16. lift-*.f64N/A

      \[\leadsto \frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(\mathsf{fma}\left(d, d, c \cdot c\right)\right)} \]
    17. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{b}{c}} \]
  9. Step-by-step derivation
    1. lower-/.f6442.1

      \[\leadsto \frac{b}{\color{blue}{c}} \]
  10. Applied rewrites42.1%

    \[\leadsto \color{blue}{\frac{b}{c}} \]
  11. Add Preprocessing

Developer Target 1: 99.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (< (fabs d) (fabs c))
   (/ (- b (* a (/ d c))) (+ c (* d (/ d c))))
   (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (fabs(d) < fabs(c)) {
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	} else {
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	}
	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(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
    real(8) :: tmp
    if (abs(d) < abs(c)) then
        tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
    else
        tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (Math.abs(d) < Math.abs(c)) {
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	} else {
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if math.fabs(d) < math.fabs(c):
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
	else:
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (abs(d) < abs(c))
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
	else
		tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d))));
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (abs(d) < abs(c))
		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
	else
		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\left|d\right| < \left|c\right|:\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\

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


\end{array}
\end{array}

Reproduce

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

  :alt
  (! :herbie-platform c (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))

  (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))