Complex division, imag part

Percentage Accurate: 62.3% → 81.8%
Time: 7.3s
Alternatives: 11
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 11 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.3% accurate, 1.0× speedup?

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

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

Alternative 1: 81.8% accurate, 0.5× speedup?

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

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

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

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

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -9.2e14 or 7.79999999999999962e127 < d

    1. Initial program 39.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-/.f6420.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -9.2e14 < d < 6.99999999999999994e-145

      1. Initial program 69.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-*.f6490.5

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

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

      if 6.99999999999999994e-145 < d < 7.79999999999999962e127

      1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -9.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{elif}\;d \leq 7 \cdot 10^{-145}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{+127}:\\ \;\;\;\;\mathsf{fma}\left(\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)}, b, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot \left(-d\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \end{array} \]
    12. Add Preprocessing

    Alternative 2: 81.1% accurate, 0.7× speedup?

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

      1. Initial program 39.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-/.f6420.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -9.2e14 < d < 1.47999999999999995e-145

        1. Initial program 69.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-*.f6490.5

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

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

        if 1.47999999999999995e-145 < d < 7.79999999999999962e127

        1. Initial program 83.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      Alternative 3: 81.1% accurate, 0.7× speedup?

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

        1. Initial program 39.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-/.f6420.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -9.2e14 < d < 1.47999999999999995e-145

          1. Initial program 69.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-*.f6490.5

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

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

          if 1.47999999999999995e-145 < d < 7.79999999999999962e127

          1. Initial program 83.5%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -9.2 \cdot 10^{+14}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{elif}\;d \leq 1.48 \cdot 10^{-145}:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{elif}\;d \leq 7.8 \cdot 10^{+127}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{d \cdot d + c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \end{array} \]
        12. Add Preprocessing

        Alternative 4: 64.0% accurate, 0.7× speedup?

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

          1. Initial program 50.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-/.f6474.1

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

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

          if -5.49999999999999984e-36 < c < 8.4999999999999996e-173

          1. Initial program 67.2%

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

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

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

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

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

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

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

          if 8.4999999999999996e-173 < c < 1.3999999999999999e-28

          1. Initial program 85.8%

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

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

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

          if 1.3999999999999999e-28 < c < 1e137

          1. Initial program 60.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 5: 73.5% accurate, 0.8× speedup?

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

          1. Initial program 35.1%

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

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

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

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

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

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

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

          if -8.19999999999999959e67 < d < 2.4e11

          1. Initial program 71.9%

            \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. Taylor expanded in 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.7

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

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

          if 2.4e11 < d < 5.5e148

          1. Initial program 80.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 6: 64.2% accurate, 0.8× speedup?

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

          1. Initial program 50.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-/.f6474.1

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

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

          if -5.49999999999999984e-36 < c < 8.0000000000000002e-8

          1. Initial program 69.9%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
          4. Step-by-step derivation
            1. 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.f6464.7

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

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

          if 8.0000000000000002e-8 < c < 1e137

          1. Initial program 62.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 7: 63.7% accurate, 0.8× speedup?

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

          1. Initial program 50.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-/.f6474.1

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

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

          if -5.49999999999999984e-36 < c < 8.0000000000000002e-8

          1. Initial program 69.9%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
          4. Step-by-step derivation
            1. 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.f6464.7

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

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

          if 8.0000000000000002e-8 < c < 5.4000000000000003e136

          1. Initial program 62.0%

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

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

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

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

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

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

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

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

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

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

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

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

        Alternative 8: 78.7% accurate, 0.9× speedup?

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

          1. Initial program 50.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-/.f6422.0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            if -9.2e14 < d < 2.4e11

            1. Initial program 71.9%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in 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-*.f6484.8

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

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

          Alternative 9: 76.6% accurate, 0.9× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\ \mathbf{if}\;d \leq -9.2 \cdot 10^{+14}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 240000000000:\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (let* ((t_0 (/ (- (/ (* c b) d) a) d)))
             (if (<= d -9.2e+14)
               t_0
               (if (<= d 240000000000.0) (/ (- b (/ (* a d) c)) c) t_0))))
          double code(double a, double b, double c, double d) {
          	double t_0 = (((c * b) / d) - a) / d;
          	double tmp;
          	if (d <= -9.2e+14) {
          		tmp = t_0;
          	} else if (d <= 240000000000.0) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: t_0
              real(8) :: tmp
              t_0 = (((c * b) / d) - a) / d
              if (d <= (-9.2d+14)) then
                  tmp = t_0
              else if (d <= 240000000000.0d0) then
                  tmp = (b - ((a * d) / c)) / c
              else
                  tmp = t_0
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double t_0 = (((c * b) / d) - a) / d;
          	double tmp;
          	if (d <= -9.2e+14) {
          		tmp = t_0;
          	} else if (d <= 240000000000.0) {
          		tmp = (b - ((a * d) / c)) / c;
          	} else {
          		tmp = t_0;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	t_0 = (((c * b) / d) - a) / d
          	tmp = 0
          	if d <= -9.2e+14:
          		tmp = t_0
          	elif d <= 240000000000.0:
          		tmp = (b - ((a * d) / c)) / c
          	else:
          		tmp = t_0
          	return tmp
          
          function code(a, b, c, d)
          	t_0 = Float64(Float64(Float64(Float64(c * b) / d) - a) / d)
          	tmp = 0.0
          	if (d <= -9.2e+14)
          		tmp = t_0;
          	elseif (d <= 240000000000.0)
          		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
          	else
          		tmp = t_0;
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	t_0 = (((c * b) / d) - a) / d;
          	tmp = 0.0;
          	if (d <= -9.2e+14)
          		tmp = t_0;
          	elseif (d <= 240000000000.0)
          		tmp = (b - ((a * d) / c)) / c;
          	else
          		tmp = t_0;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(c * b), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -9.2e+14], t$95$0, If[LessEqual[d, 240000000000.0], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := \frac{\frac{c \cdot b}{d} - a}{d}\\
          \mathbf{if}\;d \leq -9.2 \cdot 10^{+14}:\\
          \;\;\;\;t\_0\\
          
          \mathbf{elif}\;d \leq 240000000000:\\
          \;\;\;\;\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 < -9.2e14 or 2.4e11 < d

            1. Initial program 50.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-*.f6476.8

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

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

            if -9.2e14 < d < 2.4e11

            1. Initial program 71.9%

              \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in 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-*.f6484.8

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

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

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

          Alternative 10: 62.8% accurate, 1.5× speedup?

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

            1. Initial program 52.0%

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

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

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

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

            if -5.49999999999999984e-36 < c < 4.2000000000000002e61

            1. Initial program 68.5%

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

              \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
            4. Step-by-step derivation
              1. 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.f6462.1

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

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

          Alternative 11: 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.6%

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

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

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

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

          Developer Target 1: 99.3% 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 2024284 
          (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))))