Complex division, imag part

Percentage Accurate: 61.3% → 82.4%
Time: 7.6s
Alternatives: 10
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 10 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.3% 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.4% accurate, 0.1× speedup?

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

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

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

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

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

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


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

    1. Initial program 32.5%

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

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

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

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

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

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

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

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

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

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

      if -4e153 < c < -2.35000000000000014e-139

      1. Initial program 72.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 \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 rewrites80.7%

        \[\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 -2.35000000000000014e-139 < c < 2.4499999999999999e-110

      1. Initial program 75.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 \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 rewrites62.4%

        \[\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)} \]
      5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
      9. Step-by-step derivation
        1. Applied rewrites92.3%

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

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

          if 2.4499999999999999e-110 < c < 2.20000000000000008e23

          1. Initial program 87.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. 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.9

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

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

            \[\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 2.20000000000000008e23 < c

          1. Initial program 43.6%

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{-139}:\\ \;\;\;\;\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{elif}\;c \leq 2.45 \cdot 10^{-110}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 2.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{-1}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \mathsf{fma}\left(-b, c, d \cdot a\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(\frac{a}{{c}^{4}} \cdot d - \frac{b}{{c}^{3}}, d, \frac{\frac{-a}{c}}{c}\right), d, \frac{b}{c}\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 2: 83.8% accurate, 0.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ t_1 := \mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\ t_2 := \frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{if}\;c \leq -4 \cdot 10^{+153}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{-139}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{-111}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+139}:\\ \;\;\;\;t\_1\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (fma d d (* c c)))
                (t_1 (fma (/ c t_0) b (* (/ a t_0) (- d))))
                (t_2 (/ (fma (- a) (/ d c) b) c)))
           (if (<= c -4e+153)
             t_2
             (if (<= c -2.35e-139)
               t_1
               (if (<= c 3.2e-111)
                 (/ (fma b (/ c d) (- a)) d)
                 (if (<= c 1.75e+139) t_1 t_2))))))
        double code(double a, double b, double c, double d) {
        	double t_0 = fma(d, d, (c * c));
        	double t_1 = fma((c / t_0), b, ((a / t_0) * -d));
        	double t_2 = fma(-a, (d / c), b) / c;
        	double tmp;
        	if (c <= -4e+153) {
        		tmp = t_2;
        	} else if (c <= -2.35e-139) {
        		tmp = t_1;
        	} else if (c <= 3.2e-111) {
        		tmp = fma(b, (c / d), -a) / d;
        	} else if (c <= 1.75e+139) {
        		tmp = t_1;
        	} else {
        		tmp = t_2;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	t_0 = fma(d, d, Float64(c * c))
        	t_1 = fma(Float64(c / t_0), b, Float64(Float64(a / t_0) * Float64(-d)))
        	t_2 = Float64(fma(Float64(-a), Float64(d / c), b) / c)
        	tmp = 0.0
        	if (c <= -4e+153)
        		tmp = t_2;
        	elseif (c <= -2.35e-139)
        		tmp = t_1;
        	elseif (c <= 3.2e-111)
        		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
        	elseif (c <= 1.75e+139)
        		tmp = t_1;
        	else
        		tmp = t_2;
        	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[(c / t$95$0), $MachinePrecision] * b + N[(N[(a / t$95$0), $MachinePrecision] * (-d)), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[((-a) * N[(d / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -4e+153], t$95$2, If[LessEqual[c, -2.35e-139], t$95$1, If[LessEqual[c, 3.2e-111], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.75e+139], t$95$1, t$95$2]]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
        t_1 := \mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\
        t_2 := \frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\
        \mathbf{if}\;c \leq -4 \cdot 10^{+153}:\\
        \;\;\;\;t\_2\\
        
        \mathbf{elif}\;c \leq -2.35 \cdot 10^{-139}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;c \leq 3.2 \cdot 10^{-111}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
        
        \mathbf{elif}\;c \leq 1.75 \cdot 10^{+139}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_2\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if c < -4e153 or 1.74999999999999989e139 < c

          1. Initial program 33.7%

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

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

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

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

            if -4e153 < c < -2.35000000000000014e-139 or 3.1999999999999998e-111 < c < 1.74999999999999989e139

            1. Initial program 72.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 \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 rewrites79.0%

              \[\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 -2.35000000000000014e-139 < c < 3.1999999999999998e-111

            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 \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 rewrites61.9%

              \[\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)} \]
            5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
            9. Step-by-step derivation
              1. Applied rewrites93.5%

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{-139}:\\ \;\;\;\;\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{elif}\;c \leq 3.2 \cdot 10^{-111}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+139}:\\ \;\;\;\;\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(-a, \frac{d}{c}, b\right)}{c}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 3: 80.1% accurate, 0.7× speedup?

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

                1. Initial program 42.7%

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

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

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

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

                  if -1.40000000000000008e31 < c < 2.4499999999999999e-110

                  1. Initial program 75.4%

                    \[\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 rewrites69.8%

                    \[\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)} \]
                  5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
                  9. Step-by-step derivation
                    1. Applied rewrites85.1%

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

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

                      if 2.4499999999999999e-110 < c < 2.9000000000000002e53

                      1. Initial program 87.7%

                        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
                      2. Add Preprocessing
                    3. Recombined 3 regimes into one program.
                    4. Final simplification85.1%

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

                    Alternative 4: 71.5% accurate, 0.8× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+65}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 7.8 \cdot 10^{-98}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+53}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
                    (FPCore (a b c d)
                     :precision binary64
                     (if (<= c -2.6e+65)
                       (/ b c)
                       (if (<= c 7.8e-98)
                         (/ (fma b (/ c d) (- a)) d)
                         (if (<= c 1.9e+53) (/ (- (* b c) (* d a)) (* c c)) (/ b c)))))
                    double code(double a, double b, double c, double d) {
                    	double tmp;
                    	if (c <= -2.6e+65) {
                    		tmp = b / c;
                    	} else if (c <= 7.8e-98) {
                    		tmp = fma(b, (c / d), -a) / d;
                    	} else if (c <= 1.9e+53) {
                    		tmp = ((b * c) - (d * a)) / (c * c);
                    	} else {
                    		tmp = b / c;
                    	}
                    	return tmp;
                    }
                    
                    function code(a, b, c, d)
                    	tmp = 0.0
                    	if (c <= -2.6e+65)
                    		tmp = Float64(b / c);
                    	elseif (c <= 7.8e-98)
                    		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
                    	elseif (c <= 1.9e+53)
                    		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(c * c));
                    	else
                    		tmp = Float64(b / c);
                    	end
                    	return tmp
                    end
                    
                    code[a_, b_, c_, d_] := If[LessEqual[c, -2.6e+65], N[(b / c), $MachinePrecision], If[LessEqual[c, 7.8e-98], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.9e+53], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;c \leq -2.6 \cdot 10^{+65}:\\
                    \;\;\;\;\frac{b}{c}\\
                    
                    \mathbf{elif}\;c \leq 7.8 \cdot 10^{-98}:\\
                    \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
                    
                    \mathbf{elif}\;c \leq 1.9 \cdot 10^{+53}:\\
                    \;\;\;\;\frac{b \cdot c - d \cdot a}{c \cdot c}\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;\frac{b}{c}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if c < -2.60000000000000003e65 or 1.89999999999999999e53 < c

                      1. Initial program 40.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-/.f6470.6

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

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

                      if -2.60000000000000003e65 < c < 7.79999999999999943e-98

                      1. Initial program 75.8%

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

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

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

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

                          \[\leadsto \color{blue}{\frac{b \cdot c}{c \cdot c + d \cdot d} + \left(\mathsf{neg}\left(\frac{a \cdot d}{c \cdot c + d \cdot d}\right)\right)} \]
                        5. 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 rewrites70.7%

                        \[\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)} \]
                      5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
                      9. Step-by-step derivation
                        1. Applied rewrites82.6%

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

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

                          if 7.79999999999999943e-98 < c < 1.89999999999999999e53

                          1. Initial program 86.6%

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

                            \[\leadsto \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-*.f6465.6

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

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

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

                        Alternative 5: 63.8% accurate, 0.8× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 6.6 \cdot 10^{-147}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 6.8 \cdot 10^{+131}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
                        (FPCore (a b c d)
                         :precision binary64
                         (if (<= c -1.4e+31)
                           (/ b c)
                           (if (<= c 6.6e-147)
                             (/ (- a) d)
                             (if (<= c 6.8e+131) (* (/ b (fma d d (* c c))) c) (/ b c)))))
                        double code(double a, double b, double c, double d) {
                        	double tmp;
                        	if (c <= -1.4e+31) {
                        		tmp = b / c;
                        	} else if (c <= 6.6e-147) {
                        		tmp = -a / d;
                        	} else if (c <= 6.8e+131) {
                        		tmp = (b / fma(d, d, (c * c))) * c;
                        	} else {
                        		tmp = b / c;
                        	}
                        	return tmp;
                        }
                        
                        function code(a, b, c, d)
                        	tmp = 0.0
                        	if (c <= -1.4e+31)
                        		tmp = Float64(b / c);
                        	elseif (c <= 6.6e-147)
                        		tmp = Float64(Float64(-a) / d);
                        	elseif (c <= 6.8e+131)
                        		tmp = Float64(Float64(b / fma(d, d, Float64(c * c))) * c);
                        	else
                        		tmp = Float64(b / c);
                        	end
                        	return tmp
                        end
                        
                        code[a_, b_, c_, d_] := If[LessEqual[c, -1.4e+31], N[(b / c), $MachinePrecision], If[LessEqual[c, 6.6e-147], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 6.8e+131], N[(N[(b / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\
                        \;\;\;\;\frac{b}{c}\\
                        
                        \mathbf{elif}\;c \leq 6.6 \cdot 10^{-147}:\\
                        \;\;\;\;\frac{-a}{d}\\
                        
                        \mathbf{elif}\;c \leq 6.8 \cdot 10^{+131}:\\
                        \;\;\;\;\frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{b}{c}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if c < -1.40000000000000008e31 or 6.79999999999999972e131 < c

                          1. Initial program 43.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-/.f6473.8

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

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

                          if -1.40000000000000008e31 < c < 6.59999999999999975e-147

                          1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

                          if 6.59999999999999975e-147 < c < 6.79999999999999972e131

                          1. Initial program 71.9%

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

                            \[\leadsto \color{blue}{\frac{b \cdot c}{{c}^{2} + {d}^{2}}} \]
                          4. 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}{c \cdot \frac{b}{{c}^{2} + {d}^{2}}} \]
                            3. *-commutativeN/A

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

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

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

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

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

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

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

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 6.6 \cdot 10^{-147}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 6.8 \cdot 10^{+131}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
                        5. Add Preprocessing

                        Alternative 6: 64.5% accurate, 0.8× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 2.45 \cdot 10^{-147}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+131}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
                        (FPCore (a b c d)
                         :precision binary64
                         (if (<= c -1.4e+31)
                           (/ b c)
                           (if (<= c 2.45e-147)
                             (/ (- a) d)
                             (if (<= c 9.5e+131) (* (/ c (fma d d (* c c))) b) (/ b c)))))
                        double code(double a, double b, double c, double d) {
                        	double tmp;
                        	if (c <= -1.4e+31) {
                        		tmp = b / c;
                        	} else if (c <= 2.45e-147) {
                        		tmp = -a / d;
                        	} else if (c <= 9.5e+131) {
                        		tmp = (c / fma(d, d, (c * c))) * b;
                        	} else {
                        		tmp = b / c;
                        	}
                        	return tmp;
                        }
                        
                        function code(a, b, c, d)
                        	tmp = 0.0
                        	if (c <= -1.4e+31)
                        		tmp = Float64(b / c);
                        	elseif (c <= 2.45e-147)
                        		tmp = Float64(Float64(-a) / d);
                        	elseif (c <= 9.5e+131)
                        		tmp = Float64(Float64(c / fma(d, d, Float64(c * c))) * b);
                        	else
                        		tmp = Float64(b / c);
                        	end
                        	return tmp
                        end
                        
                        code[a_, b_, c_, d_] := If[LessEqual[c, -1.4e+31], N[(b / c), $MachinePrecision], If[LessEqual[c, 2.45e-147], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 9.5e+131], N[(N[(c / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\
                        \;\;\;\;\frac{b}{c}\\
                        
                        \mathbf{elif}\;c \leq 2.45 \cdot 10^{-147}:\\
                        \;\;\;\;\frac{-a}{d}\\
                        
                        \mathbf{elif}\;c \leq 9.5 \cdot 10^{+131}:\\
                        \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot b\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;\frac{b}{c}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if c < -1.40000000000000008e31 or 9.50000000000000015e131 < c

                          1. Initial program 43.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-/.f6473.8

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

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

                          if -1.40000000000000008e31 < c < 2.45000000000000002e-147

                          1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

                          if 2.45000000000000002e-147 < c < 9.50000000000000015e131

                          1. Initial program 71.9%

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

                              \[\leadsto \color{blue}{\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}} \]
                            2. 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 rewrites75.9%

                            \[\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)} \]
                          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. +-commutativeN/A

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

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

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

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

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

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

                          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 2.45 \cdot 10^{-147}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+131}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot b\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
                        5. Add Preprocessing

                        Alternative 7: 76.3% accurate, 0.9× speedup?

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

                          1. Initial program 52.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-*.f6471.0

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

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

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

                            if -1.40000000000000008e31 < c < 7.79999999999999943e-98

                            1. Initial program 75.9%

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

                                \[\leadsto \color{blue}{\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}} \]
                              2. 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 rewrites69.8%

                              \[\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)} \]
                            5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
                            9. Step-by-step derivation
                              1. Applied rewrites84.7%

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

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

                              Alternative 8: 74.3% accurate, 0.9× speedup?

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

                                1. Initial program 52.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-*.f6471.0

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

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

                                if -1.40000000000000008e31 < c < 7.79999999999999943e-98

                                1. Initial program 75.9%

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

                                    \[\leadsto \color{blue}{\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}} \]
                                  2. 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 rewrites69.8%

                                  \[\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)} \]
                                5. Taylor expanded in d around -inf

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto -1 \cdot \frac{a}{d} + \color{blue}{\frac{b \cdot c}{{d}^{2}}} \]
                                9. Step-by-step derivation
                                  1. Applied rewrites84.7%

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

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

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

                                  Alternative 9: 62.4% accurate, 1.5× speedup?

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

                                    1. Initial program 52.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-/.f6463.0

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

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

                                    if -1.40000000000000008e31 < c < 4.8e-97

                                    1. Initial program 75.9%

                                      \[\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.f6468.2

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

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

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.4 \cdot 10^{+31}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 4.8 \cdot 10^{-97}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
                                  5. Add Preprocessing

                                  Alternative 10: 41.9% 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 64.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-/.f6441.8

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

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

                                  Developer Target 1: 99.4% accurate, 0.6× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\ \end{array} \end{array} \]
                                  (FPCore (a b c d)
                                   :precision binary64
                                   (if (< (fabs d) (fabs c))
                                     (/ (- b (* a (/ d c))) (+ c (* d (/ d c))))
                                     (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
                                  double code(double a, double b, double c, double d) {
                                  	double tmp;
                                  	if (fabs(d) < fabs(c)) {
                                  		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
                                  	} else {
                                  		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  real(8) function code(a, b, c, d)
                                      real(8), intent (in) :: a
                                      real(8), intent (in) :: b
                                      real(8), intent (in) :: c
                                      real(8), intent (in) :: d
                                      real(8) :: tmp
                                      if (abs(d) < abs(c)) then
                                          tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
                                      else
                                          tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double a, double b, double c, double d) {
                                  	double tmp;
                                  	if (Math.abs(d) < Math.abs(c)) {
                                  		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
                                  	} else {
                                  		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(a, b, c, d):
                                  	tmp = 0
                                  	if math.fabs(d) < math.fabs(c):
                                  		tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
                                  	else:
                                  		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
                                  	return tmp
                                  
                                  function code(a, b, c, d)
                                  	tmp = 0.0
                                  	if (abs(d) < abs(c))
                                  		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
                                  	else
                                  		tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d))));
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(a, b, c, d)
                                  	tmp = 0.0;
                                  	if (abs(d) < abs(c))
                                  		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
                                  	else
                                  		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;\left|d\right| < \left|c\right|:\\
                                  \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  

                                  Reproduce

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