Complex division, imag part

Percentage Accurate: 61.2% → 82.2%
Time: 5.6s
Alternatives: 13
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 13 alternatives:

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

Initial Program: 61.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{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: 82.2% accurate, 0.3× speedup?

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

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

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

\mathbf{elif}\;d \leq 2.15 \cdot 10^{-181}:\\
\;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\

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

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


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

    1. Initial program 39.3%

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{b \cdot c}{a \cdot \left({c}^{2} + {d}^{2}\right)} + \frac{d}{{c}^{2} + {d}^{2}}\right)\right)\right) \cdot a} \]
    5. Applied rewrites47.2%

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

      \[\leadsto \left(\frac{b \cdot c}{a \cdot {d}^{2}} - \frac{1}{d}\right) \cdot a \]
    7. Step-by-step derivation
      1. Applied rewrites73.1%

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

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

        if -4.9000000000000003e60 < d < -2.3499999999999999e-160

        1. Initial program 92.2%

          \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
          2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

        if -2.3499999999999999e-160 < d < 2.15e-181

        1. Initial program 70.3%

          \[\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. lower-*.f6492.6

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

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

        if 2.15e-181 < d < 5.79999999999999969e137

        1. Initial program 79.7%

          \[\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. lift-*.f64N/A

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

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

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

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

        if 5.79999999999999969e137 < d

        1. Initial program 30.0%

          \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
          2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
        9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left({a}^{-1}, \frac{b}{d} \cdot c, -1\right)}{d} \cdot a\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-181}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 2: 81.9% accurate, 0.5× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-181}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (fma d d (* c c))))
         (if (<= d -4.9e+60)
           (* (/ (fma (/ (- c) -1.0) (/ (/ b d) a) -1.0) d) a)
           (if (<= d -2.35e-160)
             (/ (fma (- d) a (* c b)) t_0)
             (if (<= d 2.15e-181)
               (/ (- b (/ (* a d) c)) c)
               (if (<= d 5.8e+137)
                 (fma (/ c t_0) b (* (/ a t_0) (- d)))
                 (/ (fma (/ c d) b (- a)) d)))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma(d, d, (c * c));
      	double tmp;
      	if (d <= -4.9e+60) {
      		tmp = (fma((-c / -1.0), ((b / d) / a), -1.0) / d) * a;
      	} else if (d <= -2.35e-160) {
      		tmp = fma(-d, a, (c * b)) / t_0;
      	} else if (d <= 2.15e-181) {
      		tmp = (b - ((a * d) / c)) / c;
      	} else if (d <= 5.8e+137) {
      		tmp = fma((c / t_0), b, ((a / t_0) * -d));
      	} else {
      		tmp = fma((c / d), b, -a) / d;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = fma(d, d, Float64(c * c))
      	tmp = 0.0
      	if (d <= -4.9e+60)
      		tmp = Float64(Float64(fma(Float64(Float64(-c) / -1.0), Float64(Float64(b / d) / a), -1.0) / d) * a);
      	elseif (d <= -2.35e-160)
      		tmp = Float64(fma(Float64(-d), a, Float64(c * b)) / t_0);
      	elseif (d <= 2.15e-181)
      		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
      	elseif (d <= 5.8e+137)
      		tmp = fma(Float64(c / t_0), b, Float64(Float64(a / t_0) * Float64(-d)));
      	else
      		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.9e+60], N[(N[(N[(N[((-c) / -1.0), $MachinePrecision] * N[(N[(b / d), $MachinePrecision] / a), $MachinePrecision] + -1.0), $MachinePrecision] / d), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[d, -2.35e-160], N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[d, 2.15e-181], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 5.8e+137], N[(N[(c / t$95$0), $MachinePrecision] * b + N[(N[(a / t$95$0), $MachinePrecision] * (-d)), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
      \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\
      
      \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\
      
      \mathbf{elif}\;d \leq 2.15 \cdot 10^{-181}:\\
      \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
      
      \mathbf{elif}\;d \leq 5.8 \cdot 10^{+137}:\\
      \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 5 regimes
      2. if d < -4.9000000000000003e60

        1. Initial program 39.3%

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{b \cdot c}{a \cdot \left({c}^{2} + {d}^{2}\right)} + \frac{d}{{c}^{2} + {d}^{2}}\right)\right)\right) \cdot a} \]
        5. Applied rewrites47.2%

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

          \[\leadsto \left(\frac{b \cdot c}{a \cdot {d}^{2}} - \frac{1}{d}\right) \cdot a \]
        7. Step-by-step derivation
          1. Applied rewrites73.1%

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

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

            if -4.9000000000000003e60 < d < -2.3499999999999999e-160

            1. Initial program 92.2%

              \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
              2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

            if -2.3499999999999999e-160 < d < 2.15e-181

            1. Initial program 70.3%

              \[\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. lower-*.f6492.6

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

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

            if 2.15e-181 < d < 5.79999999999999969e137

            1. Initial program 79.7%

              \[\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. lift-*.f64N/A

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

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

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

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

            if 5.79999999999999969e137 < d

            1. Initial program 30.0%

              \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
              2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
            9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 2.15 \cdot 10^{-181}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 3: 81.9% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{-1}{t\_0} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (fma d d (* c c))))
             (if (<= d -4.9e+60)
               (* (/ (fma (/ (- c) -1.0) (/ (/ b d) a) -1.0) d) a)
               (if (<= d -2.35e-160)
                 (/ (fma (- d) a (* c b)) t_0)
                 (if (<= d 2.6e-115)
                   (/ (- b (/ (* a d) c)) c)
                   (if (<= d 5.6e+93)
                     (* (/ -1.0 t_0) (fma (- b) c (* a d)))
                     (/ (fma (/ c d) b (- a)) d)))))))
          double code(double a, double b, double c, double d) {
          	double t_0 = fma(d, d, (c * c));
          	double tmp;
          	if (d <= -4.9e+60) {
          		tmp = (fma((-c / -1.0), ((b / d) / a), -1.0) / d) * a;
          	} else if (d <= -2.35e-160) {
          		tmp = fma(-d, a, (c * b)) / t_0;
          	} else if (d <= 2.6e-115) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else if (d <= 5.6e+93) {
          		tmp = (-1.0 / t_0) * fma(-b, c, (a * d));
          	} else {
          		tmp = fma((c / d), b, -a) / d;
          	}
          	return tmp;
          }
          
          function code(a, b, c, d)
          	t_0 = fma(d, d, Float64(c * c))
          	tmp = 0.0
          	if (d <= -4.9e+60)
          		tmp = Float64(Float64(fma(Float64(Float64(-c) / -1.0), Float64(Float64(b / d) / a), -1.0) / d) * a);
          	elseif (d <= -2.35e-160)
          		tmp = Float64(fma(Float64(-d), a, Float64(c * b)) / t_0);
          	elseif (d <= 2.6e-115)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	elseif (d <= 5.6e+93)
          		tmp = Float64(Float64(-1.0 / t_0) * fma(Float64(-b), c, Float64(a * d)));
          	else
          		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
          	end
          	return tmp
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -4.9e+60], N[(N[(N[(N[((-c) / -1.0), $MachinePrecision] * N[(N[(b / d), $MachinePrecision] / a), $MachinePrecision] + -1.0), $MachinePrecision] / d), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[d, -2.35e-160], N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[d, 2.6e-115], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 5.6e+93], N[(N[(-1.0 / t$95$0), $MachinePrecision] * N[((-b) * c + N[(a * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
          \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\
          \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\
          
          \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\
          \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\
          
          \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\
          \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
          
          \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\
          \;\;\;\;\frac{-1}{t\_0} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 5 regimes
          2. if d < -4.9000000000000003e60

            1. Initial program 39.3%

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \color{blue}{\left(\mathsf{neg}\left(\left(-1 \cdot \frac{b \cdot c}{a \cdot \left({c}^{2} + {d}^{2}\right)} + \frac{d}{{c}^{2} + {d}^{2}}\right)\right)\right) \cdot a} \]
            5. Applied rewrites47.2%

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

              \[\leadsto \left(\frac{b \cdot c}{a \cdot {d}^{2}} - \frac{1}{d}\right) \cdot a \]
            7. Step-by-step derivation
              1. Applied rewrites73.1%

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

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

                if -4.9000000000000003e60 < d < -2.3499999999999999e-160

                1. Initial program 92.2%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -2.3499999999999999e-160 < d < 2.60000000000000004e-115

                1. Initial program 73.2%

                  \[\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. lower-*.f6492.5

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

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

                if 2.60000000000000004e-115 < d < 5.59999999999999978e93

                1. Initial program 87.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. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if 5.59999999999999978e93 < d

                1. Initial program 35.1%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
                9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{-c}{-1}, \frac{\frac{b}{d}}{a}, -1\right)}{d} \cdot a\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 4: 82.4% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{-1}{t\_0} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (let* ((t_0 (fma d d (* c c))) (t_1 (/ (fma (/ c d) b (- a)) d)))
                 (if (<= d -4.9e+60)
                   t_1
                   (if (<= d -2.35e-160)
                     (/ (fma (- d) a (* c b)) t_0)
                     (if (<= d 2.6e-115)
                       (/ (- b (/ (* a d) c)) c)
                       (if (<= d 5.6e+93) (* (/ -1.0 t_0) (fma (- b) c (* a d))) t_1))))))
              double code(double a, double b, double c, double d) {
              	double t_0 = fma(d, d, (c * c));
              	double t_1 = fma((c / d), b, -a) / d;
              	double tmp;
              	if (d <= -4.9e+60) {
              		tmp = t_1;
              	} else if (d <= -2.35e-160) {
              		tmp = fma(-d, a, (c * b)) / t_0;
              	} else if (d <= 2.6e-115) {
              		tmp = (b - ((a * d) / c)) / c;
              	} else if (d <= 5.6e+93) {
              		tmp = (-1.0 / t_0) * fma(-b, c, (a * d));
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	t_0 = fma(d, d, Float64(c * c))
              	t_1 = Float64(fma(Float64(c / d), b, Float64(-a)) / d)
              	tmp = 0.0
              	if (d <= -4.9e+60)
              		tmp = t_1;
              	elseif (d <= -2.35e-160)
              		tmp = Float64(fma(Float64(-d), a, Float64(c * b)) / t_0);
              	elseif (d <= 2.6e-115)
              		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
              	elseif (d <= 5.6e+93)
              		tmp = Float64(Float64(-1.0 / t_0) * fma(Float64(-b), c, Float64(a * d)));
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -4.9e+60], t$95$1, If[LessEqual[d, -2.35e-160], N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[d, 2.6e-115], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 5.6e+93], N[(N[(-1.0 / t$95$0), $MachinePrecision] * N[((-b) * c + N[(a * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
              t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
              \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\
              \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\
              
              \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\
              \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
              
              \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\
              \;\;\;\;\frac{-1}{t\_0} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if d < -4.9000000000000003e60 or 5.59999999999999978e93 < d

                1. Initial program 37.5%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
                9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -4.9000000000000003e60 < d < -2.3499999999999999e-160

                1. Initial program 92.2%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -2.3499999999999999e-160 < d < 2.60000000000000004e-115

                1. Initial program 73.2%

                  \[\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. lower-*.f6492.5

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

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

                if 2.60000000000000004e-115 < d < 5.59999999999999978e93

                1. Initial program 87.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. frac-2negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \mathsf{fma}\left(-b, c, a \cdot d\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 5: 82.4% accurate, 0.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (let* ((t_0 (/ (fma (- d) a (* c b)) (fma d d (* c c))))
                      (t_1 (/ (fma (/ c d) b (- a)) d)))
                 (if (<= d -4.9e+60)
                   t_1
                   (if (<= d -2.35e-160)
                     t_0
                     (if (<= d 2.6e-115)
                       (/ (- b (/ (* a d) c)) c)
                       (if (<= d 5.6e+93) t_0 t_1))))))
              double code(double a, double b, double c, double d) {
              	double t_0 = fma(-d, a, (c * b)) / fma(d, d, (c * c));
              	double t_1 = fma((c / d), b, -a) / d;
              	double tmp;
              	if (d <= -4.9e+60) {
              		tmp = t_1;
              	} else if (d <= -2.35e-160) {
              		tmp = t_0;
              	} else if (d <= 2.6e-115) {
              		tmp = (b - ((a * d) / c)) / c;
              	} else if (d <= 5.6e+93) {
              		tmp = t_0;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	t_0 = Float64(fma(Float64(-d), a, Float64(c * b)) / fma(d, d, Float64(c * c)))
              	t_1 = Float64(fma(Float64(c / d), b, Float64(-a)) / d)
              	tmp = 0.0
              	if (d <= -4.9e+60)
              		tmp = t_1;
              	elseif (d <= -2.35e-160)
              		tmp = t_0;
              	elseif (d <= 2.6e-115)
              		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
              	elseif (d <= 5.6e+93)
              		tmp = t_0;
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -4.9e+60], t$95$1, If[LessEqual[d, -2.35e-160], t$95$0, If[LessEqual[d, 2.6e-115], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 5.6e+93], t$95$0, t$95$1]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
              t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
              \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\
              \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
              
              \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if d < -4.9000000000000003e60 or 5.59999999999999978e93 < d

                1. Initial program 37.5%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
                9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -4.9000000000000003e60 < d < -2.3499999999999999e-160 or 2.60000000000000004e-115 < d < 5.59999999999999978e93

                1. Initial program 89.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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -2.3499999999999999e-160 < d < 2.60000000000000004e-115

                1. Initial program 73.2%

                  \[\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. lower-*.f6492.5

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -2.35 \cdot 10^{-160}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{-115}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 5.6 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 6: 62.1% accurate, 0.7× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ t_1 := c \cdot b - a \cdot d\\ \mathbf{if}\;d \leq -2.2 \cdot 10^{+29}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-66}:\\ \;\;\;\;\frac{t\_1}{d \cdot d}\\ \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{t\_1}{c \cdot c}\\ \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (let* ((t_0 (/ (- a) d)) (t_1 (- (* c b) (* a d))))
                 (if (<= d -2.2e+29)
                   t_0
                   (if (<= d -4.4e-66)
                     (/ t_1 (* d d))
                     (if (<= d 3.4e-34)
                       (/ t_1 (* c c))
                       (if (<= d 2.8e+46) (* (/ c (fma c c (* d d))) b) t_0))))))
              double code(double a, double b, double c, double d) {
              	double t_0 = -a / d;
              	double t_1 = (c * b) - (a * d);
              	double tmp;
              	if (d <= -2.2e+29) {
              		tmp = t_0;
              	} else if (d <= -4.4e-66) {
              		tmp = t_1 / (d * d);
              	} else if (d <= 3.4e-34) {
              		tmp = t_1 / (c * c);
              	} else if (d <= 2.8e+46) {
              		tmp = (c / fma(c, c, (d * d))) * b;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	t_0 = Float64(Float64(-a) / d)
              	t_1 = Float64(Float64(c * b) - Float64(a * d))
              	tmp = 0.0
              	if (d <= -2.2e+29)
              		tmp = t_0;
              	elseif (d <= -4.4e-66)
              		tmp = Float64(t_1 / Float64(d * d));
              	elseif (d <= 3.4e-34)
              		tmp = Float64(t_1 / Float64(c * c));
              	elseif (d <= 2.8e+46)
              		tmp = Float64(Float64(c / fma(c, c, Float64(d * d))) * b);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.2e+29], t$95$0, If[LessEqual[d, -4.4e-66], N[(t$95$1 / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 3.4e-34], N[(t$95$1 / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e+46], N[(N[(c / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{-a}{d}\\
              t_1 := c \cdot b - a \cdot d\\
              \mathbf{if}\;d \leq -2.2 \cdot 10^{+29}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;d \leq -4.4 \cdot 10^{-66}:\\
              \;\;\;\;\frac{t\_1}{d \cdot d}\\
              
              \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\
              \;\;\;\;\frac{t\_1}{c \cdot c}\\
              
              \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\
              \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 4 regimes
              2. if d < -2.2000000000000001e29 or 2.80000000000000018e46 < d

                1. Initial program 43.2%

                  \[\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.9

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

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

                if -2.2000000000000001e29 < d < -4.4000000000000002e-66

                1. Initial program 88.8%

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

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

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

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

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

                if -4.4000000000000002e-66 < d < 3.4000000000000001e-34

                1. Initial program 80.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 \frac{b \cdot c - a \cdot d}{\color{blue}{{c}^{2}}} \]
                4. Step-by-step derivation
                  1. unpow2N/A

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

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

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

                if 3.4000000000000001e-34 < d < 2.80000000000000018e46

                1. Initial program 76.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 \frac{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{c}{{c}^{2} + {d}^{2}}} \cdot b \]
                  5. unpow2N/A

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

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

                    \[\leadsto \frac{c}{\mathsf{fma}\left(c, c, \color{blue}{d \cdot d}\right)} \cdot b \]
                  8. lower-*.f6465.9

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

                  \[\leadsto \color{blue}{\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b} \]
              3. Recombined 4 regimes into one program.
              4. Final simplification71.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.2 \cdot 10^{+29}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -4.4 \cdot 10^{-66}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 7: 72.5% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.9 \cdot 10^{+82}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -2.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;c \leq 46000:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (if (<= c -2.9e+82)
                 (/ b c)
                 (if (<= c -2.1e-22)
                   (/ (- (* c b) (* a d)) (* c c))
                   (if (<= c 46000.0) (/ (fma (/ c d) b (- a)) d) (/ b c)))))
              double code(double a, double b, double c, double d) {
              	double tmp;
              	if (c <= -2.9e+82) {
              		tmp = b / c;
              	} else if (c <= -2.1e-22) {
              		tmp = ((c * b) - (a * d)) / (c * c);
              	} else if (c <= 46000.0) {
              		tmp = fma((c / d), b, -a) / d;
              	} else {
              		tmp = b / c;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	tmp = 0.0
              	if (c <= -2.9e+82)
              		tmp = Float64(b / c);
              	elseif (c <= -2.1e-22)
              		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(c * c));
              	elseif (c <= 46000.0)
              		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
              	else
              		tmp = Float64(b / c);
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := If[LessEqual[c, -2.9e+82], N[(b / c), $MachinePrecision], If[LessEqual[c, -2.1e-22], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 46000.0], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;c \leq -2.9 \cdot 10^{+82}:\\
              \;\;\;\;\frac{b}{c}\\
              
              \mathbf{elif}\;c \leq -2.1 \cdot 10^{-22}:\\
              \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\
              
              \mathbf{elif}\;c \leq 46000:\\
              \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{b}{c}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if c < -2.9000000000000001e82 or 46000 < c

                1. Initial program 44.8%

                  \[\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-/.f6469.4

                    \[\leadsto \color{blue}{\frac{b}{c}} \]
                5. Applied rewrites69.4%

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

                if -2.9000000000000001e82 < c < -2.10000000000000008e-22

                1. Initial program 74.4%

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

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

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

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

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

                if -2.10000000000000008e-22 < c < 46000

                1. Initial program 76.1%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
                9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 8: 61.3% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -2.1 \cdot 10^{-52}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (let* ((t_0 (/ (- a) d)))
                 (if (<= d -2.1e-52)
                   t_0
                   (if (<= d 3.4e-34)
                     (/ (- (* c b) (* a d)) (* c c))
                     (if (<= d 2.8e+46) (* (/ c (fma c c (* d d))) b) t_0)))))
              double code(double a, double b, double c, double d) {
              	double t_0 = -a / d;
              	double tmp;
              	if (d <= -2.1e-52) {
              		tmp = t_0;
              	} else if (d <= 3.4e-34) {
              		tmp = ((c * b) - (a * d)) / (c * c);
              	} else if (d <= 2.8e+46) {
              		tmp = (c / fma(c, c, (d * d))) * b;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	t_0 = Float64(Float64(-a) / d)
              	tmp = 0.0
              	if (d <= -2.1e-52)
              		tmp = t_0;
              	elseif (d <= 3.4e-34)
              		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(c * c));
              	elseif (d <= 2.8e+46)
              		tmp = Float64(Float64(c / fma(c, c, Float64(d * d))) * b);
              	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.1e-52], t$95$0, If[LessEqual[d, 3.4e-34], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.8e+46], N[(N[(c / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], t$95$0]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{-a}{d}\\
              \mathbf{if}\;d \leq -2.1 \cdot 10^{-52}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\
              \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\
              
              \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\
              \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if d < -2.0999999999999999e-52 or 2.80000000000000018e46 < d

                1. Initial program 48.3%

                  \[\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.f6470.3

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

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

                if -2.0999999999999999e-52 < d < 3.4000000000000001e-34

                1. Initial program 81.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 \frac{b \cdot c - a \cdot d}{\color{blue}{{c}^{2}}} \]
                4. Step-by-step derivation
                  1. unpow2N/A

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

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

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

                if 3.4000000000000001e-34 < d < 2.80000000000000018e46

                1. Initial program 76.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 \frac{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{c}{{c}^{2} + {d}^{2}}} \cdot b \]
                  5. unpow2N/A

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

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

                    \[\leadsto \frac{c}{\mathsf{fma}\left(c, c, \color{blue}{d \cdot d}\right)} \cdot b \]
                  8. lower-*.f6465.9

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

                  \[\leadsto \color{blue}{\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b} \]
              3. Recombined 3 regimes into one program.
              4. Final simplification68.8%

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.1 \cdot 10^{-52}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq 3.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 2.8 \cdot 10^{+46}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 9: 64.2% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+38}:\\ \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (if (<= c -2.7e-22)
                 (/ b c)
                 (if (<= c 1.45e-86)
                   (/ (- a) d)
                   (if (<= c 1.1e+38) (/ (* c b) (fma d d (* c c))) (/ b c)))))
              double code(double a, double b, double c, double d) {
              	double tmp;
              	if (c <= -2.7e-22) {
              		tmp = b / c;
              	} else if (c <= 1.45e-86) {
              		tmp = -a / d;
              	} else if (c <= 1.1e+38) {
              		tmp = (c * b) / fma(d, d, (c * c));
              	} else {
              		tmp = b / c;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	tmp = 0.0
              	if (c <= -2.7e-22)
              		tmp = Float64(b / c);
              	elseif (c <= 1.45e-86)
              		tmp = Float64(Float64(-a) / d);
              	elseif (c <= 1.1e+38)
              		tmp = Float64(Float64(c * b) / fma(d, d, Float64(c * c)));
              	else
              		tmp = Float64(b / c);
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := If[LessEqual[c, -2.7e-22], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.45e-86], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 1.1e+38], N[(N[(c * b), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\
              \;\;\;\;\frac{b}{c}\\
              
              \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\
              \;\;\;\;\frac{-a}{d}\\
              
              \mathbf{elif}\;c \leq 1.1 \cdot 10^{+38}:\\
              \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{b}{c}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if c < -2.7000000000000002e-22 or 1.10000000000000003e38 < c

                1. Initial program 46.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-/.f6465.7

                    \[\leadsto \color{blue}{\frac{b}{c}} \]
                5. Applied rewrites65.7%

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

                if -2.7000000000000002e-22 < c < 1.45e-86

                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.f6471.7

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

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

                if 1.45e-86 < c < 1.10000000000000003e38

                1. Initial program 89.0%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
              3. Recombined 3 regimes into one program.
              4. Final simplification67.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+38}:\\ \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 10: 64.7% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 1.65 \cdot 10^{+103}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (if (<= c -2.7e-22)
                 (/ b c)
                 (if (<= c 1.45e-86)
                   (/ (- a) d)
                   (if (<= c 1.65e+103) (* (/ c (fma c c (* d d))) b) (/ b c)))))
              double code(double a, double b, double c, double d) {
              	double tmp;
              	if (c <= -2.7e-22) {
              		tmp = b / c;
              	} else if (c <= 1.45e-86) {
              		tmp = -a / d;
              	} else if (c <= 1.65e+103) {
              		tmp = (c / fma(c, c, (d * d))) * b;
              	} else {
              		tmp = b / c;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	tmp = 0.0
              	if (c <= -2.7e-22)
              		tmp = Float64(b / c);
              	elseif (c <= 1.45e-86)
              		tmp = Float64(Float64(-a) / d);
              	elseif (c <= 1.65e+103)
              		tmp = Float64(Float64(c / fma(c, c, Float64(d * d))) * b);
              	else
              		tmp = Float64(b / c);
              	end
              	return tmp
              end
              
              code[a_, b_, c_, d_] := If[LessEqual[c, -2.7e-22], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.45e-86], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 1.65e+103], N[(N[(c / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\
              \;\;\;\;\frac{b}{c}\\
              
              \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\
              \;\;\;\;\frac{-a}{d}\\
              
              \mathbf{elif}\;c \leq 1.65 \cdot 10^{+103}:\\
              \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{b}{c}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if c < -2.7000000000000002e-22 or 1.65000000000000004e103 < c

                1. Initial program 44.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-/.f6465.8

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

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

                if -2.7000000000000002e-22 < c < 1.45e-86

                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.f6471.7

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

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

                if 1.45e-86 < c < 1.65000000000000004e103

                1. Initial program 82.7%

                  \[\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{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \color{blue}{\frac{c}{{c}^{2} + {d}^{2}}} \cdot b \]
                  5. unpow2N/A

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

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

                    \[\leadsto \frac{c}{\mathsf{fma}\left(c, c, \color{blue}{d \cdot d}\right)} \cdot b \]
                  8. lower-*.f6461.9

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

                  \[\leadsto \color{blue}{\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b} \]
              3. Recombined 3 regimes into one program.
              4. Final simplification67.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{-86}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 1.65 \cdot 10^{+103}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 11: 77.1% accurate, 0.9× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{-58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 4.5 \cdot 10^{+62}:\\ \;\;\;\;\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 d) b (- a)) d)))
                 (if (<= d -2.4e-58) t_0 (if (<= d 4.5e+62) (/ (- b (/ (* a d) c)) c) t_0))))
              double code(double a, double b, double c, double d) {
              	double t_0 = fma((c / d), b, -a) / d;
              	double tmp;
              	if (d <= -2.4e-58) {
              		tmp = t_0;
              	} else if (d <= 4.5e+62) {
              		tmp = (b - ((a * d) / c)) / c;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(a, b, c, d)
              	t_0 = Float64(fma(Float64(c / d), b, Float64(-a)) / d)
              	tmp = 0.0
              	if (d <= -2.4e-58)
              		tmp = t_0;
              	elseif (d <= 4.5e+62)
              		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[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -2.4e-58], t$95$0, If[LessEqual[d, 4.5e+62], 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(\frac{c}{d}, b, -a\right)}{d}\\
              \mathbf{if}\;d \leq -2.4 \cdot 10^{-58}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;d \leq 4.5 \cdot 10^{+62}:\\
              \;\;\;\;\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.4000000000000001e-58 or 4.49999999999999999e62 < d

                1. Initial program 48.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 \frac{\color{blue}{b \cdot c - a \cdot d}}{c \cdot c + d \cdot d} \]
                  2. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
                9. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

                if -2.4000000000000001e-58 < d < 4.49999999999999999e62

                1. Initial program 79.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 + -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. lower-*.f6479.4

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

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

              Alternative 12: 63.6% accurate, 1.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 11200:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (if (<= c -2.7e-22) (/ b c) (if (<= c 11200.0) (/ (- a) d) (/ b c))))
              double code(double a, double b, double c, double d) {
              	double tmp;
              	if (c <= -2.7e-22) {
              		tmp = b / c;
              	} else if (c <= 11200.0) {
              		tmp = -a / d;
              	} else {
              		tmp = b / c;
              	}
              	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 (c <= (-2.7d-22)) then
                      tmp = b / c
                  else if (c <= 11200.0d0) then
                      tmp = -a / d
                  else
                      tmp = b / c
                  end if
                  code = tmp
              end function
              
              public static double code(double a, double b, double c, double d) {
              	double tmp;
              	if (c <= -2.7e-22) {
              		tmp = b / c;
              	} else if (c <= 11200.0) {
              		tmp = -a / d;
              	} else {
              		tmp = b / c;
              	}
              	return tmp;
              }
              
              def code(a, b, c, d):
              	tmp = 0
              	if c <= -2.7e-22:
              		tmp = b / c
              	elif c <= 11200.0:
              		tmp = -a / d
              	else:
              		tmp = b / c
              	return tmp
              
              function code(a, b, c, d)
              	tmp = 0.0
              	if (c <= -2.7e-22)
              		tmp = Float64(b / c);
              	elseif (c <= 11200.0)
              		tmp = Float64(Float64(-a) / d);
              	else
              		tmp = Float64(b / c);
              	end
              	return tmp
              end
              
              function tmp_2 = code(a, b, c, d)
              	tmp = 0.0;
              	if (c <= -2.7e-22)
              		tmp = b / c;
              	elseif (c <= 11200.0)
              		tmp = -a / d;
              	else
              		tmp = b / c;
              	end
              	tmp_2 = tmp;
              end
              
              code[a_, b_, c_, d_] := If[LessEqual[c, -2.7e-22], N[(b / c), $MachinePrecision], If[LessEqual[c, 11200.0], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\
              \;\;\;\;\frac{b}{c}\\
              
              \mathbf{elif}\;c \leq 11200:\\
              \;\;\;\;\frac{-a}{d}\\
              
              \mathbf{else}:\\
              \;\;\;\;\frac{b}{c}\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if c < -2.7000000000000002e-22 or 11200 < c

                1. Initial program 50.4%

                  \[\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-/.f6464.9

                    \[\leadsto \color{blue}{\frac{b}{c}} \]
                5. Applied rewrites64.9%

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

                if -2.7000000000000002e-22 < c < 11200

                1. Initial program 76.1%

                  \[\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.f6466.5

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

                  \[\leadsto \color{blue}{\frac{a}{-d}} \]
              3. Recombined 2 regimes into one program.
              4. Final simplification65.7%

                \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.7 \cdot 10^{-22}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 11200:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 13: 43.1% 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 63.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-/.f6439.6

                  \[\leadsto \color{blue}{\frac{b}{c}} \]
              5. Applied rewrites39.6%

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

              Developer Target 1: 99.1% 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 2024332 
              (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))))