?

Average Accuracy: 60.2% → 93.7%
Time: 18.3s
Precision: binary64
Cost: 20616

?

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

\mathbf{elif}\;c \leq 10^{+94}:\\
\;\;\;\;t_0 \cdot \left(t_1 + \frac{c \cdot a}{\mathsf{hypot}\left(c, d\right)}\right)\\

\mathbf{else}:\\
\;\;\;\;t_0 \cdot \left(a + t_1\right)\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original60.2%
Target99.4%
Herbie93.7%
\[\begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{a + b \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{b + a \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\ \end{array} \]

Derivation?

  1. Split input into 3 regimes
  2. if c < -1.90000000000000001e125

    1. Initial program 35.0%

      \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr55.9%

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}} \]
      Proof
    3. No proof available- proof too large to flatten.
    4. Taylor expanded in c around -inf 81.6%

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

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

      [Start]81.6

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

      distribute-lft-out [=>]81.6

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

      +-commutative [<=]81.6

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

      associate-/l* [=>]88.4

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

    if -1.90000000000000001e125 < c < 1e94

    1. Initial program 71.5%

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}} \]
      Proof
    3. No proof available- proof too large to flatten.
    4. Applied egg-rr81.4%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot c}{\mathsf{hypot}\left(c, d\right)} + \frac{b \cdot d}{\mathsf{hypot}\left(c, d\right)}\right)} \]
      Proof
    5. No proof available- proof too large to flatten.
    6. Simplified95.2%

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

      [Start]81.4

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

      +-commutative [=>]81.4

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

      associate-/l* [=>]95.2

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

      *-commutative [<=]95.2

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

    if 1e94 < c

    1. Initial program 40.8%

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

      \[\leadsto \color{blue}{\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}} \]
      Proof
    3. No proof available- proof too large to flatten.
    4. Applied egg-rr61.1%

      \[\leadsto \frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \color{blue}{\left(\frac{a \cdot c}{\mathsf{hypot}\left(c, d\right)} + \frac{b \cdot d}{\mathsf{hypot}\left(c, d\right)}\right)} \]
      Proof
    5. No proof available- proof too large to flatten.
    6. Simplified68.8%

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

      [Start]61.1

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

      +-commutative [=>]61.1

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

      associate-/l* [=>]68.8

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

      *-commutative [<=]68.8

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

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

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

Alternatives

Alternative 1
Accuracy88.0%
Cost21960
\[\begin{array}{l} t_0 := \mathsf{fma}\left(c, c, d \cdot d\right)\\ t_1 := \frac{c \cdot a + d \cdot b}{c \cdot c + d \cdot d}\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{+261}:\\ \;\;\;\;\frac{d}{\frac{t_0}{b}} + a \cdot \frac{c}{t_0}\\ \mathbf{elif}\;t_1 \leq 2 \cdot 10^{+245}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(a + \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\ \end{array} \]
Alternative 2
Accuracy85.1%
Cost14028
\[\begin{array}{l} t_0 := c \cdot c + d \cdot d\\ \mathbf{if}\;c \leq -1.36 \cdot 10^{+138}:\\ \;\;\;\;\left(a + \frac{d}{\frac{c}{b}}\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq -3.9 \cdot 10^{-154}:\\ \;\;\;\;b \cdot \frac{d}{t_0} + a \cdot \frac{c}{t_0}\\ \mathbf{elif}\;c \leq 8 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \left(a + \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\ \end{array} \]
Alternative 3
Accuracy84.2%
Cost7300
\[\begin{array}{l} t_0 := c \cdot c + d \cdot d\\ t_1 := b \cdot \frac{d}{t_0} + a \cdot \frac{c}{t_0}\\ \mathbf{if}\;c \leq -1.3 \cdot 10^{+138}:\\ \;\;\;\;\left(a + \frac{d}{\frac{c}{b}}\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq -3.7 \cdot 10^{-154}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{-56}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{elif}\;c \leq 2.1 \cdot 10^{+145}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 4
Accuracy77.1%
Cost2148
\[\begin{array}{l} t_0 := \frac{c \cdot a + d \cdot b}{c \cdot c + d \cdot d}\\ t_1 := \frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{if}\;d \leq -72000000000000:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d \cdot \frac{d}{a}}\\ \mathbf{elif}\;d \leq -2.5 \cdot 10^{-48}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;d \leq -5.4 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d} \cdot \frac{c}{d}\\ \mathbf{elif}\;d \leq -4.5 \cdot 10^{-65}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;d \leq -2.7 \cdot 10^{-147}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.26 \cdot 10^{-129}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 25000000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.25 \cdot 10^{+55}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;d \leq 3.7 \cdot 10^{+118}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\ \end{array} \]
Alternative 5
Accuracy84.1%
Cost2000
\[\begin{array}{l} t_0 := c \cdot c + d \cdot d\\ t_1 := b \cdot \frac{d}{t_0} + a \cdot \frac{c}{t_0}\\ t_2 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -5.5 \cdot 10^{+135}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;c \leq -1.32 \cdot 10^{-155}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{-56}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{elif}\;c \leq 1.7 \cdot 10^{+145}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 6
Accuracy68.6%
Cost1232
\[\begin{array}{l} t_0 := \frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{if}\;d \leq -2.65 \cdot 10^{+14}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;d \leq 2.05 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 18000000:\\ \;\;\;\;b \cdot \frac{d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 6.2 \cdot 10^{+60}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d}\\ \end{array} \]
Alternative 7
Accuracy74.7%
Cost1232
\[\begin{array}{l} t_0 := \frac{b}{d} + \frac{a}{d} \cdot \frac{c}{d}\\ \mathbf{if}\;c \leq -2 \cdot 10^{-12}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq 3.1 \cdot 10^{+33}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2.2 \cdot 10^{+61}:\\ \;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 1.9 \cdot 10^{+95}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 8
Accuracy74.7%
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -9.5 \cdot 10^{-13}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq 4.2 \cdot 10^{+33}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d} \cdot \frac{c}{d}\\ \mathbf{elif}\;c \leq 5.1 \cdot 10^{+61}:\\ \;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 2.1 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d \cdot \frac{d}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 9
Accuracy74.9%
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -2.5 \cdot 10^{-15}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+32}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{elif}\;c \leq 5.5 \cdot 10^{+61}:\\ \;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 4.4 \cdot 10^{+94}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d \cdot \frac{d}{a}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 10
Accuracy75.0%
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -3.9 \cdot 10^{-12}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq 4.8 \cdot 10^{+33}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{elif}\;c \leq 3.2 \cdot 10^{+60}:\\ \;\;\;\;\frac{a}{c} + b \cdot \frac{\frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 10^{+94}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{a}{d}}{\frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 11
Accuracy69.9%
Cost968
\[\begin{array}{l} \mathbf{if}\;c \leq -1.8 \cdot 10^{-13}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq 6.2 \cdot 10^{+32}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 12
Accuracy64.1%
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -1.85 \cdot 10^{-13}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq 4.4 \cdot 10^{+34}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \]
Alternative 13
Accuracy42.0%
Cost192
\[\frac{a}{c} \]

Error

Reproduce?

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

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

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