Complex division, imag part

Percentage Accurate: 62.0% → 80.5%
Time: 12.6s
Alternatives: 10
Speedup: 1.1×

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

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

Initial Program: 62.0% accurate, 1.0× speedup?

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

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

Alternative 1: 80.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.1 \cdot 10^{+139}:\\ \;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\ \mathbf{elif}\;c \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 7.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + d \cdot \left(a \cdot \frac{-1}{c}\right)}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -2.1e+139)
   (/ (- b (/ a (/ c d))) c)
   (if (<= c -7.2e-54)
     (/ (- (* c b) (* a d)) (+ (* c c) (* d d)))
     (if (<= c 7.2e+15)
       (/ (- (/ b (/ d c)) a) d)
       (/ (+ b (* d (* a (/ -1.0 c)))) c)))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -2.1e+139) {
		tmp = (b - (a / (c / d))) / c;
	} else if (c <= -7.2e-54) {
		tmp = ((c * b) - (a * d)) / ((c * c) + (d * d));
	} else if (c <= 7.2e+15) {
		tmp = ((b / (d / c)) - a) / d;
	} else {
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: tmp
    if (c <= (-2.1d+139)) then
        tmp = (b - (a / (c / d))) / c
    else if (c <= (-7.2d-54)) then
        tmp = ((c * b) - (a * d)) / ((c * c) + (d * d))
    else if (c <= 7.2d+15) then
        tmp = ((b / (d / c)) - a) / d
    else
        tmp = (b + (d * (a * ((-1.0d0) / c)))) / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -2.1e+139) {
		tmp = (b - (a / (c / d))) / c;
	} else if (c <= -7.2e-54) {
		tmp = ((c * b) - (a * d)) / ((c * c) + (d * d));
	} else if (c <= 7.2e+15) {
		tmp = ((b / (d / c)) - a) / d;
	} else {
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -2.1e+139:
		tmp = (b - (a / (c / d))) / c
	elif c <= -7.2e-54:
		tmp = ((c * b) - (a * d)) / ((c * c) + (d * d))
	elif c <= 7.2e+15:
		tmp = ((b / (d / c)) - a) / d
	else:
		tmp = (b + (d * (a * (-1.0 / c)))) / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -2.1e+139)
		tmp = Float64(Float64(b - Float64(a / Float64(c / d))) / c);
	elseif (c <= -7.2e-54)
		tmp = Float64(Float64(Float64(c * b) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)));
	elseif (c <= 7.2e+15)
		tmp = Float64(Float64(Float64(b / Float64(d / c)) - a) / d);
	else
		tmp = Float64(Float64(b + Float64(d * Float64(a * Float64(-1.0 / c)))) / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -2.1e+139)
		tmp = (b - (a / (c / d))) / c;
	elseif (c <= -7.2e-54)
		tmp = ((c * b) - (a * d)) / ((c * c) + (d * d));
	elseif (c <= 7.2e+15)
		tmp = ((b / (d / c)) - a) / d;
	else
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -2.1e+139], N[(N[(b - N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -7.2e-54], N[(N[(N[(c * b), $MachinePrecision] - N[(a * d), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 7.2e+15], N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b + N[(d * N[(a * N[(-1.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.1 \cdot 10^{+139}:\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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

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

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


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

    1. Initial program 31.1%

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

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

        \[\leadsto \frac{b + \color{blue}{\left(-\frac{a \cdot d}{c}\right)}}{c} \]
      2. unsub-neg89.0%

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv95.6%

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    7. Applied egg-rr95.6%

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

    if -2.0999999999999999e139 < c < -7.19999999999999953e-54

    1. Initial program 79.6%

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

    if -7.19999999999999953e-54 < c < 7.2e15

    1. Initial program 70.6%

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

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

        \[\leadsto \color{blue}{-\frac{a + -1 \cdot \frac{b \cdot c}{d}}{d}} \]
      2. distribute-neg-frac286.0%

        \[\leadsto \color{blue}{\frac{a + -1 \cdot \frac{b \cdot c}{d}}{-d}} \]
      3. mul-1-neg86.0%

        \[\leadsto \frac{a + \color{blue}{\left(-\frac{b \cdot c}{d}\right)}}{-d} \]
      4. unsub-neg86.0%

        \[\leadsto \frac{\color{blue}{a - \frac{b \cdot c}{d}}}{-d} \]
      5. associate-/l*86.0%

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

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

        \[\leadsto \frac{a - b \cdot \color{blue}{\frac{1}{\frac{d}{c}}}}{-d} \]
      2. un-div-inv86.1%

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

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

    if 7.2e15 < c

    1. Initial program 43.6%

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

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

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

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

        \[\leadsto \frac{b + -1 \cdot \left(\color{blue}{\left(d \cdot \frac{1}{c}\right)} \cdot a\right)}{c} \]
      4. associate-*l*86.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.1 \cdot 10^{+139}:\\ \;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\ \mathbf{elif}\;c \leq -7.2 \cdot 10^{-54}:\\ \;\;\;\;\frac{c \cdot b - a \cdot d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 7.2 \cdot 10^{+15}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + d \cdot \left(a \cdot \frac{-1}{c}\right)}{c}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 78.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -41000000:\\ \;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\ \mathbf{elif}\;c \leq 4.4 \cdot 10^{+15}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + d \cdot \left(a \cdot \frac{-1}{c}\right)}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -41000000.0)
   (/ (- b (/ a (/ c d))) c)
   (if (<= c 4.4e+15)
     (/ (- (/ b (/ d c)) a) d)
     (/ (+ b (* d (* a (/ -1.0 c)))) c))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -41000000.0) {
		tmp = (b - (a / (c / d))) / c;
	} else if (c <= 4.4e+15) {
		tmp = ((b / (d / c)) - a) / d;
	} else {
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: tmp
    if (c <= (-41000000.0d0)) then
        tmp = (b - (a / (c / d))) / c
    else if (c <= 4.4d+15) then
        tmp = ((b / (d / c)) - a) / d
    else
        tmp = (b + (d * (a * ((-1.0d0) / c)))) / c
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -41000000.0) {
		tmp = (b - (a / (c / d))) / c;
	} else if (c <= 4.4e+15) {
		tmp = ((b / (d / c)) - a) / d;
	} else {
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if c <= -41000000.0:
		tmp = (b - (a / (c / d))) / c
	elif c <= 4.4e+15:
		tmp = ((b / (d / c)) - a) / d
	else:
		tmp = (b + (d * (a * (-1.0 / c)))) / c
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -41000000.0)
		tmp = Float64(Float64(b - Float64(a / Float64(c / d))) / c);
	elseif (c <= 4.4e+15)
		tmp = Float64(Float64(Float64(b / Float64(d / c)) - a) / d);
	else
		tmp = Float64(Float64(b + Float64(d * Float64(a * Float64(-1.0 / c)))) / c);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (c <= -41000000.0)
		tmp = (b - (a / (c / d))) / c;
	elseif (c <= 4.4e+15)
		tmp = ((b / (d / c)) - a) / d;
	else
		tmp = (b + (d * (a * (-1.0 / c)))) / c;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[c, -41000000.0], N[(N[(b - N[(a / N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, 4.4e+15], N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], N[(N[(b + N[(d * N[(a * N[(-1.0 / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -41000000:\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -4.1e7

    1. Initial program 50.5%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.8%

        \[\leadsto \frac{b + \color{blue}{\left(-\frac{a \cdot d}{c}\right)}}{c} \]
      2. unsub-neg78.8%

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv82.6%

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    7. Applied egg-rr82.6%

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

    if -4.1e7 < c < 4.4e15

    1. Initial program 72.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a + -1 \cdot \frac{b \cdot c}{d}}{d}} \]
    4. Step-by-step derivation
      1. mul-1-neg84.1%

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

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

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

        \[\leadsto \frac{\color{blue}{a - \frac{b \cdot c}{d}}}{-d} \]
      5. associate-/l*84.2%

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

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

        \[\leadsto \frac{a - b \cdot \color{blue}{\frac{1}{\frac{d}{c}}}}{-d} \]
      2. un-div-inv84.2%

        \[\leadsto \frac{a - \color{blue}{\frac{b}{\frac{d}{c}}}}{-d} \]
    7. Applied egg-rr84.2%

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

    if 4.4e15 < c

    1. Initial program 43.6%

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

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

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

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

        \[\leadsto \frac{b + -1 \cdot \left(\color{blue}{\left(d \cdot \frac{1}{c}\right)} \cdot a\right)}{c} \]
      4. associate-*l*86.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -41000000:\\ \;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\ \mathbf{elif}\;c \leq 4.4 \cdot 10^{+15}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + d \cdot \left(a \cdot \frac{-1}{c}\right)}{c}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.4% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -11600 \lor \neg \left(c \leq 2.9 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -11600 or 2.9e17 < c

    1. Initial program 47.7%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.9%

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

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv84.1%

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    7. Applied egg-rr84.1%

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

    if -11600 < c < 2.9e17

    1. Initial program 72.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a + -1 \cdot \frac{b \cdot c}{d}}{d}} \]
    4. Step-by-step derivation
      1. mul-1-neg84.1%

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

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

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

        \[\leadsto \frac{\color{blue}{a - \frac{b \cdot c}{d}}}{-d} \]
      5. associate-/l*84.2%

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

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

        \[\leadsto \frac{a - b \cdot \color{blue}{\frac{1}{\frac{d}{c}}}}{-d} \]
      2. un-div-inv84.2%

        \[\leadsto \frac{a - \color{blue}{\frac{b}{\frac{d}{c}}}}{-d} \]
    7. Applied egg-rr84.2%

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

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

Alternative 4: 78.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -112000000 \lor \neg \left(c \leq 3.5 \cdot 10^{+17}\right):\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.12e8 or 3.5e17 < c

    1. Initial program 47.7%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.9%

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

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv84.1%

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    7. Applied egg-rr84.1%

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

    if -1.12e8 < c < 3.5e17

    1. Initial program 72.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a + -1 \cdot \frac{b \cdot c}{d}}{d}} \]
    4. Step-by-step derivation
      1. mul-1-neg84.1%

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

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

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

        \[\leadsto \frac{\color{blue}{a - \frac{b \cdot c}{d}}}{-d} \]
      5. associate-/l*84.2%

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

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

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

Alternative 5: 77.5% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -135000 \lor \neg \left(c \leq 2.5 \cdot 10^{+16}\right):\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -135000 or 2.5e16 < c

    1. Initial program 47.7%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg78.9%

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

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv84.1%

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    7. Applied egg-rr84.1%

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

    if -135000 < c < 2.5e16

    1. Initial program 72.2%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a + -1 \cdot \frac{b \cdot c}{d}}{d}} \]
    4. Step-by-step derivation
      1. mul-1-neg84.1%

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

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

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

        \[\leadsto \frac{\color{blue}{a - \frac{b \cdot c}{d}}}{-d} \]
      5. associate-/l*84.2%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d}} - a}{d} \]
      6. *-commutative84.1%

        \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
      7. associate-/l*82.6%

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

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

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

Alternative 6: 69.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -9 \cdot 10^{-73} \lor \neg \left(c \leq 6500\right):\\
\;\;\;\;\frac{b - \frac{a}{\frac{c}{d}}}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -9e-73 or 6500 < c

    1. Initial program 51.7%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg75.8%

        \[\leadsto \frac{b + \color{blue}{\left(-\frac{a \cdot d}{c}\right)}}{c} \]
      2. unsub-neg75.8%

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

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

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

        \[\leadsto \frac{b - a \cdot \color{blue}{\frac{1}{\frac{c}{d}}}}{c} \]
      2. un-div-inv80.5%

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

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

    if -9e-73 < c < 6500

    1. Initial program 70.2%

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

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

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

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

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

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

Alternative 7: 69.7% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.35 \cdot 10^{-72} \lor \neg \left(c \leq 2600\right):\\
\;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.35e-72 or 2600 < c

    1. Initial program 51.7%

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

      \[\leadsto \color{blue}{\frac{b + -1 \cdot \frac{a \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. mul-1-neg75.8%

        \[\leadsto \frac{b + \color{blue}{\left(-\frac{a \cdot d}{c}\right)}}{c} \]
      2. unsub-neg75.8%

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

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

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

    if -1.35e-72 < c < 2600

    1. Initial program 70.2%

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

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

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

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

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

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

Alternative 8: 62.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.06 \cdot 10^{-94} \lor \neg \left(c \leq 480000\right):\\
\;\;\;\;\frac{b}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -1.06e-94 or 4.8e5 < c

    1. Initial program 52.6%

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

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

    if -1.06e-94 < c < 4.8e5

    1. Initial program 69.7%

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Simplified74.5%

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

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

Alternative 9: 46.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -8.8 \cdot 10^{+178} \lor \neg \left(d \leq 4.7 \cdot 10^{+120}\right):\\
\;\;\;\;\frac{a}{d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -8.79999999999999989e178 or 4.69999999999999993e120 < d

    1. Initial program 43.2%

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Simplified87.3%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
    6. Step-by-step derivation
      1. neg-sub087.3%

        \[\leadsto \frac{\color{blue}{0 - a}}{d} \]
      2. sub-neg87.3%

        \[\leadsto \frac{\color{blue}{0 + \left(-a\right)}}{d} \]
      3. add-sqr-sqrt46.0%

        \[\leadsto \frac{0 + \color{blue}{\sqrt{-a} \cdot \sqrt{-a}}}{d} \]
      4. sqrt-unprod52.3%

        \[\leadsto \frac{0 + \color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}}}{d} \]
      5. sqr-neg52.3%

        \[\leadsto \frac{0 + \sqrt{\color{blue}{a \cdot a}}}{d} \]
      6. sqrt-unprod14.9%

        \[\leadsto \frac{0 + \color{blue}{\sqrt{a} \cdot \sqrt{a}}}{d} \]
      7. add-sqr-sqrt43.9%

        \[\leadsto \frac{0 + \color{blue}{a}}{d} \]
    7. Applied egg-rr43.9%

      \[\leadsto \frac{\color{blue}{0 + a}}{d} \]
    8. Step-by-step derivation
      1. +-lft-identity43.9%

        \[\leadsto \frac{\color{blue}{a}}{d} \]
    9. Simplified43.9%

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

    if -8.79999999999999989e178 < d < 4.69999999999999993e120

    1. Initial program 65.6%

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

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

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

Alternative 10: 11.2% accurate, 5.0× speedup?

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

\\
\frac{a}{d}
\end{array}
Derivation
  1. Initial program 59.6%

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

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

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

      \[\leadsto \frac{\color{blue}{-a}}{d} \]
  5. Simplified42.5%

    \[\leadsto \color{blue}{\frac{-a}{d}} \]
  6. Step-by-step derivation
    1. neg-sub042.5%

      \[\leadsto \frac{\color{blue}{0 - a}}{d} \]
    2. sub-neg42.5%

      \[\leadsto \frac{\color{blue}{0 + \left(-a\right)}}{d} \]
    3. add-sqr-sqrt20.8%

      \[\leadsto \frac{0 + \color{blue}{\sqrt{-a} \cdot \sqrt{-a}}}{d} \]
    4. sqrt-unprod23.1%

      \[\leadsto \frac{0 + \color{blue}{\sqrt{\left(-a\right) \cdot \left(-a\right)}}}{d} \]
    5. sqr-neg23.1%

      \[\leadsto \frac{0 + \sqrt{\color{blue}{a \cdot a}}}{d} \]
    6. sqrt-unprod5.9%

      \[\leadsto \frac{0 + \color{blue}{\sqrt{a} \cdot \sqrt{a}}}{d} \]
    7. add-sqr-sqrt14.4%

      \[\leadsto \frac{0 + \color{blue}{a}}{d} \]
  7. Applied egg-rr14.4%

    \[\leadsto \frac{\color{blue}{0 + a}}{d} \]
  8. Step-by-step derivation
    1. +-lft-identity14.4%

      \[\leadsto \frac{\color{blue}{a}}{d} \]
  9. Simplified14.4%

    \[\leadsto \frac{\color{blue}{a}}{d} \]
  10. Add Preprocessing

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

  :alt
  (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))))