Complex division, imag part

Percentage Accurate: 62.2% → 84.3%
Time: 8.0s
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.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: 84.3% accurate, 0.5× speedup?

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

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

\mathbf{elif}\;c \leq -2.8 \cdot 10^{-21}:\\
\;\;\;\;t\_1\\

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

\mathbf{elif}\;c \leq 1.9 \cdot 10^{+137}:\\
\;\;\;\;t\_1\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-1}{c}, t\_2, \frac{b}{c}\right)\\


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

    1. Initial program 28.5%

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

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

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

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

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

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

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

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

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

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

      if -2.5999999999999999e153 < c < -2.80000000000000004e-21 or 9.5999999999999996e-45 < c < 1.89999999999999981e137

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.80000000000000004e-21 < c < 9.5999999999999996e-45

      1. Initial program 62.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-*.f6486.5

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

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

      if 1.89999999999999981e137 < c

      1. Initial program 25.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-*.f6485.6

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+153}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{elif}\;c \leq -2.8 \cdot 10^{-21}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{elif}\;c \leq 9.6 \cdot 10^{-45}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+137}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{c}, \frac{a}{c} \cdot d, \frac{b}{c}\right)\\ \end{array} \]
        5. Add Preprocessing

        Alternative 2: 80.6% accurate, 0.6× speedup?

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

          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 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-*.f6485.9

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

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

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

            if -5.6000000000000001e114 < c < -1.15000000000000005e-23

            1. Initial program 75.3%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing

            if -1.15000000000000005e-23 < c < 14.5

            1. Initial program 62.6%

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

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

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

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

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

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

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

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

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

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

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

            if 14.5 < c

            1. Initial program 50.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 \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}} \]
            6. Step-by-step derivation
              1. Applied rewrites80.6%

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

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -5.6 \cdot 10^{+114}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{elif}\;c \leq -1.15 \cdot 10^{-23}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 14.5:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-1}{c}, \frac{a}{c} \cdot d, \frac{b}{c}\right)\\ \end{array} \]
              5. Add Preprocessing

              Alternative 3: 80.6% accurate, 0.8× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{if}\;c \leq -5.6 \cdot 10^{+114}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq -1.15 \cdot 10^{-23}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 14.5:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (a b c d)
               :precision binary64
               (let* ((t_0 (/ (- b (* (/ a c) d)) c)))
                 (if (<= c -5.6e+114)
                   t_0
                   (if (<= c -1.15e-23)
                     (/ (- (* b c) (* d a)) (+ (* d d) (* c c)))
                     (if (<= c 14.5) (/ (- (/ (* b c) d) a) d) t_0)))))
              double code(double a, double b, double c, double d) {
              	double t_0 = (b - ((a / c) * d)) / c;
              	double tmp;
              	if (c <= -5.6e+114) {
              		tmp = t_0;
              	} else if (c <= -1.15e-23) {
              		tmp = ((b * c) - (d * a)) / ((d * d) + (c * c));
              	} else if (c <= 14.5) {
              		tmp = (((b * c) / 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 / c) * d)) / c
                  if (c <= (-5.6d+114)) then
                      tmp = t_0
                  else if (c <= (-1.15d-23)) then
                      tmp = ((b * c) - (d * a)) / ((d * d) + (c * c))
                  else if (c <= 14.5d0) then
                      tmp = (((b * c) / 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 / c) * d)) / c;
              	double tmp;
              	if (c <= -5.6e+114) {
              		tmp = t_0;
              	} else if (c <= -1.15e-23) {
              		tmp = ((b * c) - (d * a)) / ((d * d) + (c * c));
              	} else if (c <= 14.5) {
              		tmp = (((b * c) / d) - a) / d;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              def code(a, b, c, d):
              	t_0 = (b - ((a / c) * d)) / c
              	tmp = 0
              	if c <= -5.6e+114:
              		tmp = t_0
              	elif c <= -1.15e-23:
              		tmp = ((b * c) - (d * a)) / ((d * d) + (c * c))
              	elif c <= 14.5:
              		tmp = (((b * c) / d) - a) / d
              	else:
              		tmp = t_0
              	return tmp
              
              function code(a, b, c, d)
              	t_0 = Float64(Float64(b - Float64(Float64(a / c) * d)) / c)
              	tmp = 0.0
              	if (c <= -5.6e+114)
              		tmp = t_0;
              	elseif (c <= -1.15e-23)
              		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(Float64(d * d) + Float64(c * c)));
              	elseif (c <= 14.5)
              		tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              function tmp_2 = code(a, b, c, d)
              	t_0 = (b - ((a / c) * d)) / c;
              	tmp = 0.0;
              	if (c <= -5.6e+114)
              		tmp = t_0;
              	elseif (c <= -1.15e-23)
              		tmp = ((b * c) - (d * a)) / ((d * d) + (c * c));
              	elseif (c <= 14.5)
              		tmp = (((b * c) / 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 / c), $MachinePrecision] * d), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -5.6e+114], t$95$0, If[LessEqual[c, -1.15e-23], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 14.5], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \frac{b - \frac{a}{c} \cdot d}{c}\\
              \mathbf{if}\;c \leq -5.6 \cdot 10^{+114}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;c \leq -1.15 \cdot 10^{-23}:\\
              \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d + c \cdot c}\\
              
              \mathbf{elif}\;c \leq 14.5:\\
              \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if c < -5.6000000000000001e114 or 14.5 < c

                1. Initial program 43.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 \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-*.f6481.6

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

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

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

                  if -5.6000000000000001e114 < c < -1.15000000000000005e-23

                  1. Initial program 75.3%

                    \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
                  2. Add Preprocessing

                  if -1.15000000000000005e-23 < c < 14.5

                  1. Initial program 62.6%

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -5.6 \cdot 10^{+114}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{elif}\;c \leq -1.15 \cdot 10^{-23}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 14.5:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \end{array} \]
                9. Add Preprocessing

                Alternative 4: 65.8% accurate, 0.8× speedup?

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

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

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

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

                  if -2.9999999999999998e-14 < c < 1.70000000000000008e-44

                  1. Initial program 63.4%

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

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

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

                  if 1.70000000000000008e-44 < c < 1.89999999999999981e137

                  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. frac-subN/A

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

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

                      \[\leadsto \color{blue}{\frac{\frac{\left(b \cdot c\right) \cdot \left(c \cdot c + d \cdot d\right) - \left(c \cdot c + d \cdot d\right) \cdot \left(a \cdot d\right)}{c \cdot c + d \cdot d}}{c \cdot c + d \cdot d}} \]
                  4. Applied rewrites46.9%

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

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

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

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

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

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

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

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

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

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

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

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

                Alternative 5: 65.5% accurate, 0.8× speedup?

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

                  1. Initial program 41.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.4

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

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

                  if -2.9999999999999998e-14 < c < 1.70000000000000008e-44

                  1. Initial program 63.4%

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

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

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

                  if 1.70000000000000008e-44 < c < 5.6000000000000004e109

                  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 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. +-commutativeN/A

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

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

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

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

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

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

                Alternative 6: 79.1% accurate, 0.9× speedup?

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

                  1. Initial program 49.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 \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-*.f6476.9

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

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

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

                    if -3.10000000000000004e-14 < c < 14.5

                    1. Initial program 63.6%

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.1 \cdot 10^{-14}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{elif}\;c \leq 14.5:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \end{array} \]
                  9. Add Preprocessing

                  Alternative 7: 70.6% accurate, 0.9× speedup?

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

                    1. Initial program 49.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-*.f6475.9

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

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

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

                      if -1.5499999999999999e-19 < c < 1.70000000000000008e-44

                      1. Initial program 63.4%

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

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

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

                      \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.55 \cdot 10^{-19}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \mathbf{elif}\;c \leq 1.7 \cdot 10^{-44}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \frac{a}{c} \cdot d}{c}\\ \end{array} \]
                    9. Add Preprocessing

                    Alternative 8: 64.0% accurate, 1.5× speedup?

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

                      1. Initial program 49.9%

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

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

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

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

                      if -2.9999999999999998e-14 < c < 1.70000000000000008e-44

                      1. Initial program 63.4%

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

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

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

                    Alternative 9: 42.6% 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 55.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-/.f6444.4

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

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