Complex division, imag part

Percentage Accurate: 63.0% → 81.9%
Time: 10.3s
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: 63.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: 81.9% accurate, 0.1× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.8000000000000001e78 or 5.19999999999999965e-12 < d

    1. Initial program 44.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8000000000000001e78 < d < -6.59999999999999997e-152

    1. Initial program 79.6%

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

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

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

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

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

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

    if -6.59999999999999997e-152 < d < 5.19999999999999965e-12

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{a \cdot \frac{d}{c}}}{c} \]
    7. Simplified90.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.8 \cdot 10^{+78}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-152}:\\ \;\;\;\;\frac{\mathsf{fma}\left(b, c, d \cdot \left(-a\right)\right)}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;d \leq 5.2 \cdot 10^{-12}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 81.9% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{if}\;d \leq -1.48 \cdot 10^{+78}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -3.4 \cdot 10^{-152}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 6.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- (* c (/ b d)) a) d)))
   (if (<= d -1.48e+78)
     t_0
     (if (<= d -3.4e-152)
       (/ (- (* c b) (* d a)) (+ (* c c) (* d d)))
       (if (<= d 6.5e-12) (/ (- b (* a (/ d c))) c) t_0)))))
double code(double a, double b, double c, double d) {
	double t_0 = ((c * (b / d)) - a) / d;
	double tmp;
	if (d <= -1.48e+78) {
		tmp = t_0;
	} else if (d <= -3.4e-152) {
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	} else if (d <= 6.5e-12) {
		tmp = (b - (a * (d / c))) / c;
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    real(8) :: t_0
    real(8) :: tmp
    t_0 = ((c * (b / d)) - a) / d
    if (d <= (-1.48d+78)) then
        tmp = t_0
    else if (d <= (-3.4d-152)) then
        tmp = ((c * b) - (d * a)) / ((c * c) + (d * d))
    else if (d <= 6.5d-12) then
        tmp = (b - (a * (d / c))) / c
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double a, double b, double c, double d) {
	double t_0 = ((c * (b / d)) - a) / d;
	double tmp;
	if (d <= -1.48e+78) {
		tmp = t_0;
	} else if (d <= -3.4e-152) {
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	} else if (d <= 6.5e-12) {
		tmp = (b - (a * (d / c))) / c;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(a, b, c, d):
	t_0 = ((c * (b / d)) - a) / d
	tmp = 0
	if d <= -1.48e+78:
		tmp = t_0
	elif d <= -3.4e-152:
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d))
	elif d <= 6.5e-12:
		tmp = (b - (a * (d / c))) / c
	else:
		tmp = t_0
	return tmp
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(c * Float64(b / d)) - a) / d)
	tmp = 0.0
	if (d <= -1.48e+78)
		tmp = t_0;
	elseif (d <= -3.4e-152)
		tmp = Float64(Float64(Float64(c * b) - Float64(d * a)) / Float64(Float64(c * c) + Float64(d * d)));
	elseif (d <= 6.5e-12)
		tmp = Float64(Float64(b - Float64(a * Float64(d / c))) / c);
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	t_0 = ((c * (b / d)) - a) / d;
	tmp = 0.0;
	if (d <= -1.48e+78)
		tmp = t_0;
	elseif (d <= -3.4e-152)
		tmp = ((c * b) - (d * a)) / ((c * c) + (d * d));
	elseif (d <= 6.5e-12)
		tmp = (b - (a * (d / c))) / c;
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(c * N[(b / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision]}, If[LessEqual[d, -1.48e+78], t$95$0, If[LessEqual[d, -3.4e-152], N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(N[(c * c), $MachinePrecision] + N[(d * d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 6.5e-12], N[(N[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if d < -1.47999999999999998e78 or 6.5000000000000002e-12 < d

    1. Initial program 44.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.47999999999999998e78 < d < -3.39999999999999984e-152

    1. Initial program 79.6%

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

    if -3.39999999999999984e-152 < d < 6.5000000000000002e-12

    1. Initial program 66.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{b - \color{blue}{a \cdot \frac{d}{c}}}{c} \]
    7. Simplified90.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -1.48 \cdot 10^{+78}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \mathbf{elif}\;d \leq -3.4 \cdot 10^{-152}:\\ \;\;\;\;\frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 6.5 \cdot 10^{-12}:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{c \cdot \frac{b}{d} - a}{d}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 78.6% accurate, 0.8× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -2.75000000000000011e-41 or 6.4000000000000002e-12 < d

    1. Initial program 49.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube44.2%

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

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

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

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

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

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

      \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{{\left({c}^{6}\right)}^{0.3333333333333333}} + d \cdot d} \]
    5. Taylor expanded in d around inf 76.2%

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

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

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

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

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

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

    if -2.75000000000000011e-41 < d < 6.4000000000000002e-12

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    8. Taylor expanded in a around 0 83.1%

      \[\leadsto \frac{b - \color{blue}{\frac{a \cdot d}{c}}}{c} \]
    9. Step-by-step derivation
      1. associate-*l/83.4%

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

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    10. Simplified84.1%

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

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

Alternative 4: 73.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -8 \lor \neg \left(d \leq 1.6 \cdot 10^{+73}\right):\\
\;\;\;\;\frac{a}{-d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -8 or 1.59999999999999991e73 < d

    1. Initial program 43.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    7. Simplified71.3%

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

    if -8 < d < 1.59999999999999991e73

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    8. Taylor expanded in a around 0 75.5%

      \[\leadsto \frac{b - \color{blue}{\frac{a \cdot d}{c}}}{c} \]
    9. Step-by-step derivation
      1. associate-*l/76.2%

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

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    10. Simplified76.9%

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

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

Alternative 5: 73.6% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;d \leq -0.00125 \lor \neg \left(d \leq 2.1 \cdot 10^{+73}\right):\\
\;\;\;\;\frac{a}{-d}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < -0.00125000000000000003 or 2.1000000000000001e73 < d

    1. Initial program 43.1%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    7. Simplified71.3%

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

    if -0.00125000000000000003 < d < 2.1000000000000001e73

    1. Initial program 69.8%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 78.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.06 \cdot 10^{-42}:\\ \;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{-12}:\\ \;\;\;\;\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 (<= d -1.06e-42)
   (/ (- (/ b (/ d c)) a) d)
   (if (<= d 6.2e-12) (/ (- b (/ a (/ c d))) c) (/ (- (* c (/ b d)) a) d))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (d <= -1.06e-42) {
		tmp = ((b / (d / c)) - a) / d;
	} else if (d <= 6.2e-12) {
		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 (d <= (-1.06d-42)) then
        tmp = ((b / (d / c)) - a) / d
    else if (d <= 6.2d-12) 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 (d <= -1.06e-42) {
		tmp = ((b / (d / c)) - a) / d;
	} else if (d <= 6.2e-12) {
		tmp = (b - (a / (c / d))) / c;
	} else {
		tmp = ((c * (b / d)) - a) / d;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if d <= -1.06e-42:
		tmp = ((b / (d / c)) - a) / d
	elif d <= 6.2e-12:
		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 (d <= -1.06e-42)
		tmp = Float64(Float64(Float64(b / Float64(d / c)) - a) / d);
	elseif (d <= 6.2e-12)
		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 (d <= -1.06e-42)
		tmp = ((b / (d / c)) - a) / d;
	elseif (d <= 6.2e-12)
		tmp = (b - (a / (c / d))) / c;
	else
		tmp = ((c * (b / d)) - a) / d;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[d, -1.06e-42], N[(N[(N[(b / N[(d / c), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, 6.2e-12], 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}\;d \leq -1.06 \cdot 10^{-42}:\\
\;\;\;\;\frac{\frac{b}{\frac{d}{c}} - a}{d}\\

\mathbf{elif}\;d \leq 6.2 \cdot 10^{-12}:\\
\;\;\;\;\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 3 regimes
  2. if d < -1.0600000000000001e-42

    1. Initial program 42.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube40.9%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\color{blue}{\left({\left(c \cdot c\right)}^{3}\right)}}^{0.3333333333333333} + d \cdot d} \]
      4. pow240.8%

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\left({\color{blue}{\left({c}^{2}\right)}}^{3}\right)}^{0.3333333333333333} + d \cdot d} \]
      5. pow-pow40.8%

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\left({c}^{\color{blue}{6}}\right)}^{0.3333333333333333} + d \cdot d} \]
    4. Applied egg-rr40.8%

      \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{{\left({c}^{6}\right)}^{0.3333333333333333}} + d \cdot d} \]
    5. Taylor expanded in d around inf 74.9%

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\frac{b}{\frac{d}{c}}} - a}{d} \]
    9. Applied egg-rr76.8%

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

    if -1.0600000000000001e-42 < d < 6.2000000000000002e-12

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    8. Taylor expanded in a around 0 83.1%

      \[\leadsto \frac{b - \color{blue}{\frac{a \cdot d}{c}}}{c} \]
    9. Step-by-step derivation
      1. associate-*l/83.4%

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

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    10. Simplified84.1%

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

    if 6.2000000000000002e-12 < d

    1. Initial program 54.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. unpow273.2%

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
      6. div-sub77.3%

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
      7. *-commutative77.3%

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

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

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

Alternative 7: 78.8% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq -1.12 \cdot 10^{-41}:\\ \;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\ \mathbf{elif}\;d \leq 5.2 \cdot 10^{-12}:\\ \;\;\;\;\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 (<= d -1.12e-41)
   (/ (- (* b (/ c d)) a) d)
   (if (<= d 5.2e-12) (/ (- b (/ a (/ c d))) c) (/ (- (* c (/ b d)) a) d))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (d <= -1.12e-41) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (d <= 5.2e-12) {
		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 (d <= (-1.12d-41)) then
        tmp = ((b * (c / d)) - a) / d
    else if (d <= 5.2d-12) 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 (d <= -1.12e-41) {
		tmp = ((b * (c / d)) - a) / d;
	} else if (d <= 5.2e-12) {
		tmp = (b - (a / (c / d))) / c;
	} else {
		tmp = ((c * (b / d)) - a) / d;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if d <= -1.12e-41:
		tmp = ((b * (c / d)) - a) / d
	elif d <= 5.2e-12:
		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 (d <= -1.12e-41)
		tmp = Float64(Float64(Float64(b * Float64(c / d)) - a) / d);
	elseif (d <= 5.2e-12)
		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 (d <= -1.12e-41)
		tmp = ((b * (c / d)) - a) / d;
	elseif (d <= 5.2e-12)
		tmp = (b - (a / (c / d))) / c;
	else
		tmp = ((c * (b / d)) - a) / d;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[d, -1.12e-41], N[(N[(N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[d, 5.2e-12], 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}\;d \leq -1.12 \cdot 10^{-41}:\\
\;\;\;\;\frac{b \cdot \frac{c}{d} - a}{d}\\

\mathbf{elif}\;d \leq 5.2 \cdot 10^{-12}:\\
\;\;\;\;\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 3 regimes
  2. if d < -1.11999999999999999e-41

    1. Initial program 42.7%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. add-cbrt-cube40.9%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\color{blue}{\left({\left(c \cdot c\right)}^{3}\right)}}^{0.3333333333333333} + d \cdot d} \]
      4. pow240.8%

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\left({\color{blue}{\left({c}^{2}\right)}}^{3}\right)}^{0.3333333333333333} + d \cdot d} \]
      5. pow-pow40.8%

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{{\left({c}^{\color{blue}{6}}\right)}^{0.3333333333333333} + d \cdot d} \]
    4. Applied egg-rr40.8%

      \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{{\left({c}^{6}\right)}^{0.3333333333333333}} + d \cdot d} \]
    5. Taylor expanded in d around inf 74.9%

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

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

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

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

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

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

    if -1.11999999999999999e-41 < d < 5.19999999999999965e-12

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{b - a \cdot \frac{d}{c}}{c}} \]
    8. Taylor expanded in a around 0 83.1%

      \[\leadsto \frac{b - \color{blue}{\frac{a \cdot d}{c}}}{c} \]
    9. Step-by-step derivation
      1. associate-*l/83.4%

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

        \[\leadsto \frac{b - \color{blue}{\frac{a}{\frac{c}{d}}}}{c} \]
    10. Simplified84.1%

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

    if 5.19999999999999965e-12 < d

    1. Initial program 54.7%

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. unpow273.2%

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
      6. div-sub77.3%

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
      7. *-commutative77.3%

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

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

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

Alternative 8: 63.4% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -8 \cdot 10^{+19} \lor \neg \left(c \leq 1.04 \cdot 10^{+71}\right):\\
\;\;\;\;\frac{b}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if c < -8e19 or 1.04e71 < c

    1. Initial program 46.5%

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

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

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

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

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

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

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

    if -8e19 < c < 1.04e71

    1. Initial program 69.7%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    7. Simplified63.0%

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

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

Alternative 9: 45.3% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;d \leq 1.18 \cdot 10^{+131}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{d}\\ \end{array} \end{array} \]
(FPCore (a b c d) :precision binary64 (if (<= d 1.18e+131) (/ b c) (/ a d)))
double code(double a, double b, double c, double d) {
	double tmp;
	if (d <= 1.18e+131) {
		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 (d <= 1.18d+131) 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 (d <= 1.18e+131) {
		tmp = b / c;
	} else {
		tmp = a / d;
	}
	return tmp;
}
def code(a, b, c, d):
	tmp = 0
	if d <= 1.18e+131:
		tmp = b / c
	else:
		tmp = a / d
	return tmp
function code(a, b, c, d)
	tmp = 0.0
	if (d <= 1.18e+131)
		tmp = Float64(b / c);
	else
		tmp = Float64(a / d);
	end
	return tmp
end
function tmp_2 = code(a, b, c, d)
	tmp = 0.0;
	if (d <= 1.18e+131)
		tmp = b / c;
	else
		tmp = a / d;
	end
	tmp_2 = tmp;
end
code[a_, b_, c_, d_] := If[LessEqual[d, 1.18e+131], N[(b / c), $MachinePrecision], N[(a / d), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;d \leq 1.18 \cdot 10^{+131}:\\
\;\;\;\;\frac{b}{c}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if d < 1.18e131

    1. Initial program 63.1%

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

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

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

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

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

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

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

    if 1.18e131 < d

    1. Initial program 37.7%

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    7. Simplified77.2%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]
    8. Step-by-step derivation
      1. *-un-lft-identity77.2%

        \[\leadsto \color{blue}{1 \cdot \frac{-a}{d}} \]
      2. *-commutative77.2%

        \[\leadsto \color{blue}{\frac{-a}{d} \cdot 1} \]
      3. add-sqr-sqrt41.6%

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

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

        \[\leadsto \frac{\sqrt{\color{blue}{a \cdot a}}}{d} \cdot 1 \]
      6. sqrt-unprod13.6%

        \[\leadsto \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{d} \cdot 1 \]
      7. add-sqr-sqrt28.1%

        \[\leadsto \frac{\color{blue}{a}}{d} \cdot 1 \]
    9. Applied egg-rr28.1%

      \[\leadsto \color{blue}{\frac{a}{d} \cdot 1} \]
    10. Step-by-step derivation
      1. *-rgt-identity28.1%

        \[\leadsto \color{blue}{\frac{a}{d}} \]
    11. Simplified28.1%

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

Alternative 10: 11.3% 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. Step-by-step derivation
    1. fma-neg59.6%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\frac{-a}{d}} \]
  8. Step-by-step derivation
    1. *-un-lft-identity42.0%

      \[\leadsto \color{blue}{1 \cdot \frac{-a}{d}} \]
    2. *-commutative42.0%

      \[\leadsto \color{blue}{\frac{-a}{d} \cdot 1} \]
    3. add-sqr-sqrt21.1%

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

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

      \[\leadsto \frac{\sqrt{\color{blue}{a \cdot a}}}{d} \cdot 1 \]
    6. sqrt-unprod4.6%

      \[\leadsto \frac{\color{blue}{\sqrt{a} \cdot \sqrt{a}}}{d} \cdot 1 \]
    7. add-sqr-sqrt8.8%

      \[\leadsto \frac{\color{blue}{a}}{d} \cdot 1 \]
  9. Applied egg-rr8.8%

    \[\leadsto \color{blue}{\frac{a}{d} \cdot 1} \]
  10. Step-by-step derivation
    1. *-rgt-identity8.8%

      \[\leadsto \color{blue}{\frac{a}{d}} \]
  11. Simplified8.8%

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

Developer Target 1: 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 2024137 
(FPCore (a b c d)
  :name "Complex division, imag part"
  :precision binary64

  :alt
  (! :herbie-platform default (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))

  (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))