?

Average Accuracy: 59.2% → 83.8%
Time: 15.3s
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, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{if}\;d \leq -6.2 \cdot 10^{+119}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\ \mathbf{elif}\;d \leq -1.1 \cdot 10^{-70}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{-224}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 8.2 \cdot 10^{+100}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \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 (* d b)) (hypot c d)))))
   (if (<= d -6.2e+119)
     (+ (/ b d) (/ (/ c d) (/ d a)))
     (if (<= d -1.1e-70)
       t_0
       (if (<= d 2.1e-224)
         (+ (/ a c) (/ (* b (/ d c)) c))
         (if (<= d 8.2e+100) t_0 (+ (/ b d) (* (/ c d) (/ a d)))))))))
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, (d * b)) / hypot(c, d));
	double tmp;
	if (d <= -6.2e+119) {
		tmp = (b / d) + ((c / d) / (d / a));
	} else if (d <= -1.1e-70) {
		tmp = t_0;
	} else if (d <= 2.1e-224) {
		tmp = (a / c) + ((b * (d / c)) / c);
	} else if (d <= 8.2e+100) {
		tmp = t_0;
	} else {
		tmp = (b / d) + ((c / d) * (a / d));
	}
	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(d * b)) / hypot(c, d)))
	tmp = 0.0
	if (d <= -6.2e+119)
		tmp = Float64(Float64(b / d) + Float64(Float64(c / d) / Float64(d / a)));
	elseif (d <= -1.1e-70)
		tmp = t_0;
	elseif (d <= 2.1e-224)
		tmp = Float64(Float64(a / c) + Float64(Float64(b * Float64(d / c)) / c));
	elseif (d <= 8.2e+100)
		tmp = t_0;
	else
		tmp = Float64(Float64(b / d) + Float64(Float64(c / d) * Float64(a / d)));
	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[(d * b), $MachinePrecision]), $MachinePrecision] / N[Sqrt[c ^ 2 + d ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -6.2e+119], N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] / N[(d / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.1e-70], t$95$0, If[LessEqual[d, 2.1e-224], N[(N[(a / c), $MachinePrecision] + N[(N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 8.2e+100], t$95$0, N[(N[(b / d), $MachinePrecision] + N[(N[(c / d), $MachinePrecision] * N[(a / d), $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, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}\\
\mathbf{if}\;d \leq -6.2 \cdot 10^{+119}:\\
\;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\

\mathbf{elif}\;d \leq -1.1 \cdot 10^{-70}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;d \leq 8.2 \cdot 10^{+100}:\\
\;\;\;\;t_0\\

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


\end{array}

Error?

Target

Original59.2%
Target99.2%
Herbie83.8%
\[\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 d < -6.1999999999999999e119

    1. Initial program 34.0%

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

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

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

      [Start]73.1

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

      *-commutative [<=]73.1

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

      unpow2 [=>]73.1

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

      times-frac [=>]85.2

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

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

      [Start]85.2

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

      clear-num [=>]85.2

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

      associate-*l/ [=>]85.3

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

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

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

    if -6.1999999999999999e119 < d < -1.0999999999999999e-70 or 2.10000000000000006e-224 < d < 8.2000000000000006e100

    1. Initial program 73.7%

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

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

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

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

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

      add-sqr-sqrt [=>]73.7

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

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

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

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

      \[ \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.0999999999999999e-70 < d < 2.10000000000000006e-224

    1. Initial program 66.3%

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

      [Start]66.3

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

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

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

      add-sqr-sqrt [=>]66.3

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

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

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

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

      \[ \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)}} \]
    3. Taylor expanded in c around inf 82.0%

      \[\leadsto \color{blue}{\frac{a}{c} + \frac{d \cdot b}{{c}^{2}}} \]
    4. Simplified86.6%

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

      [Start]82.0

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

      *-commutative [<=]82.0

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

      unpow2 [=>]82.0

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

      associate-/r* [=>]87.2

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

      *-commutative [=>]87.2

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

      associate-/l* [=>]85.9

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

      associate-/r/ [=>]86.6

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

    if 8.2000000000000006e100 < d

    1. Initial program 37.9%

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

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

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

      [Start]74.4

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

      *-commutative [<=]74.4

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

      unpow2 [=>]74.4

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

      times-frac [=>]82.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -6.2 \cdot 10^{+119}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\ \mathbf{elif}\;d \leq -1.1 \cdot 10^{-70}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{-224}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 8.2 \cdot 10^{+100}:\\ \;\;\;\;\frac{1}{\mathsf{hypot}\left(c, d\right)} \cdot \frac{\mathsf{fma}\left(a, c, d \cdot b\right)}{\mathsf{hypot}\left(c, d\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \end{array} \]

Alternatives

Alternative 1
Accuracy72.9%
Cost1628
\[\begin{array}{l} t_0 := \frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{if}\;c \leq -11500:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 4 \cdot 10^{-82}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 4.3 \cdot 10^{-41}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 9.5 \cdot 10^{+59}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 7.2 \cdot 10^{+118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 5.4 \cdot 10^{+154}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 2
Accuracy73.0%
Cost1628
\[\begin{array}{l} t_0 := \frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ t_1 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{if}\;c \leq -1850:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 4.1 \cdot 10^{-82}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-41}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 1.75 \cdot 10^{-15}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{\frac{d \cdot d}{a}}\\ \mathbf{elif}\;c \leq 6.1 \cdot 10^{+63}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;c \leq 7.2 \cdot 10^{+118}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 5.5 \cdot 10^{+154}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Accuracy73.3%
Cost1628
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{if}\;c \leq -26000:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 4.2 \cdot 10^{-82}:\\ \;\;\;\;\frac{b}{d} + \frac{c \cdot \frac{a}{d}}{d}\\ \mathbf{elif}\;c \leq 1.4 \cdot 10^{-41}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 5.2 \cdot 10^{-18}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{\frac{d \cdot d}{a}}\\ \mathbf{elif}\;c \leq 4.1 \cdot 10^{+62}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 10^{+119}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+155}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Accuracy73.7%
Cost1628
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{if}\;c \leq -190:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 4.2 \cdot 10^{-82}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{c}{d} \cdot a}{d}\\ \mathbf{elif}\;c \leq 9.2 \cdot 10^{-42}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;c \leq 2.1 \cdot 10^{-18}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{\frac{d \cdot d}{a}}\\ \mathbf{elif}\;c \leq 2.65 \cdot 10^{+63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;c \leq 1.26 \cdot 10^{+119}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \mathbf{elif}\;c \leq 6.4 \cdot 10^{+165}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 5
Accuracy81.1%
Cost1488
\[\begin{array}{l} t_0 := \frac{d \cdot b + c \cdot a}{c \cdot c + d \cdot d}\\ \mathbf{if}\;d \leq -8.8 \cdot 10^{+117}:\\ \;\;\;\;\frac{b}{d} + \frac{\frac{c}{d}}{\frac{d}{a}}\\ \mathbf{elif}\;d \leq -2.8 \cdot 10^{-71}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq 1.15 \cdot 10^{-70}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{elif}\;d \leq 1.8 \cdot 10^{+97}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d} + \frac{c}{d} \cdot \frac{a}{d}\\ \end{array} \]
Alternative 6
Accuracy68.9%
Cost1232
\[\begin{array}{l} t_0 := \frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{if}\;d \leq -2.1 \cdot 10^{+109}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;d \leq -4 \cdot 10^{+59}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-7}:\\ \;\;\;\;b \cdot \frac{d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 1.1 \cdot 10^{-22}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d}\\ \end{array} \]
Alternative 7
Accuracy69.4%
Cost1232
\[\begin{array}{l} \mathbf{if}\;d \leq -1.85 \cdot 10^{+109}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{elif}\;d \leq -7.2 \cdot 10^{+55}:\\ \;\;\;\;\frac{a}{c} + \frac{d}{c} \cdot \frac{b}{c}\\ \mathbf{elif}\;d \leq -5.6 \cdot 10^{-8}:\\ \;\;\;\;b \cdot \frac{d}{c \cdot c + d \cdot d}\\ \mathbf{elif}\;d \leq 5.8 \cdot 10^{-27}:\\ \;\;\;\;\frac{a}{c} + \frac{b \cdot \frac{d}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{d}\\ \end{array} \]
Alternative 8
Accuracy63.8%
Cost456
\[\begin{array}{l} \mathbf{if}\;c \leq -28:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq 4 \cdot 10^{-25}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \]
Alternative 9
Accuracy41.5%
Cost192
\[\frac{a}{c} \]

Error

Reproduce?

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