?

Average Accuracy: 59.4% → 85.0%
Time: 17.2s
Precision: binary64
Cost: 20560

?

\[\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)} \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;c \leq -6.2 \cdot 10^{+147}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -1.08 \cdot 10^{-172}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 8 \cdot 10^{-127}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+121}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \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)) (/ (fma a c (* b d)) (hypot c d)))))
   (if (<= c -6.2e+147)
     (+ (/ a c) (/ (/ b c) (/ c d)))
     (if (<= c -1.08e-172)
       t_0
       (if (<= c 8e-127)
         (+ (/ b d) (/ a (* d (/ d c))))
         (if (<= c 2.6e+121) t_0 (+ (/ a c) (* (/ b c) (/ d c)))))))))
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)) * (fma(a, c, (b * d)) / hypot(c, d));
	double tmp;
	if (c <= -6.2e+147) {
		tmp = (a / c) + ((b / c) / (c / d));
	} else if (c <= -1.08e-172) {
		tmp = t_0;
	} else if (c <= 8e-127) {
		tmp = (b / d) + (a / (d * (d / c)));
	} else if (c <= 2.6e+121) {
		tmp = t_0;
	} else {
		tmp = (a / c) + ((b / c) * (d / c));
	}
	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(Float64(1.0 / hypot(c, d)) * Float64(fma(a, c, Float64(b * d)) / hypot(c, d)))
	tmp = 0.0
	if (c <= -6.2e+147)
		tmp = Float64(Float64(a / c) + Float64(Float64(b / c) / Float64(c / d)));
	elseif (c <= -1.08e-172)
		tmp = t_0;
	elseif (c <= 8e-127)
		tmp = Float64(Float64(b / d) + Float64(a / Float64(d * Float64(d / c))));
	elseif (c <= 2.6e+121)
		tmp = t_0;
	else
		tmp = Float64(Float64(a / c) + Float64(Float64(b / c) * Float64(d / c)));
	end
	return 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[(N[(1.0 / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision] * N[(N[(a * c + N[(b * d), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -6.2e+147], N[(N[(a / c), $MachinePrecision] + N[(N[(b / c), $MachinePrecision] / N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -1.08e-172], t$95$0, If[LessEqual[c, 8e-127], N[(N[(b / d), $MachinePrecision] + N[(a / N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.6e+121], t$95$0, N[(N[(a / c), $MachinePrecision] + N[(N[(b / c), $MachinePrecision] * N[(d / c), $MachinePrecision]), $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)} \cdot \frac{\mathsf{fma}\left(a, c, b \cdot d\right)}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;c \leq -6.2 \cdot 10^{+147}:\\
\;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\

\mathbf{elif}\;c \leq -1.08 \cdot 10^{-172}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;c \leq 2.6 \cdot 10^{+121}:\\
\;\;\;\;t_0\\

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


\end{array}

Error?

Target

Original59.4%
Target99.2%
Herbie85.0%
\[\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 4 regimes
  2. if c < -6.2000000000000001e147

    1. Initial program 29.0%

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

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

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

      [Start]75.6

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

      unpow2 [=>]75.6

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

      times-frac [=>]88.5

      \[ \frac{a}{c} + \color{blue}{\frac{d}{c} \cdot \frac{b}{c}} \]
    4. Applied egg-rr88.3%

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

      [Start]88.5

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

      *-commutative [=>]88.5

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

      clear-num [=>]88.3

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

      un-div-inv [=>]88.3

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

    if -6.2000000000000001e147 < c < -1.08e-172 or 8.0000000000000002e-127 < c < 2.5999999999999999e121

    1. Initial program 75.0%

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

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

      [Start]75.0

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

      *-un-lft-identity [=>]75.0

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

      add-sqr-sqrt [=>]75.0

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

      times-frac [=>]75.0

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

      hypot-def [=>]75.0

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

      fma-def [=>]75.0

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

      hypot-def [=>]82.6

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

    if -1.08e-172 < c < 8.0000000000000002e-127

    1. Initial program 62.8%

      \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
    2. Taylor expanded in c around 0 84.8%

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

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

      [Start]84.8

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

      unpow2 [=>]84.8

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

      times-frac [=>]87.1

      \[ \frac{b}{d} + \color{blue}{\frac{c}{d} \cdot \frac{a}{d}} \]
    4. Applied egg-rr89.4%

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

      [Start]87.1

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

      clear-num [=>]87.0

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

      frac-times [=>]89.4

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

      *-un-lft-identity [<=]89.4

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

    if 2.5999999999999999e121 < c

    1. Initial program 35.9%

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

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

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

      [Start]73.5

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

      unpow2 [=>]73.5

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

      times-frac [=>]82.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -6.2 \cdot 10^{+147}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -1.08 \cdot 10^{-172}:\\ \;\;\;\;\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)}\\ \mathbf{elif}\;c \leq 8 \cdot 10^{-127}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{elif}\;c \leq 2.6 \cdot 10^{+121}:\\ \;\;\;\;\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)}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy76.8%
Cost14036
\[\begin{array}{l} \mathbf{if}\;c \leq -9.6 \cdot 10^{+76}:\\ \;\;\;\;\left(a + b \cdot \frac{d}{c}\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq -2.4 \cdot 10^{-147}:\\ \;\;\;\;\frac{b \cdot d + c \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 3.1 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{elif}\;c \leq 95000000000:\\ \;\;\;\;\frac{c}{\frac{c}{\frac{a}{c}} + \frac{d}{\frac{a}{d}}}\\ \mathbf{elif}\;c \leq 1.65 \cdot 10^{+159}:\\ \;\;\;\;\frac{d}{\mathsf{hypot}\left(d, c\right)} \cdot \frac{b}{\mathsf{hypot}\left(d, c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 2
Accuracy78.6%
Cost7300
\[\begin{array}{l} \mathbf{if}\;c \leq -8.6 \cdot 10^{+75}:\\ \;\;\;\;\left(a + b \cdot \frac{d}{c}\right) \cdot \frac{-1}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-145}:\\ \;\;\;\;\frac{b \cdot d + c \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \end{array} \]
Alternative 3
Accuracy72.2%
Cost1624
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -1.6 \cdot 10^{-25}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{elif}\;c \leq 8.5 \cdot 10^{+59}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{\frac{c \cdot c}{b}}\\ \mathbf{elif}\;c \leq 3.6 \cdot 10^{+114}:\\ \;\;\;\;c \cdot \frac{a}{d \cdot d} - b \cdot \frac{-1}{d}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy73.1%
Cost1498
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -2.9 \cdot 10^{-21} \lor \neg \left(c \leq 3.3 \cdot 10^{-59} \lor \neg \left(c \leq 5.8 \cdot 10^{+60}\right) \land c \leq 4.3 \cdot 10^{+114}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \end{array} \]
Alternative 5
Accuracy73.1%
Cost1496
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ t_1 := \frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \mathbf{if}\;c \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -3.1 \cdot 10^{-23}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.9 \cdot 10^{+60}:\\ \;\;\;\;\frac{a}{c} + \frac{b}{c \cdot \frac{c}{d}}\\ \mathbf{elif}\;c \leq 3.8 \cdot 10^{+114}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 6
Accuracy73.1%
Cost1496
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ t_1 := \frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \mathbf{if}\;c \leq -8 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -3.6 \cdot 10^{+108}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -3 \cdot 10^{-21}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 3.8 \cdot 10^{+60}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{\frac{c \cdot c}{b}}\\ \mathbf{elif}\;c \leq 3.4 \cdot 10^{+114}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 7
Accuracy72.9%
Cost1496
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ t_1 := \frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \mathbf{if}\;c \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -2.35 \cdot 10^{+110}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -3.2 \cdot 10^{-22}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 6.3 \cdot 10^{+60}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{\frac{c \cdot c}{b}}\\ \mathbf{elif}\;c \leq 2.3 \cdot 10^{+121}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Accuracy72.6%
Cost1496
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -2.25 \cdot 10^{+123}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -2.3 \cdot 10^{+110}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -3.1 \cdot 10^{-21}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 3.15 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{elif}\;c \leq 8.2 \cdot 10^{+59}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{\frac{c \cdot c}{b}}\\ \mathbf{elif}\;c \leq 3.4 \cdot 10^{+114}:\\ \;\;\;\;\frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 9
Accuracy78.0%
Cost1488
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{b}{c} \cdot \frac{d}{c}\\ \mathbf{if}\;c \leq -8 \cdot 10^{+123}:\\ \;\;\;\;\frac{a}{c} + \frac{\frac{b}{c}}{\frac{c}{d}}\\ \mathbf{elif}\;c \leq -6.8 \cdot 10^{+108}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;c \leq -6 \cdot 10^{+74}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq -1.8 \cdot 10^{-145}:\\ \;\;\;\;\frac{b \cdot d + c \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;c \leq 3.3 \cdot 10^{-59}:\\ \;\;\;\;\frac{b}{d} + \frac{a}{d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 10
Accuracy69.7%
Cost841
\[\begin{array}{l} \mathbf{if}\;d \leq -3.8 \cdot 10^{+32} \lor \neg \left(d \leq 2.45 \cdot 10^{-62}\right):\\ \;\;\;\;\frac{b + \frac{c}{\frac{d}{a}}}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \]
Alternative 11
Accuracy63.2%
Cost456
\[\begin{array}{l} \mathbf{if}\;d \leq -1.75 \cdot 10^{+46}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;d \leq 6 \cdot 10^{-62}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d}\\ \end{array} \]
Alternative 12
Accuracy41.8%
Cost192
\[\frac{a}{c} \]

Error

Reproduce?

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