Complex division, imag part

Percentage Accurate: 62.2% → 85.5%
Time: 10.2s
Alternatives: 13
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 13 alternatives:

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

Initial Program: 62.2% accurate, 1.0× speedup?

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

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

Alternative 1: 85.5% accurate, 0.4× speedup?

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

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

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

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

\mathbf{elif}\;d \leq 3.3 \cdot 10^{+129}:\\
\;\;\;\;t\_1\\

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


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

    1. Initial program 30.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.04999999999999999e96 < d < -3.0000000000000002e-126 or 1.6500000000000001e-137 < d < 3.2999999999999999e129

      1. Initial program 75.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \frac{a}{c \cdot c + d \cdot d}}\right) \]
      4. Applied rewrites80.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. Step-by-step derivation
        1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -3.0000000000000002e-126 < d < 1.6500000000000001e-137

      1. Initial program 73.8%

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

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

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

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

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

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

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

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

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

      if 3.2999999999999999e129 < d

      1. Initial program 23.8%

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

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

          \[\leadsto \color{blue}{\frac{b}{c}} \]
      5. Applied rewrites13.3%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.05 \cdot 10^{+96}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \mathbf{elif}\;d \leq -3 \cdot 10^{-126}:\\ \;\;\;\;\mathsf{fma}\left(\frac{d}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{-1}{\frac{1}{a}}, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot b\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{-137}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 3.3 \cdot 10^{+129}:\\ \;\;\;\;\mathsf{fma}\left(\frac{d}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \frac{-1}{\frac{1}{a}}, \frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot b\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 83.5% accurate, 0.5× speedup?

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

      1. Initial program 33.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} + \frac{b \cdot c}{{d}^{2}}} \]
      4. Step-by-step derivation
        1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.24999999999999993e57 < d < -1.28e-79

        1. Initial program 84.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.28e-79 < d < 3.60000000000000012e-147

        1. Initial program 70.6%

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

          \[\leadsto \color{blue}{\frac{b + -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-*.f6488.6

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

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

        if 3.60000000000000012e-147 < d < 3.3000000000000001e128

        1. Initial program 78.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) \]
          17. distribute-lft-neg-inN/A

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

            \[\leadsto \mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot \frac{a}{c \cdot c + d \cdot d}}\right) \]
        4. Applied rewrites85.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)} \]

        if 3.3000000000000001e128 < d

        1. Initial program 23.8%

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

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

            \[\leadsto \color{blue}{\frac{b}{c}} \]
        5. Applied rewrites13.3%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.25 \cdot 10^{+57}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.28 \cdot 10^{-79}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 3.6 \cdot 10^{-147}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 3.3 \cdot 10^{+128}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 64.7% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\ t_1 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -0.0175:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{d}{t\_0} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{t\_0} \cdot c\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (fma c c (* d d))) (t_1 (/ (- a) d)))
         (if (<= d -2.4e+142)
           t_1
           (if (<= d -0.0175)
             (/ (- (* c b) (* a d)) (* d d))
             (if (<= d 5.8e-274)
               (/ b c)
               (if (<= d 4.7e-76)
                 (/ (fma (- d) a (* c b)) (* c c))
                 (if (<= d 1.2e+33)
                   (* (/ d t_0) (- a))
                   (if (<= d 1.65e+99) (* (/ b t_0) c) t_1))))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma(c, c, (d * d));
      	double t_1 = -a / d;
      	double tmp;
      	if (d <= -2.4e+142) {
      		tmp = t_1;
      	} else if (d <= -0.0175) {
      		tmp = ((c * b) - (a * d)) / (d * d);
      	} else if (d <= 5.8e-274) {
      		tmp = b / c;
      	} else if (d <= 4.7e-76) {
      		tmp = fma(-d, a, (c * b)) / (c * c);
      	} else if (d <= 1.2e+33) {
      		tmp = (d / t_0) * -a;
      	} else if (d <= 1.65e+99) {
      		tmp = (b / t_0) * c;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = fma(c, c, Float64(d * d))
      	t_1 = Float64(Float64(-a) / d)
      	tmp = 0.0
      	if (d <= -2.4e+142)
      		tmp = t_1;
      	elseif (d <= -0.0175)
      		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(d * d));
      	elseif (d <= 5.8e-274)
      		tmp = Float64(b / c);
      	elseif (d <= 4.7e-76)
      		tmp = Float64(fma(Float64(-d), a, Float64(c * b)) / Float64(c * c));
      	elseif (d <= 1.2e+33)
      		tmp = Float64(Float64(d / t_0) * Float64(-a));
      	elseif (d <= 1.65e+99)
      		tmp = Float64(Float64(b / t_0) * c);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -2.4e+142], t$95$1, If[LessEqual[d, -0.0175], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e-274], N[(b / c), $MachinePrecision], If[LessEqual[d, 4.7e-76], N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e+33], N[(N[(d / t$95$0), $MachinePrecision] * (-a)), $MachinePrecision], If[LessEqual[d, 1.65e+99], N[(N[(b / t$95$0), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\
      t_1 := \frac{-a}{d}\\
      \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;d \leq -0.0175:\\
      \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\
      
      \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\
      \;\;\;\;\frac{b}{c}\\
      
      \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{c \cdot c}\\
      
      \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\
      \;\;\;\;\frac{d}{t\_0} \cdot \left(-a\right)\\
      
      \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\
      \;\;\;\;\frac{b}{t\_0} \cdot c\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 6 regimes
      2. if d < -2.3999999999999999e142 or 1.65e99 < d

        1. Initial program 23.2%

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

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

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

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

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

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

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

        if -2.3999999999999999e142 < d < -0.017500000000000002

        1. Initial program 81.0%

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

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

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

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

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

        if -0.017500000000000002 < d < 5.79999999999999952e-274

        1. Initial program 71.2%

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

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

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

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

        if 5.79999999999999952e-274 < d < 4.7000000000000002e-76

        1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 4.7000000000000002e-76 < d < 1.2e33

        1. Initial program 73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.2e33 < d < 1.65e99

        1. Initial program 74.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -0.0175:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 4: 64.7% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\ t_1 := \frac{-a}{d}\\ t_2 := c \cdot b - a \cdot d\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -0.0175:\\ \;\;\;\;\frac{t\_2}{d \cdot d}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{t\_2}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{d}{t\_0} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{t\_0} \cdot c\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (fma c c (* d d))) (t_1 (/ (- a) d)) (t_2 (- (* c b) (* a d))))
         (if (<= d -2.4e+142)
           t_1
           (if (<= d -0.0175)
             (/ t_2 (* d d))
             (if (<= d 5.8e-274)
               (/ b c)
               (if (<= d 4.7e-76)
                 (/ t_2 (* c c))
                 (if (<= d 1.2e+33)
                   (* (/ d t_0) (- a))
                   (if (<= d 1.65e+99) (* (/ b t_0) c) t_1))))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma(c, c, (d * d));
      	double t_1 = -a / d;
      	double t_2 = (c * b) - (a * d);
      	double tmp;
      	if (d <= -2.4e+142) {
      		tmp = t_1;
      	} else if (d <= -0.0175) {
      		tmp = t_2 / (d * d);
      	} else if (d <= 5.8e-274) {
      		tmp = b / c;
      	} else if (d <= 4.7e-76) {
      		tmp = t_2 / (c * c);
      	} else if (d <= 1.2e+33) {
      		tmp = (d / t_0) * -a;
      	} else if (d <= 1.65e+99) {
      		tmp = (b / t_0) * c;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = fma(c, c, Float64(d * d))
      	t_1 = Float64(Float64(-a) / d)
      	t_2 = Float64(Float64(c * b) - Float64(a * d))
      	tmp = 0.0
      	if (d <= -2.4e+142)
      		tmp = t_1;
      	elseif (d <= -0.0175)
      		tmp = Float64(t_2 / Float64(d * d));
      	elseif (d <= 5.8e-274)
      		tmp = Float64(b / c);
      	elseif (d <= 4.7e-76)
      		tmp = Float64(t_2 / Float64(c * c));
      	elseif (d <= 1.2e+33)
      		tmp = Float64(Float64(d / t_0) * Float64(-a));
      	elseif (d <= 1.65e+99)
      		tmp = Float64(Float64(b / t_0) * c);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -2.4e+142], t$95$1, If[LessEqual[d, -0.0175], N[(t$95$2 / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 5.8e-274], N[(b / c), $MachinePrecision], If[LessEqual[d, 4.7e-76], N[(t$95$2 / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e+33], N[(N[(d / t$95$0), $MachinePrecision] * (-a)), $MachinePrecision], If[LessEqual[d, 1.65e+99], N[(N[(b / t$95$0), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\
      t_1 := \frac{-a}{d}\\
      t_2 := c \cdot b - a \cdot d\\
      \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;d \leq -0.0175:\\
      \;\;\;\;\frac{t\_2}{d \cdot d}\\
      
      \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\
      \;\;\;\;\frac{b}{c}\\
      
      \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\
      \;\;\;\;\frac{t\_2}{c \cdot c}\\
      
      \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\
      \;\;\;\;\frac{d}{t\_0} \cdot \left(-a\right)\\
      
      \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\
      \;\;\;\;\frac{b}{t\_0} \cdot c\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 6 regimes
      2. if d < -2.3999999999999999e142 or 1.65e99 < d

        1. Initial program 23.2%

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

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

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

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

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

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

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

        if -2.3999999999999999e142 < d < -0.017500000000000002

        1. Initial program 81.0%

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

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

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

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

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

        if -0.017500000000000002 < d < 5.79999999999999952e-274

        1. Initial program 71.2%

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

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

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

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

        if 5.79999999999999952e-274 < d < 4.7000000000000002e-76

        1. Initial program 80.9%

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

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

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

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

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

        if 4.7000000000000002e-76 < d < 1.2e33

        1. Initial program 73.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 1.2e33 < d < 1.65e99

        1. Initial program 74.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -0.0175:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 5: 65.2% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\ t_1 := \frac{-a}{d}\\ t_2 := \frac{d}{t\_0} \cdot \left(-a\right)\\ \mathbf{if}\;d \leq -3.4 \cdot 10^{+115}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -4.8 \cdot 10^{-18}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{t\_0} \cdot c\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (fma c c (* d d))) (t_1 (/ (- a) d)) (t_2 (* (/ d t_0) (- a))))
         (if (<= d -3.4e+115)
           t_1
           (if (<= d -4.8e-18)
             t_2
             (if (<= d 5.8e-274)
               (/ b c)
               (if (<= d 4.7e-76)
                 (/ (- (* c b) (* a d)) (* c c))
                 (if (<= d 1.2e+33)
                   t_2
                   (if (<= d 1.65e+99) (* (/ b t_0) c) t_1))))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma(c, c, (d * d));
      	double t_1 = -a / d;
      	double t_2 = (d / t_0) * -a;
      	double tmp;
      	if (d <= -3.4e+115) {
      		tmp = t_1;
      	} else if (d <= -4.8e-18) {
      		tmp = t_2;
      	} else if (d <= 5.8e-274) {
      		tmp = b / c;
      	} else if (d <= 4.7e-76) {
      		tmp = ((c * b) - (a * d)) / (c * c);
      	} else if (d <= 1.2e+33) {
      		tmp = t_2;
      	} else if (d <= 1.65e+99) {
      		tmp = (b / t_0) * c;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = fma(c, c, Float64(d * d))
      	t_1 = Float64(Float64(-a) / d)
      	t_2 = Float64(Float64(d / t_0) * Float64(-a))
      	tmp = 0.0
      	if (d <= -3.4e+115)
      		tmp = t_1;
      	elseif (d <= -4.8e-18)
      		tmp = t_2;
      	elseif (d <= 5.8e-274)
      		tmp = Float64(b / c);
      	elseif (d <= 4.7e-76)
      		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(c * c));
      	elseif (d <= 1.2e+33)
      		tmp = t_2;
      	elseif (d <= 1.65e+99)
      		tmp = Float64(Float64(b / t_0) * c);
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$2 = N[(N[(d / t$95$0), $MachinePrecision] * (-a)), $MachinePrecision]}, If[LessEqual[d, -3.4e+115], t$95$1, If[LessEqual[d, -4.8e-18], t$95$2, If[LessEqual[d, 5.8e-274], N[(b / c), $MachinePrecision], If[LessEqual[d, 4.7e-76], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.2e+33], t$95$2, If[LessEqual[d, 1.65e+99], N[(N[(b / t$95$0), $MachinePrecision] * c), $MachinePrecision], t$95$1]]]]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\
      t_1 := \frac{-a}{d}\\
      t_2 := \frac{d}{t\_0} \cdot \left(-a\right)\\
      \mathbf{if}\;d \leq -3.4 \cdot 10^{+115}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;d \leq -4.8 \cdot 10^{-18}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\
      \;\;\;\;\frac{b}{c}\\
      
      \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\
      \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\
      
      \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\
      \;\;\;\;t\_2\\
      
      \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\
      \;\;\;\;\frac{b}{t\_0} \cdot c\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 5 regimes
      2. if d < -3.4000000000000001e115 or 1.65e99 < d

        1. Initial program 25.1%

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

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

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

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

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

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

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

        if -3.4000000000000001e115 < d < -4.79999999999999988e-18 or 4.7000000000000002e-76 < d < 1.2e33

        1. Initial program 78.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.79999999999999988e-18 < d < 5.79999999999999952e-274

        1. Initial program 69.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}{c}} \]
        4. Step-by-step derivation
          1. lower-/.f6475.4

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

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

        if 5.79999999999999952e-274 < d < 4.7000000000000002e-76

        1. Initial program 80.9%

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

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

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

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

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

        if 1.2e33 < d < 1.65e99

        1. Initial program 74.0%

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.4 \cdot 10^{+115}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -4.8 \cdot 10^{-18}:\\ \;\;\;\;\frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-274}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 4.7 \cdot 10^{-76}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c}\\ \mathbf{elif}\;d \leq 1.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot \left(-a\right)\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 6: 83.2% accurate, 0.6× speedup?

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

        1. Initial program 33.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} + \frac{b \cdot c}{{d}^{2}}} \]
        4. Step-by-step derivation
          1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.24999999999999993e57 < d < -1.28e-79 or 3.99999999999999999e-73 < d < 1.12e123

          1. Initial program 79.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.28e-79 < d < 3.99999999999999999e-73

          1. Initial program 72.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-*.f6487.8

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

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

          if 1.12e123 < d

          1. Initial program 23.8%

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

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
          5. Applied rewrites13.3%

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.25 \cdot 10^{+57}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, \frac{b}{d}, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.28 \cdot 10^{-79}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 4 \cdot 10^{-73}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 1.12 \cdot 10^{+123}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 7: 73.0% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -3.9:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- a) d)))
           (if (<= d -2.4e+142)
             t_0
             (if (<= d -3.9)
               (/ (- (* c b) (* a d)) (* d d))
               (if (<= d 1.65e+99) (/ (- b (/ (* a d) c)) c) t_0)))))
        double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (d <= -2.4e+142) {
        		tmp = t_0;
        	} else if (d <= -3.9) {
        		tmp = ((c * b) - (a * d)) / (d * d);
        	} else if (d <= 1.65e+99) {
        		tmp = (b - ((a * d) / c)) / c;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(a, b, c, d)
            real(8), intent (in) :: a
            real(8), intent (in) :: b
            real(8), intent (in) :: c
            real(8), intent (in) :: d
            real(8) :: t_0
            real(8) :: tmp
            t_0 = -a / d
            if (d <= (-2.4d+142)) then
                tmp = t_0
            else if (d <= (-3.9d0)) then
                tmp = ((c * b) - (a * d)) / (d * d)
            else if (d <= 1.65d+99) then
                tmp = (b - ((a * d) / c)) / c
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (d <= -2.4e+142) {
        		tmp = t_0;
        	} else if (d <= -3.9) {
        		tmp = ((c * b) - (a * d)) / (d * d);
        	} else if (d <= 1.65e+99) {
        		tmp = (b - ((a * d) / c)) / c;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	t_0 = -a / d
        	tmp = 0
        	if d <= -2.4e+142:
        		tmp = t_0
        	elif d <= -3.9:
        		tmp = ((c * b) - (a * d)) / (d * d)
        	elif d <= 1.65e+99:
        		tmp = (b - ((a * d) / c)) / c
        	else:
        		tmp = t_0
        	return tmp
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(-a) / d)
        	tmp = 0.0
        	if (d <= -2.4e+142)
        		tmp = t_0;
        	elseif (d <= -3.9)
        		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(d * d));
        	elseif (d <= 1.65e+99)
        		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	t_0 = -a / d;
        	tmp = 0.0;
        	if (d <= -2.4e+142)
        		tmp = t_0;
        	elseif (d <= -3.9)
        		tmp = ((c * b) - (a * d)) / (d * d);
        	elseif (d <= 1.65e+99)
        		tmp = (b - ((a * d) / c)) / c;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -2.4e+142], t$95$0, If[LessEqual[d, -3.9], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 1.65e+99], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{-a}{d}\\
        \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;d \leq -3.9:\\
        \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\
        
        \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\
        \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if d < -2.3999999999999999e142 or 1.65e99 < d

          1. Initial program 23.2%

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

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

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

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

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

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

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

          if -2.3999999999999999e142 < d < -3.89999999999999991

          1. Initial program 81.0%

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

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

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

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

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

          if -3.89999999999999991 < d < 1.65e99

          1. Initial program 74.6%

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

            \[\leadsto \color{blue}{\frac{b + -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.0

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -2.4 \cdot 10^{+142}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -3.9:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 8: 63.9% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.8 \cdot 10^{+30}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.92 \cdot 10^{-140}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+92}:\\ \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (if (<= c -1.8e+30)
           (/ b c)
           (if (<= c 1.92e-140)
             (/ (- a) d)
             (if (<= c 2.6e+92) (/ (* c b) (fma d d (* c c))) (/ b c)))))
        double code(double a, double b, double c, double d) {
        	double tmp;
        	if (c <= -1.8e+30) {
        		tmp = b / c;
        	} else if (c <= 1.92e-140) {
        		tmp = -a / d;
        	} else if (c <= 2.6e+92) {
        		tmp = (c * b) / fma(d, d, (c * c));
        	} else {
        		tmp = b / c;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	tmp = 0.0
        	if (c <= -1.8e+30)
        		tmp = Float64(b / c);
        	elseif (c <= 1.92e-140)
        		tmp = Float64(Float64(-a) / d);
        	elseif (c <= 2.6e+92)
        		tmp = Float64(Float64(c * b) / fma(d, d, Float64(c * c)));
        	else
        		tmp = Float64(b / c);
        	end
        	return tmp
        end
        
        code[a_, b_, c_, d_] := If[LessEqual[c, -1.8e+30], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.92e-140], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 2.6e+92], N[(N[(c * b), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b / c), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;c \leq -1.8 \cdot 10^{+30}:\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{elif}\;c \leq 1.92 \cdot 10^{-140}:\\
        \;\;\;\;\frac{-a}{d}\\
        
        \mathbf{elif}\;c \leq 2.6 \cdot 10^{+92}:\\
        \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{b}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if c < -1.8000000000000001e30 or 2.5999999999999999e92 < c

          1. Initial program 44.8%

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

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

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

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

          if -1.8000000000000001e30 < c < 1.9200000000000001e-140

          1. Initial program 64.3%

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

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

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

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

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

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

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

          if 1.9200000000000001e-140 < c < 2.5999999999999999e92

          1. Initial program 82.1%

            \[\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{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} \]
          4. Step-by-step derivation
            1. lower-*.f6465.5

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

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

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

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

              \[\leadsto \frac{b \cdot c}{\color{blue}{d \cdot d} + c \cdot c} \]
            4. lift-fma.f6465.5

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.8 \cdot 10^{+30}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.92 \cdot 10^{-140}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+92}:\\ \;\;\;\;\frac{c \cdot b}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 9: 76.5% accurate, 0.9× speedup?

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

          1. Initial program 43.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -3.89999999999999991 < d < 7.5000000000000006e120

            1. Initial program 74.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.2

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

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

            if 7.5000000000000006e120 < d

            1. Initial program 23.8%

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

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

                \[\leadsto \color{blue}{\frac{b}{c}} \]
            5. Applied rewrites13.3%

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

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

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

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

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

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

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

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

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

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

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

          Alternative 10: 77.2% accurate, 0.9× speedup?

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

            1. Initial program 37.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} + \frac{b \cdot c}{{d}^{2}}} \]
            4. Step-by-step derivation
              1. +-commutativeN/A

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

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

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

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

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

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

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

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

                \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d}} - a}{d} \]
              10. lower-*.f6480.5

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

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

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

              if -3.89999999999999991 < d < 7.19999999999999962e98

              1. Initial program 74.6%

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

                \[\leadsto \color{blue}{\frac{b + -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.0

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

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

            Alternative 11: 74.6% accurate, 0.9× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{if}\;d \leq -3.9:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+120}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (a b c d)
             :precision binary64
             (let* ((t_0 (/ (- (/ (* c b) d) a) d)))
               (if (<= d -3.9) t_0 (if (<= d 7.5e+120) (/ (- b (/ (* a d) c)) c) t_0))))
            double code(double a, double b, double c, double d) {
            	double t_0 = (((c * b) / d) - a) / d;
            	double tmp;
            	if (d <= -3.9) {
            		tmp = t_0;
            	} else if (d <= 7.5e+120) {
            		tmp = (b - ((a * d) / c)) / c;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            real(8) function code(a, b, c, d)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: c
                real(8), intent (in) :: d
                real(8) :: t_0
                real(8) :: tmp
                t_0 = (((c * b) / d) - a) / d
                if (d <= (-3.9d0)) then
                    tmp = t_0
                else if (d <= 7.5d+120) then
                    tmp = (b - ((a * d) / c)) / c
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double a, double b, double c, double d) {
            	double t_0 = (((c * b) / d) - a) / d;
            	double tmp;
            	if (d <= -3.9) {
            		tmp = t_0;
            	} else if (d <= 7.5e+120) {
            		tmp = (b - ((a * d) / c)) / c;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(a, b, c, d):
            	t_0 = (((c * b) / d) - a) / d
            	tmp = 0
            	if d <= -3.9:
            		tmp = t_0
            	elif d <= 7.5e+120:
            		tmp = (b - ((a * d) / c)) / c
            	else:
            		tmp = t_0
            	return tmp
            
            function code(a, b, c, d)
            	t_0 = Float64(Float64(Float64(Float64(c * b) / d) - a) / d)
            	tmp = 0.0
            	if (d <= -3.9)
            		tmp = t_0;
            	elseif (d <= 7.5e+120)
            		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(a, b, c, d)
            	t_0 = (((c * b) / d) - a) / d;
            	tmp = 0.0;
            	if (d <= -3.9)
            		tmp = t_0;
            	elseif (d <= 7.5e+120)
            		tmp = (b - ((a * d) / c)) / c;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -3.9], t$95$0, If[LessEqual[d, 7.5e+120], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\
            \mathbf{if}\;d \leq -3.9:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;d \leq 7.5 \cdot 10^{+120}:\\
            \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if d < -3.89999999999999991 or 7.5000000000000006e120 < d

              1. Initial program 37.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

              if -3.89999999999999991 < d < 7.5000000000000006e120

              1. Initial program 74.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.2

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

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

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

            Alternative 12: 62.8% accurate, 1.5× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -3.1 \cdot 10^{+21}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (a b c d)
             :precision binary64
             (let* ((t_0 (/ (- a) d)))
               (if (<= d -3.1e+21) t_0 (if (<= d 1.65e+99) (/ b c) t_0))))
            double code(double a, double b, double c, double d) {
            	double t_0 = -a / d;
            	double tmp;
            	if (d <= -3.1e+21) {
            		tmp = t_0;
            	} else if (d <= 1.65e+99) {
            		tmp = b / c;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            real(8) function code(a, b, c, d)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: c
                real(8), intent (in) :: d
                real(8) :: t_0
                real(8) :: tmp
                t_0 = -a / d
                if (d <= (-3.1d+21)) then
                    tmp = t_0
                else if (d <= 1.65d+99) then
                    tmp = b / c
                else
                    tmp = t_0
                end if
                code = tmp
            end function
            
            public static double code(double a, double b, double c, double d) {
            	double t_0 = -a / d;
            	double tmp;
            	if (d <= -3.1e+21) {
            		tmp = t_0;
            	} else if (d <= 1.65e+99) {
            		tmp = b / c;
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            def code(a, b, c, d):
            	t_0 = -a / d
            	tmp = 0
            	if d <= -3.1e+21:
            		tmp = t_0
            	elif d <= 1.65e+99:
            		tmp = b / c
            	else:
            		tmp = t_0
            	return tmp
            
            function code(a, b, c, d)
            	t_0 = Float64(Float64(-a) / d)
            	tmp = 0.0
            	if (d <= -3.1e+21)
            		tmp = t_0;
            	elseif (d <= 1.65e+99)
            		tmp = Float64(b / c);
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            function tmp_2 = code(a, b, c, d)
            	t_0 = -a / d;
            	tmp = 0.0;
            	if (d <= -3.1e+21)
            		tmp = t_0;
            	elseif (d <= 1.65e+99)
            		tmp = b / c;
            	else
            		tmp = t_0;
            	end
            	tmp_2 = tmp;
            end
            
            code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -3.1e+21], t$95$0, If[LessEqual[d, 1.65e+99], N[(b / c), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := \frac{-a}{d}\\
            \mathbf{if}\;d \leq -3.1 \cdot 10^{+21}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;d \leq 1.65 \cdot 10^{+99}:\\
            \;\;\;\;\frac{b}{c}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if d < -3.1e21 or 1.65e99 < d

              1. Initial program 35.7%

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

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

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

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

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

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

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

              if -3.1e21 < d < 1.65e99

              1. Initial program 74.8%

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

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

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

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

            Alternative 13: 42.5% 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 60.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-/.f6445.0

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

              \[\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 2024240 
            (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))))