Complex division, imag part

Percentage Accurate: 62.6% → 83.3%
Time: 7.5s
Alternatives: 9
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 9 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.6% accurate, 1.0× speedup?

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

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

Alternative 1: 83.3% accurate, 0.2× speedup?

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

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

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

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

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

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


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

    1. Initial program 38.1%

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

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

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

    if -4.70000000000000008e111 < d < -1.12e-130

    1. Initial program 70.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 rewrites77.0%

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

    if -1.12e-130 < d < 4.89999999999999981e-132

    1. Initial program 63.9%

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

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

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

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

    if 4.89999999999999981e-132 < d < 2.24999999999999995e93

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

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

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

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

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

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

    if 2.24999999999999995e93 < d

    1. Initial program 38.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} + \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-*.f6488.7

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.7 \cdot 10^{+111}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\mathsf{fma}\left(\frac{\frac{c}{d}}{d}, c, -1\right), a, \left(\frac{c}{d} - {\left(\frac{c}{d}\right)}^{3}\right) \cdot b\right)}{d}\\ \mathbf{elif}\;d \leq -1.12 \cdot 10^{-130}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\ \end{array} \]
    9. Add Preprocessing

    Alternative 2: 83.4% 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 -3.1 \cdot 10^{+111}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.12 \cdot 10^{-130}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (let* ((t_0 (fma d d (* c c))))
       (if (<= d -3.1e+111)
         (/ (fma (/ c d) b (- a)) d)
         (if (<= d -1.12e-130)
           (fma (/ c t_0) b (* (/ a t_0) (- d)))
           (if (<= d 4.9e-132)
             (/ (- b (/ (* a d) c)) c)
             (if (<= d 2.25e+93)
               (/ (fma (- d) a (* c b)) t_0)
               (fma (/ c d) (/ b d) (/ (- a) d))))))))
    double code(double a, double b, double c, double d) {
    	double t_0 = fma(d, d, (c * c));
    	double tmp;
    	if (d <= -3.1e+111) {
    		tmp = fma((c / d), b, -a) / d;
    	} else if (d <= -1.12e-130) {
    		tmp = fma((c / t_0), b, ((a / t_0) * -d));
    	} else if (d <= 4.9e-132) {
    		tmp = (b - ((a * d) / c)) / c;
    	} else if (d <= 2.25e+93) {
    		tmp = fma(-d, a, (c * b)) / t_0;
    	} else {
    		tmp = fma((c / d), (b / d), (-a / d));
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	t_0 = fma(d, d, Float64(c * c))
    	tmp = 0.0
    	if (d <= -3.1e+111)
    		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
    	elseif (d <= -1.12e-130)
    		tmp = fma(Float64(c / t_0), b, Float64(Float64(a / t_0) * Float64(-d)));
    	elseif (d <= 4.9e-132)
    		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
    	elseif (d <= 2.25e+93)
    		tmp = Float64(fma(Float64(-d), a, Float64(c * b)) / t_0);
    	else
    		tmp = fma(Float64(c / d), Float64(b / d), Float64(Float64(-a) / d));
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -3.1e+111], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -1.12e-130], N[(N[(c / t$95$0), $MachinePrecision] * b + N[(N[(a / t$95$0), $MachinePrecision] * (-d)), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 4.9e-132], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.25e+93], N[(N[((-d) * a + N[(c * b), $MachinePrecision]), $MachinePrecision] / t$95$0), $MachinePrecision], N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision] + N[((-a) / d), $MachinePrecision]), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
    \mathbf{if}\;d \leq -3.1 \cdot 10^{+111}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
    
    \mathbf{elif}\;d \leq -1.12 \cdot 10^{-130}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{c}{t\_0}, b, \frac{a}{t\_0} \cdot \left(-d\right)\right)\\
    
    \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\
    \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
    
    \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{t\_0}\\
    
    \mathbf{else}:\\
    \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if d < -3.1e111

      1. Initial program 36.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-*.f6478.2

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

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

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

        if -3.1e111 < d < -1.12e-130

        1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\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 -1.12e-130 < d < 4.89999999999999981e-132

        1. Initial program 63.9%

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

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

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

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

        if 4.89999999999999981e-132 < d < 2.24999999999999995e93

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

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

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

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

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

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

        if 2.24999999999999995e93 < d

        1. Initial program 38.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} + \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-*.f6488.7

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -3.1 \cdot 10^{+111}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.12 \cdot 10^{-130}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\ \end{array} \]
        9. Add Preprocessing

        Alternative 3: 83.0% 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 -4.7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.7 \cdot 10^{-122}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\ \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 -4.7e+153)
             (/ (fma (/ c d) b (- a)) d)
             (if (<= d -1.7e-122)
               t_0
               (if (<= d 4.9e-132)
                 (/ (- b (/ (* a d) c)) c)
                 (if (<= d 2.25e+93) t_0 (fma (/ c d) (/ b d) (/ (- 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 <= -4.7e+153) {
        		tmp = fma((c / d), b, -a) / d;
        	} else if (d <= -1.7e-122) {
        		tmp = t_0;
        	} else if (d <= 4.9e-132) {
        		tmp = (b - ((a * d) / c)) / c;
        	} else if (d <= 2.25e+93) {
        		tmp = t_0;
        	} else {
        		tmp = fma((c / d), (b / d), (-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 <= -4.7e+153)
        		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
        	elseif (d <= -1.7e-122)
        		tmp = t_0;
        	elseif (d <= 4.9e-132)
        		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
        	elseif (d <= 2.25e+93)
        		tmp = t_0;
        	else
        		tmp = fma(Float64(c / d), Float64(b / d), Float64(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, -4.7e+153], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -1.7e-122], t$95$0, If[LessEqual[d, 4.9e-132], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 2.25e+93], t$95$0, N[(N[(c / d), $MachinePrecision] * N[(b / d), $MachinePrecision] + N[((-a) / d), $MachinePrecision]), $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 -4.7 \cdot 10^{+153}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
        
        \mathbf{elif}\;d \leq -1.7 \cdot 10^{-122}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\
        \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
        
        \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if d < -4.69999999999999968e153

          1. Initial program 26.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-*.f6478.6

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

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

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

            if -4.69999999999999968e153 < d < -1.6999999999999999e-122 or 4.89999999999999981e-132 < d < 2.24999999999999995e93

            1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -1.6999999999999999e-122 < d < 4.89999999999999981e-132

            1. Initial program 62.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-*.f6490.0

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

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

            if 2.24999999999999995e93 < d

            1. Initial program 38.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} + \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-*.f6488.7

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.7 \cdot 10^{-122}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{d}, \frac{b}{d}, \frac{-a}{d}\right)\\ \end{array} \]
            9. Add Preprocessing

            Alternative 4: 82.9% accurate, 0.6× speedup?

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

              1. Initial program 34.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} + \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-*.f6485.2

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

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

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

                if -4.69999999999999968e153 < d < -1.6999999999999999e-122 or 4.89999999999999981e-132 < d < 2.24999999999999995e93

                1. Initial program 80.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                if -1.6999999999999999e-122 < d < 4.89999999999999981e-132

                1. Initial program 62.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-*.f6490.0

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

                  \[\leadsto \color{blue}{\frac{b - \frac{a \cdot d}{c}}{c}} \]
              7. Recombined 3 regimes into one program.
              8. Final simplification86.9%

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4.7 \cdot 10^{+153}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.7 \cdot 10^{-122}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 4.9 \cdot 10^{-132}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 2.25 \cdot 10^{+93}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-d, a, c \cdot b\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
              9. Add Preprocessing

              Alternative 5: 73.2% accurate, 0.8× speedup?

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

                1. Initial program 40.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.f6474.3

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

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

                if -7.4000000000000004e54 < d < 2.3e-40

                1. Initial program 70.4%

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

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

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

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

                if 2.3e-40 < d < 1.31999999999999988e111

                1. Initial program 79.3%

                  \[\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(-a\right)} \cdot \frac{d}{{c}^{2} + {d}^{2}} \]
                  6. lower-/.f64N/A

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

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

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

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

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7.4 \cdot 10^{+54}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq 2.3 \cdot 10^{-40}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 1.32 \cdot 10^{+111}:\\ \;\;\;\;\frac{d}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot \left(-a\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
              5. Add Preprocessing

              Alternative 6: 77.6% accurate, 0.9× speedup?

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

                1. Initial program 52.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-*.f6474.4

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

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

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

                  if -2e-19 < d < 2.3e-40

                  1. Initial program 70.4%

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

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

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

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

                Alternative 7: 75.7% accurate, 0.9× speedup?

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

                  1. Initial program 44.0%

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

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

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

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

                  if -4e14 < c < 2.05e77

                  1. Initial program 72.5%

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

                    \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \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-*.f6479.8

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

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

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

                Alternative 8: 62.8% accurate, 1.5× speedup?

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

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

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

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

                  if -9.60000000000000008e-27 < c < 2.05e77

                  1. Initial program 72.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.f6466.3

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

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

                Alternative 9: 42.1% accurate, 3.2× speedup?

                \[\begin{array}{l} \\ \frac{b}{c} \end{array} \]
                (FPCore (a b c d) :precision binary64 (/ b c))
                double code(double a, double b, double c, double d) {
                	return b / c;
                }
                
                real(8) function code(a, b, c, d)
                    real(8), intent (in) :: a
                    real(8), intent (in) :: b
                    real(8), intent (in) :: c
                    real(8), intent (in) :: d
                    code = b / c
                end function
                
                public static double code(double a, double b, double c, double d) {
                	return b / c;
                }
                
                def code(a, b, c, d):
                	return b / c
                
                function code(a, b, c, d)
                	return Float64(b / c)
                end
                
                function tmp = code(a, b, c, d)
                	tmp = b / c;
                end
                
                code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                \frac{b}{c}
                \end{array}
                
                Derivation
                1. Initial program 60.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-/.f6439.5

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

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