?

Average Error: 26.0 → 4.1
Time: 14.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 -2.1 \cdot 10^{+168}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq 10^{+134}:\\ \;\;\;\;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 -2.1e+168)
     (+ (/ a c) (* (/ b c) (/ d c)))
     (if (<= c 1e+134)
       (* 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 <= -2.1e+168) {
		tmp = (a / c) + ((b / c) * (d / c));
	} else if (c <= 1e+134) {
		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 <= -2.1e+168) {
		tmp = (a / c) + ((b / c) * (d / c));
	} else if (c <= 1e+134) {
		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 <= -2.1e+168:
		tmp = (a / c) + ((b / c) * (d / c))
	elif c <= 1e+134:
		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 <= -2.1e+168)
		tmp = Float64(Float64(a / c) + Float64(Float64(b / c) * Float64(d / c)));
	elseif (c <= 1e+134)
		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 <= -2.1e+168)
		tmp = (a / c) + ((b / c) * (d / c));
	elseif (c <= 1e+134)
		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, -2.1e+168], N[(N[(a / c), $MachinePrecision] + N[(N[(b / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1e+134], 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 -2.1 \cdot 10^{+168}:\\
\;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\

\mathbf{elif}\;c \leq 10^{+134}:\\
\;\;\;\;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

Original26.0
Target0.4
Herbie4.1
\[\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 < -2.10000000000000003e168

    1. Initial program 43.6

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

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

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

      [Start]13.9

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

      *-commutative [<=]13.9

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

      unpow2 [=>]13.9

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

      times-frac [=>]6.1

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

    if -2.10000000000000003e168 < c < 9.99999999999999921e133

    1. Initial program 20.0

      \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr12.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)}} \]
    3. Applied egg-rr12.9

      \[\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)} \]
    4. Simplified3.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]12.9

      \[ \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 [=>]12.9

      \[ \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* [=>]3.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 [<=]3.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) \]

    if 9.99999999999999921e133 < c

    1. Initial program 41.8

      \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
    2. Applied egg-rr26.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)}} \]
    3. Applied egg-rr26.9

      \[\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)} \]
    4. Simplified23.0

      \[\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]26.9

      \[ \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 [=>]26.9

      \[ \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* [=>]23.0

      \[ \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 [<=]23.0

      \[ \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) \]
    5. Taylor expanded in c around inf 4.0

      \[\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 simplification4.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.1 \cdot 10^{+168}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq 10^{+134}:\\ \;\;\;\;\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
Error10.0
Cost20560
\[\begin{array}{l} t_0 := d \cdot d + c \cdot c\\ t_1 := \frac{1}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;c \leq -6.2 \cdot 10^{+82}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq -1.85 \cdot 10^{-39}:\\ \;\;\;\;\frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\ \mathbf{elif}\;c \leq 2.25 \cdot 10^{-141}:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{elif}\;c \leq 2.15 \cdot 10^{+133}:\\ \;\;\;\;t_1 \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;t_1 \cdot \left(a + \frac{b}{\frac{\mathsf{hypot}\left(c, d\right)}{d}}\right)\\ \end{array} \]
Alternative 2
Error11.1
Cost14160
\[\begin{array}{l} t_0 := d \cdot d + c \cdot c\\ t_1 := \frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\ \mathbf{if}\;c \leq -5.8 \cdot 10^{+82}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq -2.05 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-110}:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{elif}\;c \leq 4 \cdot 10^{+136}:\\ \;\;\;\;t_1\\ \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
Error11.7
Cost2000
\[\begin{array}{l} t_0 := d \cdot d + c \cdot c\\ t_1 := \frac{d}{\frac{t_0}{b}} + \frac{c}{\frac{t_0}{a}}\\ \mathbf{if}\;c \leq -5.8 \cdot 10^{+82}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq -7 \cdot 10^{-39}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 4.2 \cdot 10^{-110}:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+133}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 4
Error11.6
Cost1488
\[\begin{array}{l} t_0 := \frac{b \cdot d + c \cdot a}{d \cdot d + c \cdot c}\\ \mathbf{if}\;c \leq -7.8 \cdot 10^{+105}:\\ \;\;\;\;\frac{a}{c} + \frac{1}{\frac{c}{d} \cdot \frac{c}{b}}\\ \mathbf{elif}\;c \leq -9.8 \cdot 10^{-77}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{-111}:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{elif}\;c \leq 1.2 \cdot 10^{+133}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 5
Error18.6
Cost1364
\[\begin{array}{l} t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\ t_1 := \frac{1}{c} \cdot \left(a + b \cdot \frac{d}{c}\right)\\ \mathbf{if}\;c \leq -8 \cdot 10^{+82}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -1.2 \cdot 10^{-33}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1.85 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 9 \cdot 10^{-48}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq 1.2 \cdot 10^{+133}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error18.5
Cost1364
\[\begin{array}{l} t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\ t_1 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -6.8 \cdot 10^{+76}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -2.9 \cdot 10^{-33}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1.5 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 6.6 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{+14}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error18.6
Cost1364
\[\begin{array}{l} t_0 := a \cdot \frac{c}{d \cdot d + c \cdot c}\\ t_1 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -1.05 \cdot 10^{+80}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq -3.4 \cdot 10^{-34}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -3.3 \cdot 10^{-38}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 2.5 \cdot 10^{-47}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{+17}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 8
Error15.6
Cost1232
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -9.6 \cdot 10^{+75}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -3.3 \cdot 10^{-34}:\\ \;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq -3.6 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 8200000000000:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 9
Error15.0
Cost1232
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -3 \cdot 10^{+78}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -5.2 \cdot 10^{-33}:\\ \;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq -3.95 \cdot 10^{-38}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 2900000000000:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 10
Error15.0
Cost1232
\[\begin{array}{l} \mathbf{if}\;c \leq -2.5 \cdot 10^{+78}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{elif}\;c \leq -2.45 \cdot 10^{-32}:\\ \;\;\;\;a \cdot \frac{c}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq -8.5 \cdot 10^{-39}:\\ \;\;\;\;\frac{b \cdot d + c \cdot a}{c \cdot c}\\ \mathbf{elif}\;c \leq 9.6 \cdot 10^{+15}:\\ \;\;\;\;\frac{b}{d} + \frac{a \cdot \frac{c}{d}}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c \cdot \frac{c}{b}}\\ \end{array} \]
Alternative 11
Error18.6
Cost969
\[\begin{array}{l} \mathbf{if}\;c \leq -1.14 \cdot 10^{-38} \lor \neg \left(c \leq 7.2 \cdot 10^{-52}\right):\\ \;\;\;\;\frac{1}{c} \cdot \left(a + b \cdot \frac{d}{c}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d}\\ \end{array} \]
Alternative 12
Error22.7
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -2.6 \cdot 10^{-38}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq 5.5 \cdot 10^{-47}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \]
Alternative 13
Error37.3
Cost192
\[\frac{a}{c} \]

Error

Reproduce?

herbie shell --seed 2023025 
(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))))