Complex division, imag part

Percentage Accurate: 61.5% → 85.6%
Time: 12.0s
Alternatives: 11
Speedup: 1.8×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 11 alternatives:

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

Initial Program: 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: 85.6% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+300}:\\ \;\;\;\;\frac{\frac{-\mathsf{fma}\left(a, d, b \cdot \left(-c\right)\right)}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= (/ (- (* b c) (* a d)) (+ (* c c) (* d d))) 2e+300)
   (/ (/ (- (fma a d (* b (- c)))) (hypot d c)) (hypot d c))
   (- (/ b c) (/ (* d (/ a c)) c))))
double code(double a, double b, double c, double d) {
	double tmp;
	if ((((b * c) - (a * d)) / ((c * c) + (d * d))) <= 2e+300) {
		tmp = (-fma(a, d, (b * -c)) / hypot(d, c)) / hypot(d, c);
	} else {
		tmp = (b / c) - ((d * (a / c)) / c);
	}
	return tmp;
}
function code(a, b, c, d)
	tmp = 0.0
	if (Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d))) <= 2e+300)
		tmp = Float64(Float64(Float64(-fma(a, d, Float64(b * Float64(-c)))) / hypot(d, c)) / hypot(d, c));
	else
		tmp = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c));
	end
	return tmp
end
code[a_, b_, c_, d_] := If[LessEqual[N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2e+300], N[(N[((-N[(a * d + N[(b * (-c)), $MachinePrecision]), $MachinePrecision]) / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[d ^ 2 + c ^ 2], $MachinePrecision]), $MachinePrecision], N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+300}:\\
\;\;\;\;\frac{\frac{-\mathsf{fma}\left(a, d, b \cdot \left(-c\right)\right)}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d))) < 2.0000000000000001e300

    1. Initial program 75.5%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. frac-2neg75.5%

        \[\leadsto \color{blue}{\frac{-\left(b \cdot c - a \cdot d\right)}{-\left(c \cdot c + d \cdot d\right)}} \]
      2. div-inv75.5%

        \[\leadsto \color{blue}{\left(-\left(b \cdot c - a \cdot d\right)\right) \cdot \frac{1}{-\left(c \cdot c + d \cdot d\right)}} \]
    3. Applied egg-rr75.5%

      \[\leadsto \color{blue}{\left(a \cdot d - b \cdot c\right) \cdot \frac{1}{-{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    4. Step-by-step derivation
      1. *-commutative75.5%

        \[\leadsto \left(a \cdot d - \color{blue}{c \cdot b}\right) \cdot \frac{1}{-{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \]
      2. neg-mul-175.5%

        \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \frac{1}{\color{blue}{-1 \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
      3. associate-/r*75.5%

        \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \color{blue}{\frac{\frac{1}{-1}}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
      4. metadata-eval75.5%

        \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \frac{\color{blue}{-1}}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \]
    5. Simplified75.5%

      \[\leadsto \color{blue}{\left(a \cdot d - c \cdot b\right) \cdot \frac{-1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    6. Step-by-step derivation
      1. associate-*r/75.5%

        \[\leadsto \color{blue}{\frac{\left(a \cdot d - c \cdot b\right) \cdot -1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
      2. unpow275.5%

        \[\leadsto \frac{\left(a \cdot d - c \cdot b\right) \cdot -1}{\color{blue}{\mathsf{hypot}\left(c, d\right) \cdot \mathsf{hypot}\left(c, d\right)}} \]
      3. associate-/r*96.3%

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

        \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(a, d, -c \cdot b\right)} \cdot -1}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} \]
      5. distribute-rgt-neg-in96.3%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, \color{blue}{c \cdot \left(-b\right)}\right) \cdot -1}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} \]
      6. hypot-udef75.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\color{blue}{\sqrt{c \cdot c + d \cdot d}}}}{\mathsf{hypot}\left(c, d\right)} \]
      7. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{{c}^{2}} + d \cdot d}}}{\mathsf{hypot}\left(c, d\right)} \]
      8. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{{c}^{2} + \color{blue}{{d}^{2}}}}}{\mathsf{hypot}\left(c, d\right)} \]
      9. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{c \cdot c} + {d}^{2}}}}{\mathsf{hypot}\left(c, d\right)} \]
      10. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{c \cdot c + \color{blue}{d \cdot d}}}}{\mathsf{hypot}\left(c, d\right)} \]
      11. +-commutative75.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{d \cdot d + c \cdot c}}}}{\mathsf{hypot}\left(c, d\right)} \]
      12. hypot-def96.3%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\color{blue}{\mathsf{hypot}\left(d, c\right)}}}{\mathsf{hypot}\left(c, d\right)} \]
      13. hypot-udef75.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\color{blue}{\sqrt{c \cdot c + d \cdot d}}} \]
      14. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{\color{blue}{{c}^{2}} + d \cdot d}} \]
      15. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{{c}^{2} + \color{blue}{{d}^{2}}}} \]
      16. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{\color{blue}{c \cdot c} + {d}^{2}}} \]
      17. unpow275.7%

        \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{c \cdot c + \color{blue}{d \cdot d}}} \]
    7. Applied egg-rr96.3%

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

    if 2.0000000000000001e300 < (/.f64 (-.f64 (*.f64 b c) (*.f64 a d)) (+.f64 (*.f64 c c) (*.f64 d d)))

    1. Initial program 12.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity49.9%

        \[\leadsto -1 \cdot \frac{\color{blue}{1 \cdot \left(a \cdot d\right)}}{{c}^{2}} + \frac{b}{c} \]
      2. metadata-eval49.9%

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval56.9%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
    5. Step-by-step derivation
      1. associate-*l/56.8%

        \[\leadsto -1 \cdot \color{blue}{\frac{1 \cdot \frac{a \cdot d}{c}}{c}} + \frac{b}{c} \]
      2. *-un-lft-identity56.8%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{a \cdot d}{c}}}{c} + \frac{b}{c} \]
      3. associate-/l*66.5%

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

      \[\leadsto -1 \cdot \color{blue}{\frac{\frac{a}{\frac{c}{d}}}{c}} + \frac{b}{c} \]
    7. Step-by-step derivation
      1. associate-/r/66.6%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \leq 2 \cdot 10^{+300}:\\ \;\;\;\;\frac{\frac{-\mathsf{fma}\left(a, d, b \cdot \left(-c\right)\right)}{\mathsf{hypot}\left(d, c\right)}}{\mathsf{hypot}\left(d, c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 2: 79.1% accurate, 0.1× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\
\mathbf{if}\;c \leq -7.4 \cdot 10^{+102}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 8.6 \cdot 10^{-188}:\\
\;\;\;\;\frac{-a}{d}\\

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -7.40000000000000045e102 or 2.3999999999999999e42 < c

    1. Initial program 34.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity73.7%

        \[\leadsto -1 \cdot \frac{\color{blue}{1 \cdot \left(a \cdot d\right)}}{{c}^{2}} + \frac{b}{c} \]
      2. metadata-eval73.7%

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

        \[\leadsto -1 \cdot \frac{\frac{2}{2} \cdot \left(a \cdot d\right)}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-frac81.5%

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval81.5%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
    5. Step-by-step derivation
      1. associate-/l*86.7%

        \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\frac{a}{\frac{c}{d}}}\right) + \frac{b}{c} \]
      2. associate-/r/87.7%

        \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\left(\frac{a}{c} \cdot d\right)}\right) + \frac{b}{c} \]
    6. Applied egg-rr87.7%

      \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\left(\frac{a}{c} \cdot d\right)}\right) + \frac{b}{c} \]

    if -7.40000000000000045e102 < c < -1.7999999999999999e-168

    1. Initial program 88.1%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Step-by-step derivation
      1. fma-neg88.1%

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(b, c, -a \cdot d\right)}}{c \cdot c + d \cdot d} \]
      2. distribute-rgt-neg-out88.1%

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

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

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

    if -1.7999999999999999e-168 < c < 8.59999999999999975e-188

    1. Initial program 56.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/83.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-183.8%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified83.8%

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

    if 8.59999999999999975e-188 < c < 2.3999999999999999e42

    1. Initial program 81.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification85.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -7.4 \cdot 10^{+102}:\\ \;\;\;\;\frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-168}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, c, a \cdot \left(-d\right)\right)}{\mathsf{fma}\left(c, c, d \cdot d\right)}\\ \mathbf{elif}\;c \leq 8.6 \cdot 10^{-188}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{+42}:\\ \;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\ \end{array} \]

Alternative 3: 79.1% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\ t_1 := \frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\ \mathbf{if}\;c \leq -8.2 \cdot 10^{+102}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -9.5 \cdot 10^{-170}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-184}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{+42}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
        (t_1 (+ (/ b c) (* (* d (/ a c)) (/ -1.0 c)))))
   (if (<= c -8.2e+102)
     t_1
     (if (<= c -9.5e-170)
       t_0
       (if (<= c 4.5e-184) (/ (- a) d) (if (<= c 2.4e+42) t_0 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
	double t_1 = (b / c) + ((d * (a / c)) * (-1.0 / c));
	double tmp;
	if (c <= -8.2e+102) {
		tmp = t_1;
	} else if (c <= -9.5e-170) {
		tmp = t_0;
	} else if (c <= 4.5e-184) {
		tmp = -a / d;
	} else if (c <= 2.4e+42) {
		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 * c) - (a * d)) / ((c * c) + (d * d))
    t_1 = (b / c) + ((d * (a / c)) * ((-1.0d0) / c))
    if (c <= (-8.2d+102)) then
        tmp = t_1
    else if (c <= (-9.5d-170)) then
        tmp = t_0
    else if (c <= 4.5d-184) then
        tmp = -a / d
    else if (c <= 2.4d+42) 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 * c) - (a * d)) / ((c * c) + (d * d));
	double t_1 = (b / c) + ((d * (a / c)) * (-1.0 / c));
	double tmp;
	if (c <= -8.2e+102) {
		tmp = t_1;
	} else if (c <= -9.5e-170) {
		tmp = t_0;
	} else if (c <= 4.5e-184) {
		tmp = -a / d;
	} else if (c <= 2.4e+42) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d))
	t_1 = (b / c) + ((d * (a / c)) * (-1.0 / c))
	tmp = 0
	if c <= -8.2e+102:
		tmp = t_1
	elif c <= -9.5e-170:
		tmp = t_0
	elif c <= 4.5e-184:
		tmp = -a / d
	elif c <= 2.4e+42:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
	t_1 = Float64(Float64(b / c) + Float64(Float64(d * Float64(a / c)) * Float64(-1.0 / c)))
	tmp = 0.0
	if (c <= -8.2e+102)
		tmp = t_1;
	elseif (c <= -9.5e-170)
		tmp = t_0;
	elseif (c <= 4.5e-184)
		tmp = Float64(Float64(-a) / d);
	elseif (c <= 2.4e+42)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((b * c) - (a * d)) / ((c * c) + (d * d));
	t_1 = (b / c) + ((d * (a / c)) * (-1.0 / c));
	tmp = 0.0;
	if (c <= -8.2e+102)
		tmp = t_1;
	elseif (c <= -9.5e-170)
		tmp = t_0;
	elseif (c <= 4.5e-184)
		tmp = -a / d;
	elseif (c <= 2.4e+42)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b * c), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] + N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] * N[(-1.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -8.2e+102], t$95$1, If[LessEqual[c, -9.5e-170], t$95$0, If[LessEqual[c, 4.5e-184], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 2.4e+42], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\
\mathbf{if}\;c \leq -8.2 \cdot 10^{+102}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -9.5 \cdot 10^{-170}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 4.5 \cdot 10^{-184}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{elif}\;c \leq 2.4 \cdot 10^{+42}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -8.1999999999999999e102 or 2.3999999999999999e42 < c

    1. Initial program 34.3%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity73.7%

        \[\leadsto -1 \cdot \frac{\color{blue}{1 \cdot \left(a \cdot d\right)}}{{c}^{2}} + \frac{b}{c} \]
      2. metadata-eval73.7%

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

        \[\leadsto -1 \cdot \frac{\frac{2}{2} \cdot \left(a \cdot d\right)}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-frac81.5%

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval81.5%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
    5. Step-by-step derivation
      1. associate-/l*86.7%

        \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\frac{a}{\frac{c}{d}}}\right) + \frac{b}{c} \]
      2. associate-/r/87.7%

        \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\left(\frac{a}{c} \cdot d\right)}\right) + \frac{b}{c} \]
    6. Applied egg-rr87.7%

      \[\leadsto -1 \cdot \left(\frac{1}{c} \cdot \color{blue}{\left(\frac{a}{c} \cdot d\right)}\right) + \frac{b}{c} \]

    if -8.1999999999999999e102 < c < -9.5000000000000001e-170 or 4.5000000000000001e-184 < c < 2.3999999999999999e42

    1. Initial program 85.2%

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

    if -9.5000000000000001e-170 < c < 4.5000000000000001e-184

    1. Initial program 56.5%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/83.8%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-183.8%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified83.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -8.2 \cdot 10^{+102}:\\ \;\;\;\;\frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\ \mathbf{elif}\;c \leq -9.5 \cdot 10^{-170}:\\ \;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-184}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{+42}:\\ \;\;\;\;\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} + \left(d \cdot \frac{a}{c}\right) \cdot \frac{-1}{c}\\ \end{array} \]

Alternative 4: 66.3% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{if}\;c \leq -9.6 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -4.1 \cdot 10^{-84}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-66}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 3.8 \cdot 10^{+40}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (* b c) (+ (* c c) (* d d)))))
   (if (<= c -9.6e+94)
     (/ b c)
     (if (<= c -4.1e-84)
       t_0
       (if (<= c 2.5e-66) (/ (- a) d) (if (<= c 3.8e+40) t_0 (/ b c)))))))
double code(double a, double b, double c, double d) {
	double t_0 = (b * c) / ((c * c) + (d * d));
	double tmp;
	if (c <= -9.6e+94) {
		tmp = b / c;
	} else if (c <= -4.1e-84) {
		tmp = t_0;
	} else if (c <= 2.5e-66) {
		tmp = -a / d;
	} else if (c <= 3.8e+40) {
		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 = (b * c) / ((c * c) + (d * d))
    if (c <= (-9.6d+94)) then
        tmp = b / c
    else if (c <= (-4.1d-84)) then
        tmp = t_0
    else if (c <= 2.5d-66) then
        tmp = -a / d
    else if (c <= 3.8d+40) 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 = (b * c) / ((c * c) + (d * d));
	double tmp;
	if (c <= -9.6e+94) {
		tmp = b / c;
	} else if (c <= -4.1e-84) {
		tmp = t_0;
	} else if (c <= 2.5e-66) {
		tmp = -a / d;
	} else if (c <= 3.8e+40) {
		tmp = t_0;
	} else {
		tmp = b / c;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (b * c) / ((c * c) + (d * d))
	tmp = 0
	if c <= -9.6e+94:
		tmp = b / c
	elif c <= -4.1e-84:
		tmp = t_0
	elif c <= 2.5e-66:
		tmp = -a / d
	elif c <= 3.8e+40:
		tmp = t_0
	else:
		tmp = b / c
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(b * c) / Float64(Float64(c * c) + Float64(d * d)))
	tmp = 0.0
	if (c <= -9.6e+94)
		tmp = Float64(b / c);
	elseif (c <= -4.1e-84)
		tmp = t_0;
	elseif (c <= 2.5e-66)
		tmp = Float64(Float64(-a) / d);
	elseif (c <= 3.8e+40)
		tmp = t_0;
	else
		tmp = Float64(b / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (b * c) / ((c * c) + (d * d));
	tmp = 0.0;
	if (c <= -9.6e+94)
		tmp = b / c;
	elseif (c <= -4.1e-84)
		tmp = t_0;
	elseif (c <= 2.5e-66)
		tmp = -a / d;
	elseif (c <= 3.8e+40)
		tmp = t_0;
	else
		tmp = b / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -9.6e+94], N[(b / c), $MachinePrecision], If[LessEqual[c, -4.1e-84], t$95$0, If[LessEqual[c, 2.5e-66], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 3.8e+40], t$95$0, N[(b / c), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\
\mathbf{if}\;c \leq -9.6 \cdot 10^{+94}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq -4.1 \cdot 10^{-84}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 2.5 \cdot 10^{-66}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{elif}\;c \leq 3.8 \cdot 10^{+40}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -9.5999999999999993e94 or 3.80000000000000004e40 < c

    1. Initial program 35.0%

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

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

    if -9.5999999999999993e94 < c < -4.10000000000000005e-84 or 2.49999999999999981e-66 < c < 3.80000000000000004e40

    1. Initial program 90.3%

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative66.7%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} \]
    4. Simplified66.7%

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

    if -4.10000000000000005e-84 < c < 2.49999999999999981e-66

    1. Initial program 66.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/70.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-170.7%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -9.6 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq -4.1 \cdot 10^{-84}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-66}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 3.8 \cdot 10^{+40}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]

Alternative 5: 70.9% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\ t_1 := \frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -24000:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.8 \cdot 10^{-87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{-66}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 3.9 \cdot 10^{+36}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (* b c) (+ (* c c) (* d d))))
        (t_1 (- (/ b c) (* (/ a c) (/ d c)))))
   (if (<= c -24000.0)
     t_1
     (if (<= c -2.8e-87)
       t_0
       (if (<= c 3.2e-66) (/ (- a) d) (if (<= c 3.9e+36) t_0 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = (b * c) / ((c * c) + (d * d));
	double t_1 = (b / c) - ((a / c) * (d / c));
	double tmp;
	if (c <= -24000.0) {
		tmp = t_1;
	} else if (c <= -2.8e-87) {
		tmp = t_0;
	} else if (c <= 3.2e-66) {
		tmp = -a / d;
	} else if (c <= 3.9e+36) {
		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 * c) / ((c * c) + (d * d))
    t_1 = (b / c) - ((a / c) * (d / c))
    if (c <= (-24000.0d0)) then
        tmp = t_1
    else if (c <= (-2.8d-87)) then
        tmp = t_0
    else if (c <= 3.2d-66) then
        tmp = -a / d
    else if (c <= 3.9d+36) 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 * c) / ((c * c) + (d * d));
	double t_1 = (b / c) - ((a / c) * (d / c));
	double tmp;
	if (c <= -24000.0) {
		tmp = t_1;
	} else if (c <= -2.8e-87) {
		tmp = t_0;
	} else if (c <= 3.2e-66) {
		tmp = -a / d;
	} else if (c <= 3.9e+36) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (b * c) / ((c * c) + (d * d))
	t_1 = (b / c) - ((a / c) * (d / c))
	tmp = 0
	if c <= -24000.0:
		tmp = t_1
	elif c <= -2.8e-87:
		tmp = t_0
	elif c <= 3.2e-66:
		tmp = -a / d
	elif c <= 3.9e+36:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(b * c) / Float64(Float64(c * c) + Float64(d * d)))
	t_1 = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c)))
	tmp = 0.0
	if (c <= -24000.0)
		tmp = t_1;
	elseif (c <= -2.8e-87)
		tmp = t_0;
	elseif (c <= 3.2e-66)
		tmp = Float64(Float64(-a) / d);
	elseif (c <= 3.9e+36)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (b * c) / ((c * c) + (d * d));
	t_1 = (b / c) - ((a / c) * (d / c));
	tmp = 0.0;
	if (c <= -24000.0)
		tmp = t_1;
	elseif (c <= -2.8e-87)
		tmp = t_0;
	elseif (c <= 3.2e-66)
		tmp = -a / d;
	elseif (c <= 3.9e+36)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -24000.0], t$95$1, If[LessEqual[c, -2.8e-87], t$95$0, If[LessEqual[c, 3.2e-66], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 3.9e+36], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\
\mathbf{if}\;c \leq -24000:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -2.8 \cdot 10^{-87}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 3.2 \cdot 10^{-66}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{elif}\;c \leq 3.9 \cdot 10^{+36}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -24000 or 3.90000000000000021e36 < c

    1. Initial program 45.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-commutative75.1%

        \[\leadsto -1 \cdot \frac{\color{blue}{d \cdot a}}{{c}^{2}} + \frac{b}{c} \]
      2. unpow275.1%

        \[\leadsto -1 \cdot \frac{d \cdot a}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      3. times-frac86.4%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{d}{c} \cdot \frac{a}{c}\right)} + \frac{b}{c} \]

    if -24000 < c < -2.8000000000000001e-87 or 3.19999999999999982e-66 < c < 3.90000000000000021e36

    1. Initial program 88.3%

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative68.5%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} \]
    4. Simplified68.5%

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

    if -2.8000000000000001e-87 < c < 3.19999999999999982e-66

    1. Initial program 66.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/70.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-170.7%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -24000:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq -2.8 \cdot 10^{-87}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{-66}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 3.9 \cdot 10^{+36}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]

Alternative 6: 71.2% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\ t_1 := \frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -235:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.2 \cdot 10^{-85}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 1.7 \cdot 10^{-67}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.02 \cdot 10^{+37}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (* b c) (+ (* c c) (* d d))))
        (t_1 (- (/ b c) (/ (* d (/ a c)) c))))
   (if (<= c -235.0)
     t_1
     (if (<= c -2.2e-85)
       t_0
       (if (<= c 1.7e-67) (/ (- a) d) (if (<= c 2.02e+37) t_0 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = (b * c) / ((c * c) + (d * d));
	double t_1 = (b / c) - ((d * (a / c)) / c);
	double tmp;
	if (c <= -235.0) {
		tmp = t_1;
	} else if (c <= -2.2e-85) {
		tmp = t_0;
	} else if (c <= 1.7e-67) {
		tmp = -a / d;
	} else if (c <= 2.02e+37) {
		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 * c) / ((c * c) + (d * d))
    t_1 = (b / c) - ((d * (a / c)) / c)
    if (c <= (-235.0d0)) then
        tmp = t_1
    else if (c <= (-2.2d-85)) then
        tmp = t_0
    else if (c <= 1.7d-67) then
        tmp = -a / d
    else if (c <= 2.02d+37) 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 * c) / ((c * c) + (d * d));
	double t_1 = (b / c) - ((d * (a / c)) / c);
	double tmp;
	if (c <= -235.0) {
		tmp = t_1;
	} else if (c <= -2.2e-85) {
		tmp = t_0;
	} else if (c <= 1.7e-67) {
		tmp = -a / d;
	} else if (c <= 2.02e+37) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = (b * c) / ((c * c) + (d * d))
	t_1 = (b / c) - ((d * (a / c)) / c)
	tmp = 0
	if c <= -235.0:
		tmp = t_1
	elif c <= -2.2e-85:
		tmp = t_0
	elif c <= 1.7e-67:
		tmp = -a / d
	elif c <= 2.02e+37:
		tmp = t_0
	else:
		tmp = t_1
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(b * c) / Float64(Float64(c * c) + Float64(d * d)))
	t_1 = Float64(Float64(b / c) - Float64(Float64(d * Float64(a / c)) / c))
	tmp = 0.0
	if (c <= -235.0)
		tmp = t_1;
	elseif (c <= -2.2e-85)
		tmp = t_0;
	elseif (c <= 1.7e-67)
		tmp = Float64(Float64(-a) / d);
	elseif (c <= 2.02e+37)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = (b * c) / ((c * c) + (d * d));
	t_1 = (b / c) - ((d * (a / c)) / c);
	tmp = 0.0;
	if (c <= -235.0)
		tmp = t_1;
	elseif (c <= -2.2e-85)
		tmp = t_0;
	elseif (c <= 1.7e-67)
		tmp = -a / d;
	elseif (c <= 2.02e+37)
		tmp = t_0;
	else
		tmp = t_1;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b * c), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b / c), $MachinePrecision] - N[(N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -235.0], t$95$1, If[LessEqual[c, -2.2e-85], t$95$0, If[LessEqual[c, 1.7e-67], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 2.02e+37], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{b \cdot c}{c \cdot c + d \cdot d}\\
t_1 := \frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\
\mathbf{if}\;c \leq -235:\\
\;\;\;\;t_1\\

\mathbf{elif}\;c \leq -2.2 \cdot 10^{-85}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;c \leq 1.7 \cdot 10^{-67}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{elif}\;c \leq 2.02 \cdot 10^{+37}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -235 or 2.0199999999999999e37 < c

    1. Initial program 45.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity75.1%

        \[\leadsto -1 \cdot \frac{\color{blue}{1 \cdot \left(a \cdot d\right)}}{{c}^{2}} + \frac{b}{c} \]
      2. metadata-eval75.1%

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

        \[\leadsto -1 \cdot \frac{\frac{2}{2} \cdot \left(a \cdot d\right)}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-frac81.5%

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval81.5%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
    5. Step-by-step derivation
      1. associate-*l/81.5%

        \[\leadsto -1 \cdot \color{blue}{\frac{1 \cdot \frac{a \cdot d}{c}}{c}} + \frac{b}{c} \]
      2. *-un-lft-identity81.5%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{a \cdot d}{c}}}{c} + \frac{b}{c} \]
      3. associate-/l*85.8%

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

      \[\leadsto -1 \cdot \color{blue}{\frac{\frac{a}{\frac{c}{d}}}{c}} + \frac{b}{c} \]
    7. Step-by-step derivation
      1. associate-/r/86.6%

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

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

    if -235 < c < -2.2e-85 or 1.70000000000000005e-67 < c < 2.0199999999999999e37

    1. Initial program 88.3%

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{c \cdot c + d \cdot d} \]
    3. Step-by-step derivation
      1. *-commutative68.5%

        \[\leadsto \frac{\color{blue}{c \cdot b}}{c \cdot c + d \cdot d} \]
    4. Simplified68.5%

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

    if -2.2e-85 < c < 1.70000000000000005e-67

    1. Initial program 66.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/70.7%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-170.7%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified70.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -235:\\ \;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -2.2 \cdot 10^{-85}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 1.7 \cdot 10^{-67}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.02 \cdot 10^{+37}:\\ \;\;\;\;\frac{b \cdot c}{c \cdot c + d \cdot d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{d \cdot \frac{a}{c}}{c}\\ \end{array} \]

Alternative 7: 71.1% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -7.2 \cdot 10^{+85} \lor \neg \left(d \leq 1.4 \cdot 10^{+23}\right):\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c} + \frac{a \cdot d}{c} \cdot \frac{-1}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -7.1999999999999996e85 or 1.4e23 < d

    1. Initial program 40.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/68.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-168.0%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified68.0%

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

    if -7.1999999999999996e85 < d < 1.4e23

    1. Initial program 72.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity72.3%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval78.9%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification74.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -7.2 \cdot 10^{+85} \lor \neg \left(d \leq 1.4 \cdot 10^{+23}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} + \frac{a \cdot d}{c} \cdot \frac{-1}{c}\\ \end{array} \]

Alternative 8: 71.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -1.4 \cdot 10^{+86} \lor \neg \left(d \leq 2.35 \cdot 10^{+20}\right):\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c} - \frac{\frac{a}{\frac{c}{d}}}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -1.40000000000000002e86 or 2.35e20 < d

    1. Initial program 40.4%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/68.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-168.0%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified68.0%

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

    if -1.40000000000000002e86 < d < 2.35e20

    1. Initial program 72.0%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    3. Step-by-step derivation
      1. *-un-lft-identity72.3%

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\left(\frac{\frac{2}{2}}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
      5. metadata-eval78.9%

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

      \[\leadsto -1 \cdot \color{blue}{\left(\frac{1}{c} \cdot \frac{a \cdot d}{c}\right)} + \frac{b}{c} \]
    5. Step-by-step derivation
      1. associate-*l/78.8%

        \[\leadsto -1 \cdot \color{blue}{\frac{1 \cdot \frac{a \cdot d}{c}}{c}} + \frac{b}{c} \]
      2. *-un-lft-identity78.8%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{a \cdot d}{c}}}{c} + \frac{b}{c} \]
      3. associate-/l*78.3%

        \[\leadsto -1 \cdot \frac{\color{blue}{\frac{a}{\frac{c}{d}}}}{c} + \frac{b}{c} \]
    6. Applied egg-rr78.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.4 \cdot 10^{+86} \lor \neg \left(d \leq 2.35 \cdot 10^{+20}\right):\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{\frac{a}{\frac{c}{d}}}{c}\\ \end{array} \]

Alternative 9: 63.4% accurate, 1.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.15 \cdot 10^{-83} \lor \neg \left(c \leq 6.4 \cdot 10^{-41}\right):\\
\;\;\;\;\frac{b}{c}\\

\mathbf{else}:\\
\;\;\;\;\frac{-a}{d}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.14999999999999995e-83 or 6.40000000000000024e-41 < c

    1. Initial program 55.3%

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

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

    if -1.14999999999999995e-83 < c < 6.40000000000000024e-41

    1. Initial program 67.7%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    3. Step-by-step derivation
      1. associate-*r/69.0%

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. neg-mul-169.0%

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    4. Simplified69.0%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1.15 \cdot 10^{-83} \lor \neg \left(c \leq 6.4 \cdot 10^{-41}\right):\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]

Alternative 10: 9.8% accurate, 5.0× speedup?

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

\\
\frac{a}{c}
\end{array}
Derivation
  1. Initial program 60.4%

    \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
  2. Step-by-step derivation
    1. frac-2neg60.4%

      \[\leadsto \color{blue}{\frac{-\left(b \cdot c - a \cdot d\right)}{-\left(c \cdot c + d \cdot d\right)}} \]
    2. div-inv60.3%

      \[\leadsto \color{blue}{\left(-\left(b \cdot c - a \cdot d\right)\right) \cdot \frac{1}{-\left(c \cdot c + d \cdot d\right)}} \]
  3. Applied egg-rr60.3%

    \[\leadsto \color{blue}{\left(a \cdot d - b \cdot c\right) \cdot \frac{1}{-{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
  4. Step-by-step derivation
    1. *-commutative60.3%

      \[\leadsto \left(a \cdot d - \color{blue}{c \cdot b}\right) \cdot \frac{1}{-{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \]
    2. neg-mul-160.3%

      \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \frac{1}{\color{blue}{-1 \cdot {\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    3. associate-/r*60.3%

      \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \color{blue}{\frac{\frac{1}{-1}}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    4. metadata-eval60.3%

      \[\leadsto \left(a \cdot d - c \cdot b\right) \cdot \frac{\color{blue}{-1}}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}} \]
  5. Simplified60.3%

    \[\leadsto \color{blue}{\left(a \cdot d - c \cdot b\right) \cdot \frac{-1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
  6. Step-by-step derivation
    1. associate-*r/60.4%

      \[\leadsto \color{blue}{\frac{\left(a \cdot d - c \cdot b\right) \cdot -1}{{\left(\mathsf{hypot}\left(c, d\right)\right)}^{2}}} \]
    2. unpow260.4%

      \[\leadsto \frac{\left(a \cdot d - c \cdot b\right) \cdot -1}{\color{blue}{\mathsf{hypot}\left(c, d\right) \cdot \mathsf{hypot}\left(c, d\right)}} \]
    3. associate-/r*77.5%

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

      \[\leadsto \frac{\frac{\color{blue}{\mathsf{fma}\left(a, d, -c \cdot b\right)} \cdot -1}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)} \]
    5. distribute-rgt-neg-in77.5%

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

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\color{blue}{\sqrt{c \cdot c + d \cdot d}}}}{\mathsf{hypot}\left(c, d\right)} \]
    7. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{{c}^{2}} + d \cdot d}}}{\mathsf{hypot}\left(c, d\right)} \]
    8. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{{c}^{2} + \color{blue}{{d}^{2}}}}}{\mathsf{hypot}\left(c, d\right)} \]
    9. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{c \cdot c} + {d}^{2}}}}{\mathsf{hypot}\left(c, d\right)} \]
    10. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{c \cdot c + \color{blue}{d \cdot d}}}}{\mathsf{hypot}\left(c, d\right)} \]
    11. +-commutative60.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\sqrt{\color{blue}{d \cdot d + c \cdot c}}}}{\mathsf{hypot}\left(c, d\right)} \]
    12. hypot-def77.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\color{blue}{\mathsf{hypot}\left(d, c\right)}}}{\mathsf{hypot}\left(c, d\right)} \]
    13. hypot-udef60.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\color{blue}{\sqrt{c \cdot c + d \cdot d}}} \]
    14. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{\color{blue}{{c}^{2}} + d \cdot d}} \]
    15. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{{c}^{2} + \color{blue}{{d}^{2}}}} \]
    16. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{\color{blue}{c \cdot c} + {d}^{2}}} \]
    17. unpow260.5%

      \[\leadsto \frac{\frac{\mathsf{fma}\left(a, d, c \cdot \left(-b\right)\right) \cdot -1}{\mathsf{hypot}\left(d, c\right)}}{\sqrt{c \cdot c + \color{blue}{d \cdot d}}} \]
  7. Applied egg-rr77.5%

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

    \[\leadsto \frac{\color{blue}{-1 \cdot b + \frac{a \cdot d}{c}}}{\mathsf{hypot}\left(d, c\right)} \]
  9. Taylor expanded in d around inf 11.6%

    \[\leadsto \color{blue}{\frac{a}{c}} \]
  10. Final simplification11.6%

    \[\leadsto \frac{a}{c} \]

Alternative 11: 42.3% accurate, 5.0× speedup?

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

\\
\frac{b}{c}
\end{array}
Derivation
  1. Initial program 60.4%

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

    \[\leadsto \color{blue}{\frac{b}{c}} \]
  3. Final simplification43.6%

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

Developer target: 99.2% accurate, 0.1× 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 2023305 
(FPCore (a b c d)
  :name "Complex division, imag part"
  :precision binary64

  :herbie-target
  (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))))