?

Average Error: 26.7 → 9.8
Time: 14.3s
Precision: binary64
Cost: 14160

?

\[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
\[\begin{array}{l} t_0 := \frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;c \leq -4.6 \cdot 10^{+139}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -1.7 \cdot 10^{-157}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-58}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+148}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (/ (- (* c b) (* d a)) (hypot c d)) (hypot c d))))
   (if (<= c -4.6e+139)
     (/ (- b (* d (/ a c))) c)
     (if (<= c -1.7e-157)
       t_0
       (if (<= c 1.6e-58)
         (/ (- a (* b (/ c d))) (- d))
         (if (<= c 1.9e+148) t_0 (- (/ b c) (* (/ a c) (/ d c)))))))))
double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
double code(double a, double b, double c, double d) {
	double t_0 = (((c * b) - (d * a)) / hypot(c, d)) / hypot(c, d);
	double tmp;
	if (c <= -4.6e+139) {
		tmp = (b - (d * (a / c))) / c;
	} else if (c <= -1.7e-157) {
		tmp = t_0;
	} else if (c <= 1.6e-58) {
		tmp = (a - (b * (c / d))) / -d;
	} else if (c <= 1.9e+148) {
		tmp = t_0;
	} else {
		tmp = (b / c) - ((a / c) * (d / c));
	}
	return tmp;
}
public static double code(double a, double b, double c, double d) {
	return ((b * c) - (a * d)) / ((c * c) + (d * d));
}
public static double code(double a, double b, double c, double d) {
	double t_0 = (((c * b) - (d * a)) / Math.hypot(c, d)) / Math.hypot(c, d);
	double tmp;
	if (c <= -4.6e+139) {
		tmp = (b - (d * (a / c))) / c;
	} else if (c <= -1.7e-157) {
		tmp = t_0;
	} else if (c <= 1.6e-58) {
		tmp = (a - (b * (c / d))) / -d;
	} else if (c <= 1.9e+148) {
		tmp = t_0;
	} else {
		tmp = (b / c) - ((a / c) * (d / c));
	}
	return tmp;
}
def code(a, b, c, d):
	return ((b * c) - (a * d)) / ((c * c) + (d * d))
def code(a, b, c, d):
	t_0 = (((c * b) - (d * a)) / math.hypot(c, d)) / math.hypot(c, d)
	tmp = 0
	if c <= -4.6e+139:
		tmp = (b - (d * (a / c))) / c
	elif c <= -1.7e-157:
		tmp = t_0
	elif c <= 1.6e-58:
		tmp = (a - (b * (c / d))) / -d
	elif c <= 1.9e+148:
		tmp = t_0
	else:
		tmp = (b / c) - ((a / c) * (d / c))
	return tmp
function code(a, b, c, d)
	return Float64(Float64(Float64(b * c) - Float64(a * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(Float64(c * b) - Float64(d * a)) / hypot(c, d)) / hypot(c, d))
	tmp = 0.0
	if (c <= -4.6e+139)
		tmp = Float64(Float64(b - Float64(d * Float64(a / c))) / c);
	elseif (c <= -1.7e-157)
		tmp = t_0;
	elseif (c <= 1.6e-58)
		tmp = Float64(Float64(a - Float64(b * Float64(c / d))) / Float64(-d));
	elseif (c <= 1.9e+148)
		tmp = t_0;
	else
		tmp = Float64(Float64(b / c) - Float64(Float64(a / c) * Float64(d / c)));
	end
	return tmp
end
function tmp = code(a, b, c, d)
	tmp = ((b * c) - (a * d)) / ((c * c) + (d * d));
end
function tmp_2 = code(a, b, c, d)
	t_0 = (((c * b) - (d * a)) / hypot(c, d)) / hypot(c, d);
	tmp = 0.0;
	if (c <= -4.6e+139)
		tmp = (b - (d * (a / c))) / c;
	elseif (c <= -1.7e-157)
		tmp = t_0;
	elseif (c <= 1.6e-58)
		tmp = (a - (b * (c / d))) / -d;
	elseif (c <= 1.9e+148)
		tmp = t_0;
	else
		tmp = (b / c) - ((a / c) * (d / c));
	end
	tmp_2 = tmp;
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]
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(N[(c * b), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -4.6e+139], N[(N[(b - N[(d * N[(a / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], If[LessEqual[c, -1.7e-157], t$95$0, If[LessEqual[c, 1.6e-58], N[(N[(a - N[(b * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / (-d)), $MachinePrecision], If[LessEqual[c, 1.9e+148], t$95$0, N[(N[(b / c), $MachinePrecision] - N[(N[(a / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d}
\begin{array}{l}
t_0 := \frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -4.6 \cdot 10^{+139}:\\
\;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\

\mathbf{elif}\;c \leq -1.7 \cdot 10^{-157}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 1.9 \cdot 10^{+148}:\\
\;\;\;\;t_0\\

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original26.7
Target0.3
Herbie9.8
\[\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} \]

Derivation?

  1. Split input into 4 regimes
  2. if c < -4.6e139

    1. Initial program 43.6

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

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

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

      [Start]13.4

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

      +-commutative [=>]13.4

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

      mul-1-neg [=>]13.4

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

      unsub-neg [=>]13.4

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

      *-commutative [=>]13.4

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

      unpow2 [=>]13.4

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

      times-frac [=>]6.5

      \[ \frac{b}{c} - \color{blue}{\frac{d}{c} \cdot \frac{a}{c}} \]
    4. Taylor expanded in b around 0 13.4

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

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

      [Start]13.4

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

      mul-1-neg [=>]13.4

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

      *-commutative [<=]13.4

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

      unpow2 [=>]13.4

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

      associate-*l/ [<=]12.1

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

      +-commutative [<=]12.1

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

      sub-neg [<=]12.1

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

      associate-*l/ [=>]13.4

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

      associate-/r* [=>]11.1

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

      div-sub [<=]11.1

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

      associate-*r/ [<=]6.3

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

    if -4.6e139 < c < -1.69999999999999989e-157 or 1.6e-58 < c < 1.8999999999999999e148

    1. Initial program 18.0

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr13.1

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{b \cdot c - a \cdot d}{\mathsf{hypot}\left(c, d\right)}} \]
    3. Applied egg-rr13.0

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

    if -1.69999999999999989e-157 < c < 1.6e-58

    1. Initial program 22.0

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr12.4

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

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

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

      [Start]31.9

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

      +-commutative [=>]31.9

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

      mul-1-neg [=>]31.9

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

      associate-/l* [=>]32.3

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

      associate-/r/ [=>]31.9

      \[ \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(\left(-a\right) + \color{blue}{\frac{c}{d} \cdot b}\right) \]
    5. Taylor expanded in c around 0 8.1

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

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

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

      [Start]9.0

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

      associate-/r/ [=>]7.9

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

      *-commutative [=>]7.9

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

    if 1.8999999999999999e148 < c

    1. Initial program 45.0

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

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

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

      [Start]15.6

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

      +-commutative [=>]15.6

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

      mul-1-neg [=>]15.6

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

      unsub-neg [=>]15.6

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

      *-commutative [=>]15.6

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

      unpow2 [=>]15.6

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

      times-frac [=>]7.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -4.6 \cdot 10^{+139}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -1.7 \cdot 10^{-157}:\\ \;\;\;\;\frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-58}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+148}:\\ \;\;\;\;\frac{\frac{c \cdot b - d \cdot a}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]

Alternatives

Alternative 1
Error12.0
Cost7172
\[\begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -1 \cdot 10^{+121}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq -7.4 \cdot 10^{-127}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{-151}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 9 \cdot 10^{+146}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \end{array} \]
Alternative 2
Error12.1
Cost1488
\[\begin{array}{l} t_0 := \frac{c \cdot b - d \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -5.9 \cdot 10^{+121}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{elif}\;d \leq -1.85 \cdot 10^{-127}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 3.3 \cdot 10^{-152}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;d \leq 1.05 \cdot 10^{+147}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c}{d} \cdot \frac{b}{d} - \frac{a}{d}\\ \end{array} \]
Alternative 3
Error15.3
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -5 \cdot 10^{+54}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{-101}:\\ \;\;\;\;\frac{a}{\left(-d\right) - \frac{c \cdot c}{d}}\\ \mathbf{elif}\;c \leq -2.6 \cdot 10^{-135}:\\ \;\;\;\;b \cdot \frac{c}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 1.55 \cdot 10^{-48}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 4
Error15.2
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -4 \cdot 10^{+56}:\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{elif}\;c \leq -9.5 \cdot 10^{-101}:\\ \;\;\;\;\frac{a}{\left(-d\right) - \frac{c \cdot c}{d}}\\ \mathbf{elif}\;c \leq -2.9 \cdot 10^{-135}:\\ \;\;\;\;\frac{c \cdot b}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 2.2 \cdot 10^{-45}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c} - \frac{a}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 5
Error14.7
Cost1168
\[\begin{array}{l} t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -9.2 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -0.00014:\\ \;\;\;\;\frac{a}{\left(-d\right) - \frac{c \cdot c}{d}}\\ \mathbf{elif}\;c \leq -1.25 \cdot 10^{-34}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;c \leq 6.2 \cdot 10^{-48}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Error15.2
Cost1168
\[\begin{array}{l} t_0 := \frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{if}\;c \leq -4.8 \cdot 10^{+54}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -5.7 \cdot 10^{-102}:\\ \;\;\;\;\frac{a}{\left(-d\right) - \frac{c \cdot c}{d}}\\ \mathbf{elif}\;c \leq -2.9 \cdot 10^{-135}:\\ \;\;\;\;b \cdot \frac{c}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 1.25 \cdot 10^{-44}:\\ \;\;\;\;\frac{a - b \cdot \frac{c}{d}}{-d}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Error16.6
Cost905
\[\begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{+54} \lor \neg \left(c \leq 0.145\right):\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{\left(-d\right) - \frac{c \cdot c}{d}}\\ \end{array} \]
Alternative 8
Error18.1
Cost841
\[\begin{array}{l} \mathbf{if}\;c \leq -1.85 \cdot 10^{-53} \lor \neg \left(c \leq 2.3 \cdot 10^{-26}\right):\\ \;\;\;\;\frac{b - d \cdot \frac{a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
Alternative 9
Error22.2
Cost520
\[\begin{array}{l} \mathbf{if}\;c \leq -9.8 \cdot 10^{-51}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 200:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
Alternative 10
Error34.7
Cost456
\[\begin{array}{l} \mathbf{if}\;d \leq -8 \cdot 10^{+145}:\\ \;\;\;\;\frac{a}{d}\\ \mathbf{elif}\;d \leq 2.5 \cdot 10^{+183}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{d}\\ \end{array} \]
Alternative 11
Error57.1
Cost192
\[\frac{a}{d} \]

Error

Reproduce?

herbie shell --seed 2023018 
(FPCore (a b c d)
  :name "Complex division, imag part"
  :precision binary64

  :herbie-target
  (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d)))))

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