Complex division, imag part

Percentage Accurate: 61.1% → 78.9%
Time: 6.7s
Alternatives: 8
Speedup: 1.5×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 8 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.1% 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: 78.9% accurate, 0.8× speedup?

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

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

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

\mathbf{elif}\;c \leq 2.6 \cdot 10^{+70}:\\
\;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -1.36e124 or 2.6e70 < c

    1. Initial program 34.1%

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

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

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

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

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

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

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

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

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

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

      if -1.36e124 < c < -7.99999999999999939e-65

      1. Initial program 92.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -7.99999999999999939e-65 < c < 2.6e70

      1. Initial program 76.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 2: 76.8% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (if (or (<= c -2.6e+17) (not (<= c 2.6e+70)))
       (/ (fma (- a) (/ d c) b) c)
       (/ (- (/ (* b c) d) a) d)))
    double code(double a, double b, double c, double d) {
    	double tmp;
    	if ((c <= -2.6e+17) || !(c <= 2.6e+70)) {
    		tmp = fma(-a, (d / c), b) / c;
    	} else {
    		tmp = (((b * c) / d) - a) / d;
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	tmp = 0.0
    	if ((c <= -2.6e+17) || !(c <= 2.6e+70))
    		tmp = Float64(fma(Float64(-a), Float64(d / c), b) / c);
    	else
    		tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d);
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := If[Or[LessEqual[c, -2.6e+17], N[Not[LessEqual[c, 2.6e+70]], $MachinePrecision]], N[(N[((-a) * N[(d / c), $MachinePrecision] + b), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\
    \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if c < -2.6e17 or 2.6e70 < c

      1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

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

        if -2.6e17 < c < 2.6e70

        1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \end{array} \]
      9. Add Preprocessing

      Alternative 3: 74.8% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (if (or (<= c -2.6e+17) (not (<= c 2.6e+70)))
         (/ (- b (/ (* a d) c)) c)
         (/ (- (/ (* b c) d) a) d)))
      double code(double a, double b, double c, double d) {
      	double tmp;
      	if ((c <= -2.6e+17) || !(c <= 2.6e+70)) {
      		tmp = (b - ((a * d) / c)) / c;
      	} else {
      		tmp = (((b * c) / d) - a) / 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 ((c <= (-2.6d+17)) .or. (.not. (c <= 2.6d+70))) then
              tmp = (b - ((a * d) / c)) / c
          else
              tmp = (((b * c) / d) - a) / d
          end if
          code = tmp
      end function
      
      public static double code(double a, double b, double c, double d) {
      	double tmp;
      	if ((c <= -2.6e+17) || !(c <= 2.6e+70)) {
      		tmp = (b - ((a * d) / c)) / c;
      	} else {
      		tmp = (((b * c) / d) - a) / d;
      	}
      	return tmp;
      }
      
      def code(a, b, c, d):
      	tmp = 0
      	if (c <= -2.6e+17) or not (c <= 2.6e+70):
      		tmp = (b - ((a * d) / c)) / c
      	else:
      		tmp = (((b * c) / d) - a) / d
      	return tmp
      
      function code(a, b, c, d)
      	tmp = 0.0
      	if ((c <= -2.6e+17) || !(c <= 2.6e+70))
      		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
      	else
      		tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d);
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b, c, d)
      	tmp = 0.0;
      	if ((c <= -2.6e+17) || ~((c <= 2.6e+70)))
      		tmp = (b - ((a * d) / c)) / c;
      	else
      		tmp = (((b * c) / d) - a) / d;
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_, c_, d_] := If[Or[LessEqual[c, -2.6e+17], N[Not[LessEqual[c, 2.6e+70]], $MachinePrecision]], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\
      \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < -2.6e17 or 2.6e70 < c

        1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

        if -2.6e17 < c < 2.6e70

        1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 4: 74.9% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (if (or (<= c -2.6e+17) (not (<= c 2.6e+70)))
         (/ (- b (/ (* a d) c)) c)
         (/ (fma b (/ c d) (- a)) d)))
      double code(double a, double b, double c, double d) {
      	double tmp;
      	if ((c <= -2.6e+17) || !(c <= 2.6e+70)) {
      		tmp = (b - ((a * d) / c)) / c;
      	} else {
      		tmp = fma(b, (c / d), -a) / d;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	tmp = 0.0
      	if ((c <= -2.6e+17) || !(c <= 2.6e+70))
      		tmp = Float64(Float64(b - Float64(Float64(a * d) / c)) / c);
      	else
      		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := If[Or[LessEqual[c, -2.6e+17], N[Not[LessEqual[c, 2.6e+70]], $MachinePrecision]], N[(N[(b - N[(N[(a * d), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\
      \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < -2.6e17 or 2.6e70 < c

        1. Initial program 44.7%

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

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

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

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

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

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

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

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

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

        if -2.6e17 < c < 2.6e70

        1. Initial program 78.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{fma}\left(-d, \frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)}, \color{blue}{\frac{b}{\frac{\mathsf{fma}\left(d, d, c \cdot c\right)}{c}}}\right) \]
          7. lower-/.f6474.2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+17} \lor \neg \left(c \leq 2.6 \cdot 10^{+70}\right):\\ \;\;\;\;\frac{b - \frac{a \cdot d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \end{array} \]
        14. Add Preprocessing

        Alternative 5: 72.1% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -7.5 \cdot 10^{+88} \lor \neg \left(c \leq 2.1 \cdot 10^{+53}\right):\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (if (or (<= c -7.5e+88) (not (<= c 2.1e+53)))
           (/ b c)
           (/ (fma b (/ c d) (- a)) d)))
        double code(double a, double b, double c, double d) {
        	double tmp;
        	if ((c <= -7.5e+88) || !(c <= 2.1e+53)) {
        		tmp = b / c;
        	} else {
        		tmp = fma(b, (c / d), -a) / d;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	tmp = 0.0
        	if ((c <= -7.5e+88) || !(c <= 2.1e+53))
        		tmp = Float64(b / c);
        	else
        		tmp = Float64(fma(b, Float64(c / d), Float64(-a)) / d);
        	end
        	return tmp
        end
        
        code[a_, b_, c_, d_] := If[Or[LessEqual[c, -7.5e+88], N[Not[LessEqual[c, 2.1e+53]], $MachinePrecision]], N[(b / c), $MachinePrecision], N[(N[(b * N[(c / d), $MachinePrecision] + (-a)), $MachinePrecision] / d), $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;c \leq -7.5 \cdot 10^{+88} \lor \neg \left(c \leq 2.1 \cdot 10^{+53}\right):\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if c < -7.50000000000000031e88 or 2.1000000000000002e53 < c

          1. Initial program 40.9%

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

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

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

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

          if -7.50000000000000031e88 < c < 2.1000000000000002e53

          1. Initial program 78.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -7.5 \cdot 10^{+88} \lor \neg \left(c \leq 2.1 \cdot 10^{+53}\right):\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, \frac{c}{d}, -a\right)}{d}\\ \end{array} \]
          14. Add Preprocessing

          Alternative 6: 63.6% accurate, 0.9× speedup?

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

            1. Initial program 51.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. mul-1-negN/A

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

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

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

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

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

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

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

            if -1.45000000000000005e131 < d < -2.6e-25

            1. Initial program 71.6%

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

              \[\leadsto \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-*.f6465.4

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

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

            if -2.6e-25 < d < 1.18000000000000002e94

            1. Initial program 66.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-/.f6473.4

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.45 \cdot 10^{+131}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -2.6 \cdot 10^{-25}:\\ \;\;\;\;\frac{b \cdot c - a \cdot d}{d \cdot d}\\ \mathbf{elif}\;d \leq 1.18 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 7: 62.8% accurate, 1.5× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+47} \lor \neg \left(d \leq 1.18 \cdot 10^{+94}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (if (or (<= d -6.2e+47) (not (<= d 1.18e+94))) (/ (- a) d) (/ b c)))
          double code(double a, double b, double c, double d) {
          	double tmp;
          	if ((d <= -6.2e+47) || !(d <= 1.18e+94)) {
          		tmp = -a / d;
          	} else {
          		tmp = b / c;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: tmp
              if ((d <= (-6.2d+47)) .or. (.not. (d <= 1.18d+94))) then
                  tmp = -a / d
              else
                  tmp = b / c
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double tmp;
          	if ((d <= -6.2e+47) || !(d <= 1.18e+94)) {
          		tmp = -a / d;
          	} else {
          		tmp = b / c;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	tmp = 0
          	if (d <= -6.2e+47) or not (d <= 1.18e+94):
          		tmp = -a / d
          	else:
          		tmp = b / c
          	return tmp
          
          function code(a, b, c, d)
          	tmp = 0.0
          	if ((d <= -6.2e+47) || !(d <= 1.18e+94))
          		tmp = Float64(Float64(-a) / d);
          	else
          		tmp = Float64(b / c);
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	tmp = 0.0;
          	if ((d <= -6.2e+47) || ~((d <= 1.18e+94)))
          		tmp = -a / d;
          	else
          		tmp = b / c;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := If[Or[LessEqual[d, -6.2e+47], N[Not[LessEqual[d, 1.18e+94]], $MachinePrecision]], N[((-a) / d), $MachinePrecision], N[(b / c), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;d \leq -6.2 \cdot 10^{+47} \lor \neg \left(d \leq 1.18 \cdot 10^{+94}\right):\\
          \;\;\;\;\frac{-a}{d}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{b}{c}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if d < -6.2000000000000001e47 or 1.18000000000000002e94 < d

            1. Initial program 56.7%

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

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

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

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

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

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

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

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

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

            if -6.2000000000000001e47 < d < 1.18000000000000002e94

            1. Initial program 67.2%

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

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

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

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+47} \lor \neg \left(d \leq 1.18 \cdot 10^{+94}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
          5. Add Preprocessing

          Alternative 8: 42.1% accurate, 3.2× speedup?

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

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

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

          Developer Target 1: 99.4% accurate, 0.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (if (< (fabs d) (fabs c))
             (/ (- b (* a (/ d c))) (+ c (* d (/ d c))))
             (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
          double code(double a, double b, double c, double d) {
          	double tmp;
          	if (fabs(d) < fabs(c)) {
          		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
          	} else {
          		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: tmp
              if (abs(d) < abs(c)) then
                  tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
              else
                  tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double tmp;
          	if (Math.abs(d) < Math.abs(c)) {
          		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
          	} else {
          		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	tmp = 0
          	if math.fabs(d) < math.fabs(c):
          		tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
          	else:
          		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)))
          	return tmp
          
          function code(a, b, c, d)
          	tmp = 0.0
          	if (abs(d) < abs(c))
          		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
          	else
          		tmp = Float64(Float64(Float64(-a) + Float64(b * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d))));
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	tmp = 0.0;
          	if (abs(d) < abs(c))
          		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
          	else
          		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\left|d\right| < \left|c\right|:\\
          \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
          
          
          \end{array}
          \end{array}
          

          Reproduce

          ?
          herbie shell --seed 2024317 
          (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))))