Complex division, imag part

Percentage Accurate: 61.5% → 80.5%
Time: 9.3s
Alternatives: 12
Speedup: 0.9×

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 12 alternatives:

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

Initial Program: 61.5% 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: 80.5% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{b - \frac{1}{\frac{\frac{c}{d}}{a}}}{c}\\
\mathbf{if}\;c \leq -1.2 \cdot 10^{+108}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.20000000000000009e108 or 6e6 < c

    1. Initial program 37.8%

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

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

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

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

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

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

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

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

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

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

      if -1.20000000000000009e108 < c < -7.49999999999999976e-126

      1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -7.49999999999999976e-126 < c < 6e6

      1. Initial program 68.8%

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

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

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
      7. 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 72.5% accurate, 0.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c - d \cdot a}{d \cdot d}\\ t_1 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -4 \cdot 10^{+121}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -2.9 \cdot 10^{+59}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 8 \cdot 10^{+50}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{+76}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 6.1 \cdot 10^{+88}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (let* ((t_0 (/ (- (* b c) (* d a)) (* d d))) (t_1 (/ (- a) d)))
       (if (<= d -4e+121)
         t_1
         (if (<= d -2.9e+59)
           (* (/ b (fma c c (* d d))) c)
           (if (<= d -3.1e-22)
             t_0
             (if (<= d 8e+50)
               (/ (- b (/ (* d a) c)) c)
               (if (<= d 3.8e+76) t_0 (if (<= d 6.1e+88) (/ b c) t_1))))))))
    double code(double a, double b, double c, double d) {
    	double t_0 = ((b * c) - (d * a)) / (d * d);
    	double t_1 = -a / d;
    	double tmp;
    	if (d <= -4e+121) {
    		tmp = t_1;
    	} else if (d <= -2.9e+59) {
    		tmp = (b / fma(c, c, (d * d))) * c;
    	} else if (d <= -3.1e-22) {
    		tmp = t_0;
    	} else if (d <= 8e+50) {
    		tmp = (b - ((d * a) / c)) / c;
    	} else if (d <= 3.8e+76) {
    		tmp = t_0;
    	} else if (d <= 6.1e+88) {
    		tmp = b / c;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	t_0 = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(d * d))
    	t_1 = Float64(Float64(-a) / d)
    	tmp = 0.0
    	if (d <= -4e+121)
    		tmp = t_1;
    	elseif (d <= -2.9e+59)
    		tmp = Float64(Float64(b / fma(c, c, Float64(d * d))) * c);
    	elseif (d <= -3.1e-22)
    		tmp = t_0;
    	elseif (d <= 8e+50)
    		tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c);
    	elseif (d <= 3.8e+76)
    		tmp = t_0;
    	elseif (d <= 6.1e+88)
    		tmp = Float64(b / c);
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -4e+121], t$95$1, If[LessEqual[d, -2.9e+59], N[(N[(b / N[(c * c + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[d, -3.1e-22], t$95$0, If[LessEqual[d, 8e+50], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[d, 3.8e+76], t$95$0, If[LessEqual[d, 6.1e+88], N[(b / c), $MachinePrecision], t$95$1]]]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{b \cdot c - d \cdot a}{d \cdot d}\\
    t_1 := \frac{-a}{d}\\
    \mathbf{if}\;d \leq -4 \cdot 10^{+121}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;d \leq -2.9 \cdot 10^{+59}:\\
    \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\
    
    \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;d \leq 8 \cdot 10^{+50}:\\
    \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
    
    \mathbf{elif}\;d \leq 3.8 \cdot 10^{+76}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;d \leq 6.1 \cdot 10^{+88}:\\
    \;\;\;\;\frac{b}{c}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if d < -4.00000000000000015e121 or 6.0999999999999998e88 < d

      1. Initial program 36.3%

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

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

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

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

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

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

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

      if -4.00000000000000015e121 < d < -2.89999999999999991e59

      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 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-*.f6467.4

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

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

      if -2.89999999999999991e59 < d < -3.10000000000000013e-22 or 8.0000000000000006e50 < d < 3.80000000000000024e76

      1. Initial program 85.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 \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-*.f6475.1

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

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

      if -3.10000000000000013e-22 < d < 8.0000000000000006e50

      1. Initial program 72.6%

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

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

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

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

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

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

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

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

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

      if 3.80000000000000024e76 < d < 6.0999999999999998e88

      1. Initial program 33.3%

        \[\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-/.f64100.0

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    3. Recombined 5 regimes into one program.
    4. Final simplification78.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -4 \cdot 10^{+121}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -2.9 \cdot 10^{+59}:\\ \;\;\;\;\frac{b}{\mathsf{fma}\left(c, c, d \cdot d\right)} \cdot c\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq 8 \cdot 10^{+50}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 3.8 \cdot 10^{+76}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq 6.1 \cdot 10^{+88}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 3: 77.1% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\ t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (let* ((t_0 (/ (- b (/ (* d a) c)) c)) (t_1 (/ (fma (/ c d) b (- a)) d)))
       (if (<= d -1.45e+100)
         (/ (fma (/ b d) c (- a)) d)
         (if (<= d -1.22e+72)
           t_0
           (if (<= d -3.1e-22) t_1 (if (<= d 7.5e+50) t_0 t_1))))))
    double code(double a, double b, double c, double d) {
    	double t_0 = (b - ((d * a) / c)) / c;
    	double t_1 = fma((c / d), b, -a) / d;
    	double tmp;
    	if (d <= -1.45e+100) {
    		tmp = fma((b / d), c, -a) / d;
    	} else if (d <= -1.22e+72) {
    		tmp = t_0;
    	} else if (d <= -3.1e-22) {
    		tmp = t_1;
    	} else if (d <= 7.5e+50) {
    		tmp = t_0;
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	t_0 = Float64(Float64(b - Float64(Float64(d * a) / c)) / c)
    	t_1 = Float64(fma(Float64(c / d), b, Float64(-a)) / d)
    	tmp = 0.0
    	if (d <= -1.45e+100)
    		tmp = Float64(fma(Float64(b / d), c, Float64(-a)) / d);
    	elseif (d <= -1.22e+72)
    		tmp = t_0;
    	elseif (d <= -3.1e-22)
    		tmp = t_1;
    	elseif (d <= 7.5e+50)
    		tmp = t_0;
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.45e+100], N[(N[(N[(b / d), $MachinePrecision] * c + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, -1.22e+72], t$95$0, If[LessEqual[d, -3.1e-22], t$95$1, If[LessEqual[d, 7.5e+50], t$95$0, t$95$1]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\
    t_1 := \frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\
    \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\
    \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\
    
    \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if d < -1.45e100

      1. Initial program 41.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-/.f6411.8

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

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

        \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
      7. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -1.45e100 < d < -1.2200000000000001e72 or -3.10000000000000013e-22 < d < 7.4999999999999999e50

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

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

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

        if -1.2200000000000001e72 < d < -3.10000000000000013e-22 or 7.4999999999999999e50 < d

        1. Initial program 51.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.f6458.6

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

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

          \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
        7. 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \end{array} \]
      12. Add Preprocessing

      Alternative 4: 77.4% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\ t_1 := \frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (/ (- b (/ (* d a) c)) c)) (t_1 (/ (fma (/ b d) c (- a)) d)))
         (if (<= d -1.45e+100)
           t_1
           (if (<= d -1.22e+72)
             t_0
             (if (<= d -3.1e-22)
               (/ (- (/ (* b c) d) a) d)
               (if (<= d 7.5e+50) t_0 t_1))))))
      double code(double a, double b, double c, double d) {
      	double t_0 = (b - ((d * a) / c)) / c;
      	double t_1 = fma((b / d), c, -a) / d;
      	double tmp;
      	if (d <= -1.45e+100) {
      		tmp = t_1;
      	} else if (d <= -1.22e+72) {
      		tmp = t_0;
      	} else if (d <= -3.1e-22) {
      		tmp = (((b * c) / d) - a) / d;
      	} else if (d <= 7.5e+50) {
      		tmp = t_0;
      	} else {
      		tmp = t_1;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = Float64(Float64(b - Float64(Float64(d * a) / c)) / c)
      	t_1 = Float64(fma(Float64(b / d), c, Float64(-a)) / d)
      	tmp = 0.0
      	if (d <= -1.45e+100)
      		tmp = t_1;
      	elseif (d <= -1.22e+72)
      		tmp = t_0;
      	elseif (d <= -3.1e-22)
      		tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d);
      	elseif (d <= 7.5e+50)
      		tmp = t_0;
      	else
      		tmp = t_1;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(b / d), $MachinePrecision] * c + (-a)), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.45e+100], t$95$1, If[LessEqual[d, -1.22e+72], t$95$0, If[LessEqual[d, -3.1e-22], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, 7.5e+50], t$95$0, t$95$1]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\
      t_1 := \frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\
      \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\
      \;\;\;\;t\_1\\
      
      \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\
      \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
      
      \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_1\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if d < -1.45e100 or 7.4999999999999999e50 < d

        1. Initial program 40.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-/.f6419.9

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

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

          \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
        7. 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. unsub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.45e100 < d < -1.2200000000000001e72 or -3.10000000000000013e-22 < d < 7.4999999999999999e50

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

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

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

          if -1.2200000000000001e72 < d < -3.10000000000000013e-22

          1. Initial program 81.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{d}, c, -a\right)}{d}\\ \end{array} \]
        12. Add Preprocessing

        Alternative 5: 75.2% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\ t_1 := \frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- b (/ (* d a) c)) c)) (t_1 (/ (- (/ (* b c) d) a) d)))
           (if (<= d -1.45e+100)
             t_1
             (if (<= d -1.22e+72)
               t_0
               (if (<= d -3.1e-22) t_1 (if (<= d 7.5e+50) t_0 t_1))))))
        double code(double a, double b, double c, double d) {
        	double t_0 = (b - ((d * a) / c)) / c;
        	double t_1 = (((b * c) / d) - a) / d;
        	double tmp;
        	if (d <= -1.45e+100) {
        		tmp = t_1;
        	} else if (d <= -1.22e+72) {
        		tmp = t_0;
        	} else if (d <= -3.1e-22) {
        		tmp = t_1;
        	} else if (d <= 7.5e+50) {
        		tmp = t_0;
        	} else {
        		tmp = t_1;
        	}
        	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) :: t_1
            real(8) :: tmp
            t_0 = (b - ((d * a) / c)) / c
            t_1 = (((b * c) / d) - a) / d
            if (d <= (-1.45d+100)) then
                tmp = t_1
            else if (d <= (-1.22d+72)) then
                tmp = t_0
            else if (d <= (-3.1d-22)) then
                tmp = t_1
            else if (d <= 7.5d+50) then
                tmp = t_0
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double t_0 = (b - ((d * a) / c)) / c;
        	double t_1 = (((b * c) / d) - a) / d;
        	double tmp;
        	if (d <= -1.45e+100) {
        		tmp = t_1;
        	} else if (d <= -1.22e+72) {
        		tmp = t_0;
        	} else if (d <= -3.1e-22) {
        		tmp = t_1;
        	} else if (d <= 7.5e+50) {
        		tmp = t_0;
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	t_0 = (b - ((d * a) / c)) / c
        	t_1 = (((b * c) / d) - a) / d
        	tmp = 0
        	if d <= -1.45e+100:
        		tmp = t_1
        	elif d <= -1.22e+72:
        		tmp = t_0
        	elif d <= -3.1e-22:
        		tmp = t_1
        	elif d <= 7.5e+50:
        		tmp = t_0
        	else:
        		tmp = t_1
        	return tmp
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(b - Float64(Float64(d * a) / c)) / c)
        	t_1 = Float64(Float64(Float64(Float64(b * c) / d) - a) / d)
        	tmp = 0.0
        	if (d <= -1.45e+100)
        		tmp = t_1;
        	elseif (d <= -1.22e+72)
        		tmp = t_0;
        	elseif (d <= -3.1e-22)
        		tmp = t_1;
        	elseif (d <= 7.5e+50)
        		tmp = t_0;
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	t_0 = (b - ((d * a) / c)) / c;
        	t_1 = (((b * c) / d) - a) / d;
        	tmp = 0.0;
        	if (d <= -1.45e+100)
        		tmp = t_1;
        	elseif (d <= -1.22e+72)
        		tmp = t_0;
        	elseif (d <= -3.1e-22)
        		tmp = t_1;
        	elseif (d <= 7.5e+50)
        		tmp = t_0;
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.45e+100], t$95$1, If[LessEqual[d, -1.22e+72], t$95$0, If[LessEqual[d, -3.1e-22], t$95$1, If[LessEqual[d, 7.5e+50], t$95$0, t$95$1]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\
        t_1 := \frac{\frac{b \cdot c}{d} - a}{d}\\
        \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if d < -1.45e100 or -1.2200000000000001e72 < d < -3.10000000000000013e-22 or 7.4999999999999999e50 < d

          1. Initial program 47.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -1.45e100 < d < -1.2200000000000001e72 or -3.10000000000000013e-22 < d < 7.4999999999999999e50

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+100}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{elif}\;d \leq -1.22 \cdot 10^{+72}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq -3.1 \cdot 10^{-22}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{elif}\;d \leq 7.5 \cdot 10^{+50}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 6: 64.5% accurate, 0.7× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;c \leq -2.1 \cdot 10^{+107}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -2.1 \cdot 10^{-127}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 1.22 \cdot 10^{-129}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-33}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;c \leq 11500000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- a) d)))
           (if (<= c -2.1e+107)
             (/ b c)
             (if (<= c -2.1e-127)
               (/ (* b c) (fma d d (* c c)))
               (if (<= c 1.22e-129)
                 t_0
                 (if (<= c 4.5e-33)
                   (/ (- (* b c) (* d a)) (* d d))
                   (if (<= c 11500000.0) t_0 (/ b c))))))))
        double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (c <= -2.1e+107) {
        		tmp = b / c;
        	} else if (c <= -2.1e-127) {
        		tmp = (b * c) / fma(d, d, (c * c));
        	} else if (c <= 1.22e-129) {
        		tmp = t_0;
        	} else if (c <= 4.5e-33) {
        		tmp = ((b * c) - (d * a)) / (d * d);
        	} else if (c <= 11500000.0) {
        		tmp = t_0;
        	} else {
        		tmp = b / c;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(-a) / d)
        	tmp = 0.0
        	if (c <= -2.1e+107)
        		tmp = Float64(b / c);
        	elseif (c <= -2.1e-127)
        		tmp = Float64(Float64(b * c) / fma(d, d, Float64(c * c)));
        	elseif (c <= 1.22e-129)
        		tmp = t_0;
        	elseif (c <= 4.5e-33)
        		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(d * d));
        	elseif (c <= 11500000.0)
        		tmp = t_0;
        	else
        		tmp = Float64(b / c);
        	end
        	return tmp
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[c, -2.1e+107], N[(b / c), $MachinePrecision], If[LessEqual[c, -2.1e-127], N[(N[(b * c), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.22e-129], t$95$0, If[LessEqual[c, 4.5e-33], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 11500000.0], t$95$0, N[(b / c), $MachinePrecision]]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{-a}{d}\\
        \mathbf{if}\;c \leq -2.1 \cdot 10^{+107}:\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{elif}\;c \leq -2.1 \cdot 10^{-127}:\\
        \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
        
        \mathbf{elif}\;c \leq 1.22 \cdot 10^{-129}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;c \leq 4.5 \cdot 10^{-33}:\\
        \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\
        
        \mathbf{elif}\;c \leq 11500000:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{b}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 4 regimes
        2. if c < -2.1e107 or 1.15e7 < c

          1. Initial program 37.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-/.f6472.0

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

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

          if -2.1e107 < c < -2.1000000000000001e-127

          1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
          6. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

          if -2.1000000000000001e-127 < c < 1.21999999999999999e-129 or 4.49999999999999991e-33 < c < 1.15e7

          1. Initial program 65.0%

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

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

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

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

          if 1.21999999999999999e-129 < c < 4.49999999999999991e-33

          1. Initial program 85.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 \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-*.f6476.0

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.1 \cdot 10^{+107}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -2.1 \cdot 10^{-127}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 1.22 \cdot 10^{-129}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-33}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;c \leq 11500000:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 7: 77.7% accurate, 0.8× speedup?

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

          1. Initial program 23.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-/.f6472.3

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

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

          if -2.2999999999999999e108 < c < -7.49999999999999976e-126

          1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -7.49999999999999976e-126 < c < 6e6

          1. Initial program 68.8%

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

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

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

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

            \[\leadsto \color{blue}{-1 \cdot \frac{a}{d} + \frac{b \cdot c}{{d}^{2}}} \]
          7. 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. sub-negN/A

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

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

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

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

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

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

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

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

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

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

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

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

          if 6e6 < 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 + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

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

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

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

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

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

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

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

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

        Alternative 8: 64.4% accurate, 0.9× speedup?

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

          1. Initial program 37.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-/.f6472.0

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

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

          if -2.1e107 < c < -2.1000000000000001e-127

          1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
          6. Step-by-step derivation
            1. *-commutativeN/A

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

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

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

          if -2.1000000000000001e-127 < c < 1.15e7

          1. Initial program 68.8%

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

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

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

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

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

        Alternative 9: 64.9% accurate, 0.9× speedup?

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

          1. Initial program 36.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-/.f6471.7

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

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

          if -6.19999999999999965e112 < c < -2.1000000000000001e-127

          1. Initial program 81.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-/.f6441.2

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

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

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

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

          if -2.1000000000000001e-127 < c < 1.15e7

          1. Initial program 68.8%

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

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

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

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

        Alternative 10: 64.3% accurate, 0.9× speedup?

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

          1. Initial program 35.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-/.f6471.4

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

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

          if -2.6e114 < c < -2.2000000000000001e-127

          1. Initial program 81.9%

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

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

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

          if -2.2000000000000001e-127 < c < 1.15e7

          1. Initial program 68.8%

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

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

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

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

        Alternative 11: 61.5% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;c \leq -5.5 \cdot 10^{+80}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -5.5 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq -4.5 \cdot 10^{-127}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 11500000:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- a) d)))
           (if (<= c -5.5e+80)
             (/ b c)
             (if (<= c -5.5e+25)
               t_0
               (if (<= c -4.5e-127) (/ b c) (if (<= c 11500000.0) t_0 (/ b c)))))))
        double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (c <= -5.5e+80) {
        		tmp = b / c;
        	} else if (c <= -5.5e+25) {
        		tmp = t_0;
        	} else if (c <= -4.5e-127) {
        		tmp = b / c;
        	} else if (c <= 11500000.0) {
        		tmp = t_0;
        	} 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) :: t_0
            real(8) :: tmp
            t_0 = -a / d
            if (c <= (-5.5d+80)) then
                tmp = b / c
            else if (c <= (-5.5d+25)) then
                tmp = t_0
            else if (c <= (-4.5d-127)) then
                tmp = b / c
            else if (c <= 11500000.0d0) then
                tmp = t_0
            else
                tmp = b / c
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (c <= -5.5e+80) {
        		tmp = b / c;
        	} else if (c <= -5.5e+25) {
        		tmp = t_0;
        	} else if (c <= -4.5e-127) {
        		tmp = b / c;
        	} else if (c <= 11500000.0) {
        		tmp = t_0;
        	} else {
        		tmp = b / c;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	t_0 = -a / d
        	tmp = 0
        	if c <= -5.5e+80:
        		tmp = b / c
        	elif c <= -5.5e+25:
        		tmp = t_0
        	elif c <= -4.5e-127:
        		tmp = b / c
        	elif c <= 11500000.0:
        		tmp = t_0
        	else:
        		tmp = b / c
        	return tmp
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(-a) / d)
        	tmp = 0.0
        	if (c <= -5.5e+80)
        		tmp = Float64(b / c);
        	elseif (c <= -5.5e+25)
        		tmp = t_0;
        	elseif (c <= -4.5e-127)
        		tmp = Float64(b / c);
        	elseif (c <= 11500000.0)
        		tmp = t_0;
        	else
        		tmp = Float64(b / c);
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	t_0 = -a / d;
        	tmp = 0.0;
        	if (c <= -5.5e+80)
        		tmp = b / c;
        	elseif (c <= -5.5e+25)
        		tmp = t_0;
        	elseif (c <= -4.5e-127)
        		tmp = b / c;
        	elseif (c <= 11500000.0)
        		tmp = t_0;
        	else
        		tmp = b / c;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[c, -5.5e+80], N[(b / c), $MachinePrecision], If[LessEqual[c, -5.5e+25], t$95$0, If[LessEqual[c, -4.5e-127], N[(b / c), $MachinePrecision], If[LessEqual[c, 11500000.0], t$95$0, N[(b / c), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{-a}{d}\\
        \mathbf{if}\;c \leq -5.5 \cdot 10^{+80}:\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{elif}\;c \leq -5.5 \cdot 10^{+25}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;c \leq -4.5 \cdot 10^{-127}:\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{elif}\;c \leq 11500000:\\
        \;\;\;\;t\_0\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{b}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if c < -5.49999999999999967e80 or -5.50000000000000018e25 < c < -4.4999999999999999e-127 or 1.15e7 < c

          1. Initial program 51.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-/.f6464.1

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

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

          if -5.49999999999999967e80 < c < -5.50000000000000018e25 or -4.4999999999999999e-127 < c < 1.15e7

          1. Initial program 68.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.f6468.7

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

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

        Alternative 12: 42.8% 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 59.4%

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

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

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

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