Complex division, imag part

Percentage Accurate: 61.6% → 83.8%
Time: 9.7s
Alternatives: 12
Speedup: 1.5×

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));
}
real(8) function code(a, b, c, d)
    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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 12 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 61.6% 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));
}
real(8) function code(a, b, c, d)
    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: 83.8% accurate, 0.5× speedup?

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

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

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

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

\mathbf{elif}\;c \leq 3.6 \cdot 10^{+132}:\\
\;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a \cdot \left(-d\right)}{t\_0}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if c < -2.6999999999999999e73

    1. Initial program 36.0%

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

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

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

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

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

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

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

        \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
      7. lower-*.f6481.6

        \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
    5. Applied rewrites81.6%

      \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
    6. Step-by-step derivation
      1. Applied rewrites89.0%

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

      if -2.6999999999999999e73 < c < -6.1999999999999999e-61

      1. Initial program 81.3%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. 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. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{\mathsf{neg}\left(a\right)}{\mathsf{fma}\left(c, c, d \cdot d\right)}, d, \color{blue}{\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}}\right) \]
      6. Applied rewrites92.2%

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

      if -6.1999999999999999e-61 < c < 7.6000000000000001e-97

      1. Initial program 74.5%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. Taylor expanded in c around 0

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
        2. distribute-neg-frac2N/A

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

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

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

          \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
        6. lower-neg.f6475.6

          \[\leadsto \frac{a}{\color{blue}{-d}} \]
      5. Applied rewrites75.6%

        \[\leadsto \color{blue}{\frac{a}{-d}} \]
      6. Taylor expanded in d around inf

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

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

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

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

          \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
        5. sub-negN/A

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{\mathsf{neg}\left(a\right)}\right)}{d} \]
        11. lower-neg.f6489.3

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

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

      if 7.6000000000000001e-97 < c < 3.60000000000000016e132

      1. Initial program 78.6%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. 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. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{\color{blue}{d \cdot a}}{\mathsf{neg}\left(\left(c \cdot c + d \cdot d\right)\right)}\right) \]
      4. Applied rewrites84.7%

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

      if 3.60000000000000016e132 < c

      1. Initial program 30.5%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. Taylor expanded in c around 0

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
        2. distribute-neg-frac2N/A

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

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

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

          \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
        6. lower-neg.f6416.8

          \[\leadsto \frac{a}{\color{blue}{-d}} \]
      5. Applied rewrites16.8%

        \[\leadsto \color{blue}{\frac{a}{-d}} \]
      6. Taylor expanded in c around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, \frac{d}{-c}, b\right)}{c}} \]
    7. Recombined 5 regimes into one program.
    8. Final simplification89.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{\mathsf{fma}\left(c, c, d \cdot d\right)}, d, \frac{c \cdot b}{\mathsf{fma}\left(c, c, d \cdot d\right)}\right)\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{+132}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a \cdot \left(-d\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 83.8% accurate, 0.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(-d, \frac{a}{t\_0}, \frac{c \cdot b}{t\_0}\right)\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{+132}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a \cdot \left(-d\right)}{t\_0}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (let* ((t_0 (fma d d (* c c))))
       (if (<= c -2.7e+73)
         (/ (fma (- d) (/ a c) b) c)
         (if (<= c -6.2e-61)
           (fma (- d) (/ a t_0) (/ (* c b) t_0))
           (if (<= c 7.6e-97)
             (/ (fma b (/ c d) (- a)) d)
             (if (<= c 3.6e+132)
               (fma (/ c t_0) b (/ (* a (- d)) t_0))
               (/ (fma a (- (/ d c)) b) c)))))))
    double code(double a, double b, double c, double d) {
    	double t_0 = fma(d, d, (c * c));
    	double tmp;
    	if (c <= -2.7e+73) {
    		tmp = fma(-d, (a / c), b) / c;
    	} else if (c <= -6.2e-61) {
    		tmp = fma(-d, (a / t_0), ((c * b) / t_0));
    	} else if (c <= 7.6e-97) {
    		tmp = fma(b, (c / d), -a) / d;
    	} else if (c <= 3.6e+132) {
    		tmp = fma((c / t_0), b, ((a * -d) / t_0));
    	} else {
    		tmp = fma(a, -(d / c), b) / c;
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	t_0 = fma(d, d, Float64(c * c))
    	tmp = 0.0
    	if (c <= -2.7e+73)
    		tmp = Float64(fma(Float64(-d), Float64(a / c), b) / c);
    	elseif (c <= -6.2e-61)
    		tmp = fma(Float64(-d), Float64(a / t_0), Float64(Float64(c * b) / t_0));
    	elseif (c <= 7.6e-97)
    		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
    	elseif (c <= 3.6e+132)
    		tmp = fma(Float64(c / t_0), b, Float64(Float64(a * Float64(-d)) / t_0));
    	else
    		tmp = Float64(fma(a, Float64(-Float64(d / c)), b) / c);
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.7e+73], N[(N[((-d) * N[(a / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -6.2e-61], N[((-d) * N[(a / t$95$0), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 7.6e-97], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 3.6e+132], N[(N[(c / t$95$0), $MachinePrecision] * b + N[(N[(a * (-d)), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], N[(N[(a * (-N[(d / c), $MachinePrecision]) + b), $MachinePrecision] / c), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
    \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\
    
    \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\
    \;\;\;\;\mathsf{fma}\left(-d, \frac{a}{t\_0}, \frac{c \cdot b}{t\_0}\right)\\
    
    \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
    
    \mathbf{elif}\;c \leq 3.6 \cdot 10^{+132}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a \cdot \left(-d\right)}{t\_0}\right)\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if c < -2.6999999999999999e73

      1. Initial program 36.0%

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

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

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

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

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

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

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

          \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
        7. lower-*.f6481.6

          \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
      5. Applied rewrites81.6%

        \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
      6. Step-by-step derivation
        1. Applied rewrites89.0%

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

        if -2.6999999999999999e73 < c < -6.1999999999999999e-61

        1. Initial program 81.3%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. 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. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -6.1999999999999999e-61 < c < 7.6000000000000001e-97

        1. Initial program 74.5%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. Taylor expanded in c around 0

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

            \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
          2. distribute-neg-frac2N/A

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

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

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

            \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
          6. lower-neg.f6475.6

            \[\leadsto \frac{a}{\color{blue}{-d}} \]
        5. Applied rewrites75.6%

          \[\leadsto \color{blue}{\frac{a}{-d}} \]
        6. Taylor expanded in d around inf

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

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

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

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
          5. sub-negN/A

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

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

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

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

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

            \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{\mathsf{neg}\left(a\right)}\right)}{d} \]
          11. lower-neg.f6489.3

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

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

        if 7.6000000000000001e-97 < c < 3.60000000000000016e132

        1. Initial program 78.6%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. 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. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{\color{blue}{d \cdot a}}{\mathsf{neg}\left(\left(c \cdot c + d \cdot d\right)\right)}\right) \]
        4. Applied rewrites84.7%

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

        if 3.60000000000000016e132 < c

        1. Initial program 30.5%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. Taylor expanded in c around 0

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

            \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
          2. distribute-neg-frac2N/A

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

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

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

            \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
          6. lower-neg.f6416.8

            \[\leadsto \frac{a}{\color{blue}{-d}} \]
        5. Applied rewrites16.8%

          \[\leadsto \color{blue}{\frac{a}{-d}} \]
        6. Taylor expanded in c around inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, \frac{d}{-c}, b\right)}{c}} \]
      7. Recombined 5 regimes into one program.
      8. Final simplification89.1%

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(-d, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{+132}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a \cdot \left(-d\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 83.2% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := \mathsf{fma}\left(-d, \frac{a}{t\_0}, \frac{c \cdot b}{t\_0}\right)\\ \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 5.1 \cdot 10^{+105}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (fma d d (* c c))) (t_1 (fma (- d) (/ a t_0) (/ (* c b) t_0))))
         (if (<= c -2.7e+73)
           (/ (fma (- d) (/ a c) b) c)
           (if (<= c -6.2e-61)
             t_1
             (if (<= c 7.6e-97)
               (/ (fma b (/ c d) (- a)) d)
               (if (<= c 5.1e+105) t_1 (/ (fma a (- (/ d c)) b) c)))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma(d, d, (c * c));
      	double t_1 = fma(-d, (a / t_0), ((c * b) / t_0));
      	double tmp;
      	if (c <= -2.7e+73) {
      		tmp = fma(-d, (a / c), b) / c;
      	} else if (c <= -6.2e-61) {
      		tmp = t_1;
      	} else if (c <= 7.6e-97) {
      		tmp = fma(b, (c / d), -a) / d;
      	} else if (c <= 5.1e+105) {
      		tmp = t_1;
      	} else {
      		tmp = fma(a, -(d / c), b) / c;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = fma(d, d, Float64(c * c))
      	t_1 = fma(Float64(-d), Float64(a / t_0), Float64(Float64(c * b) / t_0))
      	tmp = 0.0
      	if (c <= -2.7e+73)
      		tmp = Float64(fma(Float64(-d), Float64(a / c), b) / c);
      	elseif (c <= -6.2e-61)
      		tmp = t_1;
      	elseif (c <= 7.6e-97)
      		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
      	elseif (c <= 5.1e+105)
      		tmp = t_1;
      	else
      		tmp = Float64(fma(a, Float64(-Float64(d / c)), b) / c);
      	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[((-d) * N[(a / t$95$0), $MachinePrecision] + N[(N[(c * b), $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.7e+73], N[(N[((-d) * N[(a / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -6.2e-61], t$95$1, If[LessEqual[c, 7.6e-97], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 5.1e+105], t$95$1, N[(N[(a * (-N[(d / c), $MachinePrecision]) + b), $MachinePrecision] / c), $MachinePrecision]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
      t_1 := \mathsf{fma}\left(-d, \frac{a}{t\_0}, \frac{c \cdot b}{t\_0}\right)\\
      \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\
      
      \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
      
      \mathbf{elif}\;c \leq 5.1 \cdot 10^{+105}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 4 regimes
      2. if c < -2.6999999999999999e73

        1. Initial program 36.0%

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

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

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

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

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

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

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

            \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
          7. lower-*.f6481.6

            \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
        5. Applied rewrites81.6%

          \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
        6. Step-by-step derivation
          1. Applied rewrites89.0%

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

          if -2.6999999999999999e73 < c < -6.1999999999999999e-61 or 7.6000000000000001e-97 < c < 5.09999999999999991e105

          1. Initial program 79.8%

            \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. 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. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -6.1999999999999999e-61 < c < 7.6000000000000001e-97

          1. Initial program 74.5%

            \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. Taylor expanded in c around 0

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
            2. distribute-neg-frac2N/A

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

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

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

              \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
            6. lower-neg.f6475.6

              \[\leadsto \frac{a}{\color{blue}{-d}} \]
          5. Applied rewrites75.6%

            \[\leadsto \color{blue}{\frac{a}{-d}} \]
          6. Taylor expanded in d around inf

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

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

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

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

              \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
            5. sub-negN/A

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{\mathsf{neg}\left(a\right)}\right)}{d} \]
            11. lower-neg.f6489.3

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

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

          if 5.09999999999999991e105 < c

          1. Initial program 35.0%

            \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. Taylor expanded in c around 0

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

              \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
            2. distribute-neg-frac2N/A

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

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

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

              \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
            6. lower-neg.f6419.0

              \[\leadsto \frac{a}{\color{blue}{-d}} \]
          5. Applied rewrites19.0%

            \[\leadsto \color{blue}{\frac{a}{-d}} \]
          6. Taylor expanded in c around inf

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \frac{\mathsf{fma}\left(a, \frac{d}{\color{blue}{\mathsf{neg}\left(c\right)}}, b\right)}{c} \]
            13. lower-neg.f6490.6

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

            \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, \frac{d}{-c}, b\right)}{c}} \]
        7. Recombined 4 regimes into one program.
        8. Final simplification88.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -6.2 \cdot 10^{-61}:\\ \;\;\;\;\mathsf{fma}\left(-d, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 5.1 \cdot 10^{+105}:\\ \;\;\;\;\mathsf{fma}\left(-d, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 4: 82.9% accurate, 0.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot b - a \cdot d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -3.6 \cdot 10^{-61}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+104}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- (* c b) (* a d)) (fma c c (* d d)))))
           (if (<= c -2.7e+73)
             (/ (fma (- d) (/ a c) b) c)
             (if (<= c -3.6e-61)
               t_0
               (if (<= c 7.6e-97)
                 (/ (fma b (/ c d) (- a)) d)
                 (if (<= c 2.6e+104) t_0 (/ (fma a (- (/ d c)) b) c)))))))
        double code(double a, double b, double c, double d) {
        	double t_0 = ((c * b) - (a * d)) / fma(c, c, (d * d));
        	double tmp;
        	if (c <= -2.7e+73) {
        		tmp = fma(-d, (a / c), b) / c;
        	} else if (c <= -3.6e-61) {
        		tmp = t_0;
        	} else if (c <= 7.6e-97) {
        		tmp = fma(b, (c / d), -a) / d;
        	} else if (c <= 2.6e+104) {
        		tmp = t_0;
        	} else {
        		tmp = fma(a, -(d / c), b) / c;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(Float64(c * b) - Float64(a * d)) / fma(c, c, Float64(d * d)))
        	tmp = 0.0
        	if (c <= -2.7e+73)
        		tmp = Float64(fma(Float64(-d), Float64(a / c), b) / c);
        	elseif (c <= -3.6e-61)
        		tmp = t_0;
        	elseif (c <= 7.6e-97)
        		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
        	elseif (c <= 2.6e+104)
        		tmp = t_0;
        	else
        		tmp = Float64(fma(a, Float64(-Float64(d / c)), b) / c);
        	end
        	return tmp
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.7e+73], N[(N[((-d) * N[(a / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -3.6e-61], t$95$0, If[LessEqual[c, 7.6e-97], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 2.6e+104], t$95$0, N[(N[(a * (-N[(d / c), $MachinePrecision]) + b), $MachinePrecision] / c), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{c \cdot b - a \cdot d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
        \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\
        
        \mathbf{elif}\;c \leq -3.6 \cdot 10^{-61}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
        
        \mathbf{elif}\;c \leq 2.6 \cdot 10^{+104}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if c < -2.6999999999999999e73

          1. Initial program 36.0%

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

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

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

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

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

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

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

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            7. lower-*.f6481.6

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
          5. Applied rewrites81.6%

            \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
          6. Step-by-step derivation
            1. Applied rewrites89.0%

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

            if -2.6999999999999999e73 < c < -3.60000000000000014e-61 or 7.6000000000000001e-97 < c < 2.6e104

            1. Initial program 79.8%

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

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

                \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c} + d \cdot d} \]
              3. lower-fma.f6479.8

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

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

            if -3.60000000000000014e-61 < c < 7.6000000000000001e-97

            1. Initial program 74.5%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6475.6

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites75.6%

              \[\leadsto \color{blue}{\frac{a}{-d}} \]
            6. Taylor expanded in d around inf

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

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

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

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

                \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
              5. sub-negN/A

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{\mathsf{neg}\left(a\right)}\right)}{d} \]
              11. lower-neg.f6489.3

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

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

            if 2.6e104 < c

            1. Initial program 35.0%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6419.0

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites19.0%

              \[\leadsto \color{blue}{\frac{a}{-d}} \]
            6. Taylor expanded in c around inf

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(a, \frac{d}{\color{blue}{\mathsf{neg}\left(c\right)}}, b\right)}{c} \]
              13. lower-neg.f6490.6

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

              \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(a, \frac{d}{-c}, b\right)}{c}} \]
          7. Recombined 4 regimes into one program.
          8. Final simplification86.9%

            \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{+73}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, \frac{a}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -3.6 \cdot 10^{-61}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{elif}\;c \leq 7.6 \cdot 10^{-97}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+104}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(a, -\frac{d}{c}, b\right)}{c}\\ \end{array} \]
          9. Add Preprocessing

          Alternative 5: 76.6% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \mathbf{if}\;d \leq -7.8 \cdot 10^{+98}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ (fma c (/ b d) (- a)) d)))
             (if (<= d -7.8e+98) t_0 (if (<= d 1.7e+16) (/ (- b (/ (* a d) c)) c) t_0))))
          double code(double a, double b, double c, double d) {
          	double t_0 = fma(c, (b / d), -a) / d;
          	double tmp;
          	if (d <= -7.8e+98) {
          		tmp = t_0;
          	} else if (d <= 1.7e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(a, b, c, d)
          	t_0 = Float64(fma(c, Float64(b / d), Float64(-a)) / d)
          	tmp = 0.0
          	if (d <= -7.8e+98)
          		tmp = t_0;
          	elseif (d <= 1.7e+16)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(c * N[(b / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -7.8e+98], t$95$0, If[LessEqual[d, 1.7e+16], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\
          \mathbf{if}\;d \leq -7.8 \cdot 10^{+98}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if d < -7.7999999999999999e98 or 1.7e16 < d

            1. Initial program 56.6%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

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

                \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
              3. unsub-negN/A

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

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

                \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
              6. div-subN/A

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

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

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

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

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

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

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

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

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

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

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

            if -7.7999999999999999e98 < d < 1.7e16

            1. Initial program 65.5%

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

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

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

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

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

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

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

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
              7. lower-*.f6479.6

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            5. Applied rewrites79.6%

              \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification82.6%

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7.8 \cdot 10^{+98}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 6: 76.2% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{if}\;d \leq -2.5 \cdot 10^{+100}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ (fma b (/ c d) (- a)) d)))
             (if (<= d -2.5e+100)
               t_0
               (if (<= d 1.7e+16) (/ (- b (/ (* a d) c)) c) t_0))))
          double code(double a, double b, double c, double d) {
          	double t_0 = fma(b, (c / d), -a) / d;
          	double tmp;
          	if (d <= -2.5e+100) {
          		tmp = t_0;
          	} else if (d <= 1.7e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(a, b, c, d)
          	t_0 = Float64(fma(b, Float64(c / d), Float64(-a)) / d)
          	tmp = 0.0
          	if (d <= -2.5e+100)
          		tmp = t_0;
          	elseif (d <= 1.7e+16)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -2.5e+100], t$95$0, If[LessEqual[d, 1.7e+16], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
          \mathbf{if}\;d \leq -2.5 \cdot 10^{+100}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if d < -2.4999999999999999e100 or 1.7e16 < d

            1. Initial program 56.6%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6478.3

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites78.3%

              \[\leadsto \color{blue}{\frac{a}{-d}} \]
            6. Taylor expanded in d around inf

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

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

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

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

                \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
              5. sub-negN/A

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

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

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

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

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

                \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{\mathsf{neg}\left(a\right)}\right)}{d} \]
              11. lower-neg.f6486.2

                \[\leadsto \frac{\mathsf{fma}\left(b, \frac{c}{d}, \color{blue}{-a}\right)}{d} \]
            8. Applied rewrites86.2%

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

            if -2.4999999999999999e100 < d < 1.7e16

            1. Initial program 65.5%

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

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

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

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

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

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

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

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
              7. lower-*.f6479.6

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            5. Applied rewrites79.6%

              \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification82.3%

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{+100}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 7: 73.5% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\ \;\;\;\;\frac{a}{-d}\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (if (<= d -2.5e+103)
             (/ a (- d))
             (if (<= d 1.7e+16) (/ (- b (/ (* a d) c)) c) (/ (- (/ (* c b) d) a) d))))
          double code(double a, double b, double c, double d) {
          	double tmp;
          	if (d <= -2.5e+103) {
          		tmp = a / -d;
          	} else if (d <= 1.7e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = (((c * b) / d) - a) / d;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: tmp
              if (d <= (-2.5d+103)) then
                  tmp = a / -d
              else if (d <= 1.7d+16) then
                  tmp = (b - ((a * d) / c)) / c
              else
                  tmp = (((c * b) / d) - a) / d
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double tmp;
          	if (d <= -2.5e+103) {
          		tmp = a / -d;
          	} else if (d <= 1.7e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = (((c * b) / d) - a) / d;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	tmp = 0
          	if d <= -2.5e+103:
          		tmp = a / -d
          	elif d <= 1.7e+16:
          		tmp = (b - ((a * d) / c)) / c
          	else:
          		tmp = (((c * b) / d) - a) / d
          	return tmp
          
          function code(a, b, c, d)
          	tmp = 0.0
          	if (d <= -2.5e+103)
          		tmp = Float64(a / Float64(-d));
          	elseif (d <= 1.7e+16)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	else
          		tmp = Float64(Float64(Float64(Float64(c * b) / d) - a) / d);
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	tmp = 0.0;
          	if (d <= -2.5e+103)
          		tmp = a / -d;
          	elseif (d <= 1.7e+16)
          		tmp = (b - ((a * d) / c)) / c;
          	else
          		tmp = (((c * b) / d) - a) / d;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := If[LessEqual[d, -2.5e+103], N[(a / (-d)), $MachinePrecision], If[LessEqual[d, 1.7e+16], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\
          \;\;\;\;\frac{a}{-d}\\
          
          \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if d < -2.5e103

            1. Initial program 49.0%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6480.1

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites80.1%

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

            if -2.5e103 < d < 1.7e16

            1. Initial program 65.5%

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

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

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

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

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

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

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

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
              7. lower-*.f6479.6

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            5. Applied rewrites79.6%

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

            if 1.7e16 < d

            1. Initial program 61.0%

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f649.8

                \[\leadsto \color{blue}{\frac{b}{c}} \]
            5. Applied rewrites9.8%

              \[\leadsto \color{blue}{\frac{b}{c}} \]
            6. Taylor expanded in d around inf

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

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d}} - a}{d} \]
              7. lower-*.f6485.2

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

              \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification81.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\ \;\;\;\;\frac{a}{-d}\\ \mathbf{elif}\;d \leq 1.7 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c \cdot b}{d} - a}{d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 8: 71.4% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{-d}\\ \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ a (- d))))
             (if (<= d -2.5e+103)
               t_0
               (if (<= d 2.9e+16) (/ (- b (/ (* a d) c)) c) t_0))))
          double code(double a, double b, double c, double d) {
          	double t_0 = a / -d;
          	double tmp;
          	if (d <= -2.5e+103) {
          		tmp = t_0;
          	} else if (d <= 2.9e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              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 = a / -d
              if (d <= (-2.5d+103)) then
                  tmp = t_0
              else if (d <= 2.9d+16) then
                  tmp = (b - ((a * d) / c)) / 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 = a / -d;
          	double tmp;
          	if (d <= -2.5e+103) {
          		tmp = t_0;
          	} else if (d <= 2.9e+16) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	t_0 = a / -d
          	tmp = 0
          	if d <= -2.5e+103:
          		tmp = t_0
          	elif d <= 2.9e+16:
          		tmp = (b - ((a * d) / c)) / c
          	else:
          		tmp = t_0
          	return tmp
          
          function code(a, b, c, d)
          	t_0 = Float64(a / Float64(-d))
          	tmp = 0.0
          	if (d <= -2.5e+103)
          		tmp = t_0;
          	elseif (d <= 2.9e+16)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	t_0 = a / -d;
          	tmp = 0.0;
          	if (d <= -2.5e+103)
          		tmp = t_0;
          	elseif (d <= 2.9e+16)
          		tmp = (b - ((a * d) / c)) / c;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / (-d)), $MachinePrecision]}, If[LessEqual[d, -2.5e+103], t$95$0, If[LessEqual[d, 2.9e+16], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{a}{-d}\\
          \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq 2.9 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if d < -2.5e103 or 2.9e16 < d

            1. Initial program 56.6%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6478.3

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites78.3%

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

            if -2.5e103 < d < 2.9e16

            1. Initial program 65.5%

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

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

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

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

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

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

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

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
              7. lower-*.f6479.6

                \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            5. Applied rewrites79.6%

              \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
          3. Recombined 2 regimes into one program.
          4. Final simplification79.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.5 \cdot 10^{+103}:\\ \;\;\;\;\frac{a}{-d}\\ \mathbf{elif}\;d \leq 2.9 \cdot 10^{+16}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{-d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 9: 64.9% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{-d}\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{+139}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -9500000000:\\ \;\;\;\;a \cdot \frac{-d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ a (- d))))
             (if (<= d -2.4e+139)
               t_0
               (if (<= d -9500000000.0)
                 (* a (/ (- d) (fma c c (* d d))))
                 (if (<= d 2.55e+16) (/ b c) t_0)))))
          double code(double a, double b, double c, double d) {
          	double t_0 = a / -d;
          	double tmp;
          	if (d <= -2.4e+139) {
          		tmp = t_0;
          	} else if (d <= -9500000000.0) {
          		tmp = a * (-d / fma(c, c, (d * d)));
          	} else if (d <= 2.55e+16) {
          		tmp = b / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          function code(a, b, c, d)
          	t_0 = Float64(a / Float64(-d))
          	tmp = 0.0
          	if (d <= -2.4e+139)
          		tmp = t_0;
          	elseif (d <= -9500000000.0)
          		tmp = Float64(a * Float64(Float64(-d) / fma(c, c, Float64(d * d))));
          	elseif (d <= 2.55e+16)
          		tmp = Float64(b / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / (-d)), $MachinePrecision]}, If[LessEqual[d, -2.4e+139], t$95$0, If[LessEqual[d, -9500000000.0], N[(a * N[((-d) / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.55e+16], N[(b / c), $MachinePrecision], t$95$0]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{a}{-d}\\
          \mathbf{if}\;d \leq -2.4 \cdot 10^{+139}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq -9500000000:\\
          \;\;\;\;a \cdot \frac{-d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\
          
          \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if d < -2.40000000000000008e139 or 2.55e16 < d

            1. Initial program 54.6%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6478.9

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites78.9%

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

            if -2.40000000000000008e139 < d < -9.5e9

            1. Initial program 68.0%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6457.1

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites57.1%

              \[\leadsto \color{blue}{\frac{a}{-d}} \]
            6. Taylor expanded in b around 0

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

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

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

                \[\leadsto \mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{{c}^{2} + {d}^{2}}}\right) \]
              4. lower-*.f64N/A

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

                \[\leadsto \mathsf{neg}\left(a \cdot \color{blue}{\frac{d}{{c}^{2} + {d}^{2}}}\right) \]
              6. unpow2N/A

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

                \[\leadsto \mathsf{neg}\left(a \cdot \frac{d}{\color{blue}{\mathsf{fma}\left(c, c, {d}^{2}\right)}}\right) \]
              8. unpow2N/A

                \[\leadsto \mathsf{neg}\left(a \cdot \frac{d}{\mathsf{fma}\left(c, c, \color{blue}{d \cdot d}\right)}\right) \]
              9. lower-*.f6475.2

                \[\leadsto -a \cdot \frac{d}{\mathsf{fma}\left(c, c, \color{blue}{d \cdot d}\right)} \]
            8. Applied rewrites75.2%

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

            if -9.5e9 < d < 2.55e16

            1. Initial program 65.6%

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f6467.0

                \[\leadsto \color{blue}{\frac{b}{c}} \]
            5. Applied rewrites67.0%

              \[\leadsto \color{blue}{\frac{b}{c}} \]
          3. Recombined 3 regimes into one program.
          4. Final simplification72.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+139}:\\ \;\;\;\;\frac{a}{-d}\\ \mathbf{elif}\;d \leq -9500000000:\\ \;\;\;\;a \cdot \frac{-d}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{-d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 10: 63.8% accurate, 1.3× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -17000000000:\\ \;\;\;\;\frac{-1}{\frac{d}{a}}\\ \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{-d}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (if (<= d -17000000000.0)
             (/ -1.0 (/ d a))
             (if (<= d 2.55e+16) (/ b c) (/ a (- d)))))
          double code(double a, double b, double c, double d) {
          	double tmp;
          	if (d <= -17000000000.0) {
          		tmp = -1.0 / (d / a);
          	} else if (d <= 2.55e+16) {
          		tmp = b / c;
          	} else {
          		tmp = a / -d;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: tmp
              if (d <= (-17000000000.0d0)) then
                  tmp = (-1.0d0) / (d / a)
              else if (d <= 2.55d+16) then
                  tmp = b / c
              else
                  tmp = a / -d
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double tmp;
          	if (d <= -17000000000.0) {
          		tmp = -1.0 / (d / a);
          	} else if (d <= 2.55e+16) {
          		tmp = b / c;
          	} else {
          		tmp = a / -d;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	tmp = 0
          	if d <= -17000000000.0:
          		tmp = -1.0 / (d / a)
          	elif d <= 2.55e+16:
          		tmp = b / c
          	else:
          		tmp = a / -d
          	return tmp
          
          function code(a, b, c, d)
          	tmp = 0.0
          	if (d <= -17000000000.0)
          		tmp = Float64(-1.0 / Float64(d / a));
          	elseif (d <= 2.55e+16)
          		tmp = Float64(b / c);
          	else
          		tmp = Float64(a / Float64(-d));
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	tmp = 0.0;
          	if (d <= -17000000000.0)
          		tmp = -1.0 / (d / a);
          	elseif (d <= 2.55e+16)
          		tmp = b / c;
          	else
          		tmp = a / -d;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := If[LessEqual[d, -17000000000.0], N[(-1.0 / N[(d / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.55e+16], N[(b / c), $MachinePrecision], N[(a / (-d)), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;d \leq -17000000000:\\
          \;\;\;\;\frac{-1}{\frac{d}{a}}\\
          
          \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{a}{-d}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if d < -1.7e10

            1. Initial program 53.9%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. 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. div-invN/A

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

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

                \[\leadsto \color{blue}{\frac{{\left(b \cdot c\right)}^{3} - {\left(a \cdot d\right)}^{3}}{\left(b \cdot c\right) \cdot \left(b \cdot c\right) + \left(\left(a \cdot d\right) \cdot \left(a \cdot d\right) + \left(b \cdot c\right) \cdot \left(a \cdot d\right)\right)}} \cdot \frac{1}{c \cdot c + d \cdot d} \]
              5. clear-numN/A

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

                \[\leadsto \frac{1}{\frac{\left(b \cdot c\right) \cdot \left(b \cdot c\right) + \left(\left(a \cdot d\right) \cdot \left(a \cdot d\right) + \left(b \cdot c\right) \cdot \left(a \cdot d\right)\right)}{{\left(b \cdot c\right)}^{3} - {\left(a \cdot d\right)}^{3}}} \cdot \color{blue}{\frac{\mathsf{neg}\left(1\right)}{\mathsf{neg}\left(\left(c \cdot c + d \cdot d\right)\right)}} \]
              7. metadata-evalN/A

                \[\leadsto \frac{1}{\frac{\left(b \cdot c\right) \cdot \left(b \cdot c\right) + \left(\left(a \cdot d\right) \cdot \left(a \cdot d\right) + \left(b \cdot c\right) \cdot \left(a \cdot d\right)\right)}{{\left(b \cdot c\right)}^{3} - {\left(a \cdot d\right)}^{3}}} \cdot \frac{\color{blue}{-1}}{\mathsf{neg}\left(\left(c \cdot c + d \cdot d\right)\right)} \]
              8. frac-timesN/A

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

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

                \[\leadsto \color{blue}{\frac{-1}{\frac{\left(b \cdot c\right) \cdot \left(b \cdot c\right) + \left(\left(a \cdot d\right) \cdot \left(a \cdot d\right) + \left(b \cdot c\right) \cdot \left(a \cdot d\right)\right)}{{\left(b \cdot c\right)}^{3} - {\left(a \cdot d\right)}^{3}} \cdot \left(\mathsf{neg}\left(\left(c \cdot c + d \cdot d\right)\right)\right)}} \]
            4. Applied rewrites53.9%

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

              \[\leadsto \frac{-1}{\color{blue}{\frac{d}{a}}} \]
            6. Step-by-step derivation
              1. lower-/.f6470.2

                \[\leadsto \frac{-1}{\color{blue}{\frac{d}{a}}} \]
            7. Applied rewrites70.2%

              \[\leadsto \frac{-1}{\color{blue}{\frac{d}{a}}} \]

            if -1.7e10 < d < 2.55e16

            1. Initial program 65.6%

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f6467.0

                \[\leadsto \color{blue}{\frac{b}{c}} \]
            5. Applied rewrites67.0%

              \[\leadsto \color{blue}{\frac{b}{c}} \]

            if 2.55e16 < d

            1. Initial program 61.0%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6477.3

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites77.3%

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

          Alternative 11: 63.9% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{a}{-d}\\ \mathbf{if}\;d \leq -17000000000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ a (- d))))
             (if (<= d -17000000000.0) t_0 (if (<= d 2.55e+16) (/ b c) t_0))))
          double code(double a, double b, double c, double d) {
          	double t_0 = a / -d;
          	double tmp;
          	if (d <= -17000000000.0) {
          		tmp = t_0;
          	} else if (d <= 2.55e+16) {
          		tmp = b / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              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 = a / -d
              if (d <= (-17000000000.0d0)) then
                  tmp = t_0
              else if (d <= 2.55d+16) then
                  tmp = 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 = a / -d;
          	double tmp;
          	if (d <= -17000000000.0) {
          		tmp = t_0;
          	} else if (d <= 2.55e+16) {
          		tmp = b / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	t_0 = a / -d
          	tmp = 0
          	if d <= -17000000000.0:
          		tmp = t_0
          	elif d <= 2.55e+16:
          		tmp = b / c
          	else:
          		tmp = t_0
          	return tmp
          
          function code(a, b, c, d)
          	t_0 = Float64(a / Float64(-d))
          	tmp = 0.0
          	if (d <= -17000000000.0)
          		tmp = t_0;
          	elseif (d <= 2.55e+16)
          		tmp = Float64(b / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	t_0 = a / -d;
          	tmp = 0.0;
          	if (d <= -17000000000.0)
          		tmp = t_0;
          	elseif (d <= 2.55e+16)
          		tmp = b / c;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(a / (-d)), $MachinePrecision]}, If[LessEqual[d, -17000000000.0], t$95$0, If[LessEqual[d, 2.55e+16], N[(b / c), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{a}{-d}\\
          \mathbf{if}\;d \leq -17000000000:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq 2.55 \cdot 10^{+16}:\\
          \;\;\;\;\frac{b}{c}\\
          
          \mathbf{else}:\\
          \;\;\;\;t\_0\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if d < -1.7e10 or 2.55e16 < d

            1. Initial program 57.7%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

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

                \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{a}{d}\right)} \]
              2. distribute-neg-frac2N/A

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

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

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

                \[\leadsto \frac{a}{\color{blue}{\mathsf{neg}\left(d\right)}} \]
              6. lower-neg.f6473.8

                \[\leadsto \frac{a}{\color{blue}{-d}} \]
            5. Applied rewrites73.8%

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

            if -1.7e10 < d < 2.55e16

            1. Initial program 65.6%

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f6467.0

                \[\leadsto \color{blue}{\frac{b}{c}} \]
            5. Applied rewrites67.0%

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

          Alternative 12: 42.3% accurate, 3.2× 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;
          }
          
          real(8) function code(a, b, c, d)
              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 61.9%

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

            \[\leadsto \color{blue}{\frac{b}{c}} \]
          4. Step-by-step derivation
            1. lower-/.f6443.1

              \[\leadsto \color{blue}{\frac{b}{c}} \]
          5. Applied rewrites43.1%

            \[\leadsto \color{blue}{\frac{b}{c}} \]
          6. Add Preprocessing

          Developer Target 1: 99.4% accurate, 0.6× 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;
          }
          
          real(8) function code(a, b, c, d)
              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 2024233 
          (FPCore (a b c d)
            :name "Complex division, imag part"
            :precision binary64
          
            :alt
            (! :herbie-platform default (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))))