Complex division, real part

Percentage Accurate: 61.6% → 83.2%
Time: 5.9s
Alternatives: 10
Speedup: 1.6×

Specification

?
\[\begin{array}{l} \\ \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((a * c) + (b * d)) / ((c * c) + (d * d));
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]
\begin{array}{l}

\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 10 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 61.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (/ (+ (* a c) (* b d)) (+ (* c c) (* d d))))
double code(double a, double b, double c, double d) {
	return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
real(8) function code(a, b, c, d)
    real(8), intent (in) :: a
    real(8), intent (in) :: b
    real(8), intent (in) :: c
    real(8), intent (in) :: d
    code = ((a * c) + (b * d)) / ((c * c) + (d * d))
end function
public static double code(double a, double b, double c, double d) {
	return ((a * c) + (b * d)) / ((c * c) + (d * d));
}
def code(a, b, c, d):
	return ((a * c) + (b * d)) / ((c * c) + (d * d))
function code(a, b, c, d)
	return Float64(Float64(Float64(a * c) + Float64(b * d)) / Float64(Float64(c * c) + Float64(d * d)))
end
function tmp = code(a, b, c, d)
	tmp = ((a * c) + (b * d)) / ((c * c) + (d * d));
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]
\begin{array}{l}

\\
\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d}
\end{array}

Alternative 1: 83.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{d \cdot b + a \cdot c}{d \cdot d + c \cdot c}\\ t_1 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\ \mathbf{if}\;c \leq -3.2 \cdot 10^{+94}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;c \leq -6.8 \cdot 10^{-38}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{-155}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}\\ \mathbf{elif}\;c \leq 3.1 \cdot 10^{+121}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (+ (* d b) (* a c)) (+ (* d d) (* c c))))
        (t_1 (/ (fma (/ b c) d a) c)))
   (if (<= c -3.2e+94)
     t_1
     (if (<= c -6.8e-38)
       t_0
       (if (<= c 1.05e-155)
         (/ (fma (/ c d) a b) d)
         (if (<= c 3.1e+121) t_0 t_1))))))
double code(double a, double b, double c, double d) {
	double t_0 = ((d * b) + (a * c)) / ((d * d) + (c * c));
	double t_1 = fma((b / c), d, a) / c;
	double tmp;
	if (c <= -3.2e+94) {
		tmp = t_1;
	} else if (c <= -6.8e-38) {
		tmp = t_0;
	} else if (c <= 1.05e-155) {
		tmp = fma((c / d), a, b) / d;
	} else if (c <= 3.1e+121) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(Float64(d * b) + Float64(a * c)) / Float64(Float64(d * d) + Float64(c * c)))
	t_1 = Float64(fma(Float64(b / c), d, a) / c)
	tmp = 0.0
	if (c <= -3.2e+94)
		tmp = t_1;
	elseif (c <= -6.8e-38)
		tmp = t_0;
	elseif (c <= 1.05e-155)
		tmp = Float64(fma(Float64(c / d), a, b) / d);
	elseif (c <= 3.1e+121)
		tmp = t_0;
	else
		tmp = t_1;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(d * b), $MachinePrecision] + N[(a * c), $MachinePrecision]), $MachinePrecision] / N[(N[(d * d), $MachinePrecision] + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(b / c), $MachinePrecision] * d + a), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -3.2e+94], t$95$1, If[LessEqual[c, -6.8e-38], t$95$0, If[LessEqual[c, 1.05e-155], N[(N[(N[(c / d), $MachinePrecision] * a + b), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 3.1e+121], t$95$0, t$95$1]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{d \cdot b + a \cdot c}{d \cdot d + c \cdot c}\\
t_1 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\
\mathbf{if}\;c \leq -3.2 \cdot 10^{+94}:\\
\;\;\;\;t\_1\\

\mathbf{elif}\;c \leq -6.8 \cdot 10^{-38}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;c \leq 1.05 \cdot 10^{-155}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}\\

\mathbf{elif}\;c \leq 3.1 \cdot 10^{+121}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;t\_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -3.20000000000000014e94 or 3.10000000000000008e121 < c

    1. Initial program 40.4%

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

      \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot d}{c} + a}}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{d \cdot b}}{c} + a}{c} \]
      4. associate-/l*N/A

        \[\leadsto \frac{\color{blue}{d \cdot \frac{b}{c}} + a}{c} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\frac{b}{c} \cdot d} + a}{c} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}}{c} \]
      7. lower-/.f6488.7

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{b}{c}}, d, a\right)}{c} \]
    5. Applied rewrites88.7%

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

    if -3.20000000000000014e94 < c < -6.8000000000000004e-38 or 1.0500000000000001e-155 < c < 3.10000000000000008e121

    1. Initial program 81.7%

      \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing

    if -6.8000000000000004e-38 < c < 1.0500000000000001e-155

    1. Initial program 67.7%

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

      \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot d}{c} + a}}{c} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{d \cdot b}}{c} + a}{c} \]
      4. associate-/l*N/A

        \[\leadsto \frac{\color{blue}{d \cdot \frac{b}{c}} + a}{c} \]
      5. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{\frac{b}{c} \cdot d} + a}{c} \]
      6. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}}{c} \]
      7. lower-/.f6422.9

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{b}{c}}, d, a\right)}{c} \]
    5. Applied rewrites22.9%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}} \]
    6. Taylor expanded in d around inf

      \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
      2. +-commutativeN/A

        \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{d} + b}}{d} \]
      3. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{d} + b}{d} \]
      4. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot a} + b}{d} \]
      5. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}}{d} \]
      6. lower-/.f6495.1

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, a, b\right)}{d} \]
    8. Applied rewrites95.1%

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification88.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -3.2 \cdot 10^{+94}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\ \mathbf{elif}\;c \leq -6.8 \cdot 10^{-38}:\\ \;\;\;\;\frac{d \cdot b + a \cdot c}{d \cdot d + c \cdot c}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{-155}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}\\ \mathbf{elif}\;c \leq 3.1 \cdot 10^{+121}:\\ \;\;\;\;\frac{d \cdot b + a \cdot c}{d \cdot d + c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 72.6% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.1 \cdot 10^{+122}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq -3.3 \cdot 10^{-34}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot a\\ \mathbf{elif}\;c \leq 1.35 \cdot 10^{+98}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{c}{a}}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -1.1e+122)
   (/ a c)
   (if (<= c -3.3e-34)
     (* (/ c (fma d d (* c c))) a)
     (if (<= c 1.35e+98) (/ (fma (/ a d) c b) d) (/ 1.0 (/ c a))))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -1.1e+122) {
		tmp = a / c;
	} else if (c <= -3.3e-34) {
		tmp = (c / fma(d, d, (c * c))) * a;
	} else if (c <= 1.35e+98) {
		tmp = fma((a / d), c, b) / d;
	} else {
		tmp = 1.0 / (c / a);
	}
	return tmp;
}
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -1.1e+122)
		tmp = Float64(a / c);
	elseif (c <= -3.3e-34)
		tmp = Float64(Float64(c / fma(d, d, Float64(c * c))) * a);
	elseif (c <= 1.35e+98)
		tmp = Float64(fma(Float64(a / d), c, b) / d);
	else
		tmp = Float64(1.0 / Float64(c / a));
	end
	return tmp
end
code[a_, b_, c_, d_] := If[LessEqual[c, -1.1e+122], N[(a / c), $MachinePrecision], If[LessEqual[c, -3.3e-34], N[(N[(c / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[c, 1.35e+98], N[(N[(N[(a / d), $MachinePrecision] * c + b), $MachinePrecision] / d), $MachinePrecision], N[(1.0 / N[(c / a), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.1 \cdot 10^{+122}:\\
\;\;\;\;\frac{a}{c}\\

\mathbf{elif}\;c \leq -3.3 \cdot 10^{-34}:\\
\;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot a\\

\mathbf{elif}\;c \leq 1.35 \cdot 10^{+98}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}{d}\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{c}{a}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -1.1e122

    1. Initial program 32.7%

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

      \[\leadsto \color{blue}{\frac{a}{c}} \]
    4. Step-by-step derivation
      1. lower-/.f6477.0

        \[\leadsto \color{blue}{\frac{a}{c}} \]
    5. Applied rewrites77.0%

      \[\leadsto \color{blue}{\frac{a}{c}} \]

    if -1.1e122 < c < -3.29999999999999983e-34

    1. Initial program 76.6%

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

      \[\leadsto \color{blue}{\frac{a \cdot c}{{c}^{2} + {d}^{2}}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c \cdot a}}{{c}^{2} + {d}^{2}} \]
      2. associate-/l*N/A

        \[\leadsto \color{blue}{c \cdot \frac{a}{{c}^{2} + {d}^{2}}} \]
      3. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
      5. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}}} \cdot c \]
      6. +-commutativeN/A

        \[\leadsto \frac{a}{\color{blue}{{d}^{2} + {c}^{2}}} \cdot c \]
      7. unpow2N/A

        \[\leadsto \frac{a}{\color{blue}{d \cdot d} + {c}^{2}} \cdot c \]
      8. lower-fma.f64N/A

        \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(d, d, {c}^{2}\right)}} \cdot c \]
      9. unpow2N/A

        \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
      10. lower-*.f6464.7

        \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
    5. Applied rewrites64.7%

      \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c} \]
    6. Step-by-step derivation
      1. Applied rewrites66.4%

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

      if -3.29999999999999983e-34 < c < 1.35e98

      1. Initial program 71.2%

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

        \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
      4. Step-by-step derivation
        1. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
        2. +-commutativeN/A

          \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{d} + b}}{d} \]
        3. *-commutativeN/A

          \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{d} + b}{d} \]
        4. associate-/l*N/A

          \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{d}} + b}{d} \]
        5. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{\frac{a}{d} \cdot c} + b}{d} \]
        6. lower-fma.f64N/A

          \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}}{d} \]
        7. lower-/.f6476.6

          \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{a}{d}}, c, b\right)}{d} \]
      5. Applied rewrites76.6%

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

      if 1.35e98 < c

      1. Initial program 49.7%

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

        \[\leadsto \color{blue}{\frac{a}{c}} \]
      4. Step-by-step derivation
        1. lower-/.f6475.2

          \[\leadsto \color{blue}{\frac{a}{c}} \]
      5. Applied rewrites75.2%

        \[\leadsto \color{blue}{\frac{a}{c}} \]
      6. Step-by-step derivation
        1. Applied rewrites75.3%

          \[\leadsto \frac{1}{\color{blue}{\frac{c}{a}}} \]
      7. Recombined 4 regimes into one program.
      8. Add Preprocessing

      Alternative 3: 78.5% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\ \mathbf{if}\;c \leq -82000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (/ (fma (/ b c) d a) c)))
         (if (<= c -82000.0) t_0 (if (<= c 4.5e-61) (/ (fma (/ c d) a b) d) t_0))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma((b / c), d, a) / c;
      	double tmp;
      	if (c <= -82000.0) {
      		tmp = t_0;
      	} else if (c <= 4.5e-61) {
      		tmp = fma((c / d), a, b) / d;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = Float64(fma(Float64(b / c), d, a) / c)
      	tmp = 0.0
      	if (c <= -82000.0)
      		tmp = t_0;
      	elseif (c <= 4.5e-61)
      		tmp = Float64(fma(Float64(c / d), a, b) / d);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b / c), $MachinePrecision] * d + a), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -82000.0], t$95$0, If[LessEqual[c, 4.5e-61], N[(N[(N[(c / d), $MachinePrecision] * a + b), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\
      \mathbf{if}\;c \leq -82000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;c \leq 4.5 \cdot 10^{-61}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < -82000 or 4.5e-61 < c

        1. Initial program 53.1%

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

          \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b \cdot d}{c} + a}}{c} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{d \cdot b}}{c} + a}{c} \]
          4. associate-/l*N/A

            \[\leadsto \frac{\color{blue}{d \cdot \frac{b}{c}} + a}{c} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b}{c} \cdot d} + a}{c} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}}{c} \]
          7. lower-/.f6482.1

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{b}{c}}, d, a\right)}{c} \]
        5. Applied rewrites82.1%

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

        if -82000 < c < 4.5e-61

        1. Initial program 72.2%

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

          \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b \cdot d}{c} + a}}{c} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{d \cdot b}}{c} + a}{c} \]
          4. associate-/l*N/A

            \[\leadsto \frac{\color{blue}{d \cdot \frac{b}{c}} + a}{c} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b}{c} \cdot d} + a}{c} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}}{c} \]
          7. lower-/.f6425.5

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{b}{c}}, d, a\right)}{c} \]
        5. Applied rewrites25.5%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}} \]
        6. Taylor expanded in d around inf

          \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
        7. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{d} + b}}{d} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{d} + b}{d} \]
          4. associate-*l/N/A

            \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot a} + b}{d} \]
          5. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}}{d} \]
          6. lower-/.f6487.4

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, a, b\right)}{d} \]
        8. Applied rewrites87.4%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{c}{d}, a, b\right)}{d}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 4: 77.8% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\ \mathbf{if}\;c \leq -82000:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 4.5 \cdot 10^{-61}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (/ (fma (/ b c) d a) c)))
         (if (<= c -82000.0) t_0 (if (<= c 4.5e-61) (/ (fma (/ a d) c b) d) t_0))))
      double code(double a, double b, double c, double d) {
      	double t_0 = fma((b / c), d, a) / c;
      	double tmp;
      	if (c <= -82000.0) {
      		tmp = t_0;
      	} else if (c <= 4.5e-61) {
      		tmp = fma((a / d), c, b) / d;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	t_0 = Float64(fma(Float64(b / c), d, a) / c)
      	tmp = 0.0
      	if (c <= -82000.0)
      		tmp = t_0;
      	elseif (c <= 4.5e-61)
      		tmp = Float64(fma(Float64(a / d), c, b) / d);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(N[(b / c), $MachinePrecision] * d + a), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -82000.0], t$95$0, If[LessEqual[c, 4.5e-61], N[(N[(N[(a / d), $MachinePrecision] * c + b), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}{c}\\
      \mathbf{if}\;c \leq -82000:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;c \leq 4.5 \cdot 10^{-61}:\\
      \;\;\;\;\frac{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}{d}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if c < -82000 or 4.5e-61 < c

        1. Initial program 53.1%

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

          \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a + \frac{b \cdot d}{c}}{c}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b \cdot d}{c} + a}}{c} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{d \cdot b}}{c} + a}{c} \]
          4. associate-/l*N/A

            \[\leadsto \frac{\color{blue}{d \cdot \frac{b}{c}} + a}{c} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{b}{c} \cdot d} + a}{c} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{b}{c}, d, a\right)}}{c} \]
          7. lower-/.f6482.1

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{b}{c}}, d, a\right)}{c} \]
        5. Applied rewrites82.1%

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

        if -82000 < c < 4.5e-61

        1. Initial program 72.2%

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

          \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
        4. Step-by-step derivation
          1. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{b + \frac{a \cdot c}{d}}{d}} \]
          2. +-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{a \cdot c}{d} + b}}{d} \]
          3. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{c \cdot a}}{d} + b}{d} \]
          4. associate-/l*N/A

            \[\leadsto \frac{\color{blue}{c \cdot \frac{a}{d}} + b}{d} \]
          5. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{\frac{a}{d} \cdot c} + b}{d} \]
          6. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}}{d} \]
          7. lower-/.f6484.6

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{a}{d}}, c, b\right)}{d} \]
        5. Applied rewrites84.6%

          \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(\frac{a}{d}, c, b\right)}{d}} \]
      3. Recombined 2 regimes into one program.
      4. Add Preprocessing

      Alternative 5: 65.9% accurate, 0.9× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1.1 \cdot 10^{+122}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq -1.55 \cdot 10^{-54}:\\ \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot a\\ \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (if (<= c -1.1e+122)
         (/ a c)
         (if (<= c -1.55e-54)
           (* (/ c (fma d d (* c c))) a)
           (if (<= c 5.3e-49) (/ b d) (/ a c)))))
      double code(double a, double b, double c, double d) {
      	double tmp;
      	if (c <= -1.1e+122) {
      		tmp = a / c;
      	} else if (c <= -1.55e-54) {
      		tmp = (c / fma(d, d, (c * c))) * a;
      	} else if (c <= 5.3e-49) {
      		tmp = b / d;
      	} else {
      		tmp = a / c;
      	}
      	return tmp;
      }
      
      function code(a, b, c, d)
      	tmp = 0.0
      	if (c <= -1.1e+122)
      		tmp = Float64(a / c);
      	elseif (c <= -1.55e-54)
      		tmp = Float64(Float64(c / fma(d, d, Float64(c * c))) * a);
      	elseif (c <= 5.3e-49)
      		tmp = Float64(b / d);
      	else
      		tmp = Float64(a / c);
      	end
      	return tmp
      end
      
      code[a_, b_, c_, d_] := If[LessEqual[c, -1.1e+122], N[(a / c), $MachinePrecision], If[LessEqual[c, -1.55e-54], N[(N[(c / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * a), $MachinePrecision], If[LessEqual[c, 5.3e-49], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      \mathbf{if}\;c \leq -1.1 \cdot 10^{+122}:\\
      \;\;\;\;\frac{a}{c}\\
      
      \mathbf{elif}\;c \leq -1.55 \cdot 10^{-54}:\\
      \;\;\;\;\frac{c}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot a\\
      
      \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\
      \;\;\;\;\frac{b}{d}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{a}{c}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if c < -1.1e122 or 5.3000000000000003e-49 < c

        1. Initial program 48.0%

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

          \[\leadsto \color{blue}{\frac{a}{c}} \]
        4. Step-by-step derivation
          1. lower-/.f6468.2

            \[\leadsto \color{blue}{\frac{a}{c}} \]
        5. Applied rewrites68.2%

          \[\leadsto \color{blue}{\frac{a}{c}} \]

        if -1.1e122 < c < -1.55000000000000002e-54

        1. Initial program 78.1%

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

          \[\leadsto \color{blue}{\frac{a \cdot c}{{c}^{2} + {d}^{2}}} \]
        4. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{c \cdot a}}{{c}^{2} + {d}^{2}} \]
          2. associate-/l*N/A

            \[\leadsto \color{blue}{c \cdot \frac{a}{{c}^{2} + {d}^{2}}} \]
          3. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
          4. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
          5. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}}} \cdot c \]
          6. +-commutativeN/A

            \[\leadsto \frac{a}{\color{blue}{{d}^{2} + {c}^{2}}} \cdot c \]
          7. unpow2N/A

            \[\leadsto \frac{a}{\color{blue}{d \cdot d} + {c}^{2}} \cdot c \]
          8. lower-fma.f64N/A

            \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(d, d, {c}^{2}\right)}} \cdot c \]
          9. unpow2N/A

            \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
          10. lower-*.f6468.0

            \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
        5. Applied rewrites68.0%

          \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c} \]
        6. Step-by-step derivation
          1. Applied rewrites69.5%

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

          if -1.55000000000000002e-54 < c < 5.3000000000000003e-49

          1. Initial program 69.4%

            \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. Taylor expanded in c around 0

            \[\leadsto \color{blue}{\frac{b}{d}} \]
          4. Step-by-step derivation
            1. lower-/.f6470.0

              \[\leadsto \color{blue}{\frac{b}{d}} \]
          5. Applied rewrites70.0%

            \[\leadsto \color{blue}{\frac{b}{d}} \]
        7. Recombined 3 regimes into one program.
        8. Add Preprocessing

        Alternative 6: 65.5% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -8.8 \cdot 10^{+121}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq -1.6 \cdot 10^{-54}:\\ \;\;\;\;\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c\\ \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (if (<= c -8.8e+121)
           (/ a c)
           (if (<= c -1.6e-54)
             (* (/ a (fma d d (* c c))) c)
             (if (<= c 5.3e-49) (/ b d) (/ a c)))))
        double code(double a, double b, double c, double d) {
        	double tmp;
        	if (c <= -8.8e+121) {
        		tmp = a / c;
        	} else if (c <= -1.6e-54) {
        		tmp = (a / fma(d, d, (c * c))) * c;
        	} else if (c <= 5.3e-49) {
        		tmp = b / d;
        	} else {
        		tmp = a / c;
        	}
        	return tmp;
        }
        
        function code(a, b, c, d)
        	tmp = 0.0
        	if (c <= -8.8e+121)
        		tmp = Float64(a / c);
        	elseif (c <= -1.6e-54)
        		tmp = Float64(Float64(a / fma(d, d, Float64(c * c))) * c);
        	elseif (c <= 5.3e-49)
        		tmp = Float64(b / d);
        	else
        		tmp = Float64(a / c);
        	end
        	return tmp
        end
        
        code[a_, b_, c_, d_] := If[LessEqual[c, -8.8e+121], N[(a / c), $MachinePrecision], If[LessEqual[c, -1.6e-54], N[(N[(a / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[c, 5.3e-49], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;c \leq -8.8 \cdot 10^{+121}:\\
        \;\;\;\;\frac{a}{c}\\
        
        \mathbf{elif}\;c \leq -1.6 \cdot 10^{-54}:\\
        \;\;\;\;\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c\\
        
        \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\
        \;\;\;\;\frac{b}{d}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{a}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if c < -8.80000000000000005e121 or 5.3000000000000003e-49 < c

          1. Initial program 48.0%

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

            \[\leadsto \color{blue}{\frac{a}{c}} \]
          4. Step-by-step derivation
            1. lower-/.f6468.2

              \[\leadsto \color{blue}{\frac{a}{c}} \]
          5. Applied rewrites68.2%

            \[\leadsto \color{blue}{\frac{a}{c}} \]

          if -8.80000000000000005e121 < c < -1.59999999999999999e-54

          1. Initial program 78.1%

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

            \[\leadsto \color{blue}{\frac{a \cdot c}{{c}^{2} + {d}^{2}}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \frac{\color{blue}{c \cdot a}}{{c}^{2} + {d}^{2}} \]
            2. associate-/l*N/A

              \[\leadsto \color{blue}{c \cdot \frac{a}{{c}^{2} + {d}^{2}}} \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
            5. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}}} \cdot c \]
            6. +-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{{d}^{2} + {c}^{2}}} \cdot c \]
            7. unpow2N/A

              \[\leadsto \frac{a}{\color{blue}{d \cdot d} + {c}^{2}} \cdot c \]
            8. lower-fma.f64N/A

              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(d, d, {c}^{2}\right)}} \cdot c \]
            9. unpow2N/A

              \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
            10. lower-*.f6468.0

              \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
          5. Applied rewrites68.0%

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

          if -1.59999999999999999e-54 < c < 5.3000000000000003e-49

          1. Initial program 69.4%

            \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
          2. Add Preprocessing
          3. Taylor expanded in c around 0

            \[\leadsto \color{blue}{\frac{b}{d}} \]
          4. Step-by-step derivation
            1. lower-/.f6470.0

              \[\leadsto \color{blue}{\frac{b}{d}} \]
          5. Applied rewrites70.0%

            \[\leadsto \color{blue}{\frac{b}{d}} \]
        3. Recombined 3 regimes into one program.
        4. Add Preprocessing

        Alternative 7: 63.5% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -6800000000:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq -9.8 \cdot 10^{-51}:\\ \;\;\;\;\frac{\frac{a}{d}}{d} \cdot c\\ \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (if (<= c -6800000000.0)
           (/ a c)
           (if (<= c -9.8e-51)
             (* (/ (/ a d) d) c)
             (if (<= c 5.3e-49) (/ b d) (/ a c)))))
        double code(double a, double b, double c, double d) {
        	double tmp;
        	if (c <= -6800000000.0) {
        		tmp = a / c;
        	} else if (c <= -9.8e-51) {
        		tmp = ((a / d) / d) * c;
        	} else if (c <= 5.3e-49) {
        		tmp = b / d;
        	} else {
        		tmp = a / c;
        	}
        	return tmp;
        }
        
        real(8) function code(a, b, c, d)
            real(8), intent (in) :: a
            real(8), intent (in) :: b
            real(8), intent (in) :: c
            real(8), intent (in) :: d
            real(8) :: tmp
            if (c <= (-6800000000.0d0)) then
                tmp = a / c
            else if (c <= (-9.8d-51)) then
                tmp = ((a / d) / d) * c
            else if (c <= 5.3d-49) then
                tmp = b / d
            else
                tmp = a / c
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double tmp;
        	if (c <= -6800000000.0) {
        		tmp = a / c;
        	} else if (c <= -9.8e-51) {
        		tmp = ((a / d) / d) * c;
        	} else if (c <= 5.3e-49) {
        		tmp = b / d;
        	} else {
        		tmp = a / c;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	tmp = 0
        	if c <= -6800000000.0:
        		tmp = a / c
        	elif c <= -9.8e-51:
        		tmp = ((a / d) / d) * c
        	elif c <= 5.3e-49:
        		tmp = b / d
        	else:
        		tmp = a / c
        	return tmp
        
        function code(a, b, c, d)
        	tmp = 0.0
        	if (c <= -6800000000.0)
        		tmp = Float64(a / c);
        	elseif (c <= -9.8e-51)
        		tmp = Float64(Float64(Float64(a / d) / d) * c);
        	elseif (c <= 5.3e-49)
        		tmp = Float64(b / d);
        	else
        		tmp = Float64(a / c);
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	tmp = 0.0;
        	if (c <= -6800000000.0)
        		tmp = a / c;
        	elseif (c <= -9.8e-51)
        		tmp = ((a / d) / d) * c;
        	elseif (c <= 5.3e-49)
        		tmp = b / d;
        	else
        		tmp = a / c;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := If[LessEqual[c, -6800000000.0], N[(a / c), $MachinePrecision], If[LessEqual[c, -9.8e-51], N[(N[(N[(a / d), $MachinePrecision] / d), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[c, 5.3e-49], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;c \leq -6800000000:\\
        \;\;\;\;\frac{a}{c}\\
        
        \mathbf{elif}\;c \leq -9.8 \cdot 10^{-51}:\\
        \;\;\;\;\frac{\frac{a}{d}}{d} \cdot c\\
        
        \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\
        \;\;\;\;\frac{b}{d}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{a}{c}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 3 regimes
        2. if c < -6.8e9 or 5.3000000000000003e-49 < c

          1. Initial program 52.5%

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

            \[\leadsto \color{blue}{\frac{a}{c}} \]
          4. Step-by-step derivation
            1. lower-/.f6465.6

              \[\leadsto \color{blue}{\frac{a}{c}} \]
          5. Applied rewrites65.6%

            \[\leadsto \color{blue}{\frac{a}{c}} \]

          if -6.8e9 < c < -9.79999999999999948e-51

          1. Initial program 93.3%

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

            \[\leadsto \color{blue}{\frac{a \cdot c}{{c}^{2} + {d}^{2}}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \frac{\color{blue}{c \cdot a}}{{c}^{2} + {d}^{2}} \]
            2. associate-/l*N/A

              \[\leadsto \color{blue}{c \cdot \frac{a}{{c}^{2} + {d}^{2}}} \]
            3. *-commutativeN/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
            4. lower-*.f64N/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
            5. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}}} \cdot c \]
            6. +-commutativeN/A

              \[\leadsto \frac{a}{\color{blue}{{d}^{2} + {c}^{2}}} \cdot c \]
            7. unpow2N/A

              \[\leadsto \frac{a}{\color{blue}{d \cdot d} + {c}^{2}} \cdot c \]
            8. lower-fma.f64N/A

              \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(d, d, {c}^{2}\right)}} \cdot c \]
            9. unpow2N/A

              \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
            10. lower-*.f6474.0

              \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
          5. Applied rewrites74.0%

            \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c} \]
          6. Taylor expanded in c around 0

            \[\leadsto \frac{a}{{d}^{2}} \cdot c \]
          7. Step-by-step derivation
            1. Applied rewrites67.7%

              \[\leadsto \frac{\frac{a}{d}}{d} \cdot c \]

            if -9.79999999999999948e-51 < c < 5.3000000000000003e-49

            1. Initial program 69.4%

              \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
            2. Add Preprocessing
            3. Taylor expanded in c around 0

              \[\leadsto \color{blue}{\frac{b}{d}} \]
            4. Step-by-step derivation
              1. lower-/.f6470.0

                \[\leadsto \color{blue}{\frac{b}{d}} \]
            5. Applied rewrites70.0%

              \[\leadsto \color{blue}{\frac{b}{d}} \]
          8. Recombined 3 regimes into one program.
          9. Add Preprocessing

          Alternative 8: 63.4% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -300000:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq -9.8 \cdot 10^{-51}:\\ \;\;\;\;\frac{a}{d \cdot d} \cdot c\\ \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \end{array} \]
          (FPCore (a b c d)
           :precision binary64
           (if (<= c -300000.0)
             (/ a c)
             (if (<= c -9.8e-51)
               (* (/ a (* d d)) c)
               (if (<= c 5.3e-49) (/ b d) (/ a c)))))
          double code(double a, double b, double c, double d) {
          	double tmp;
          	if (c <= -300000.0) {
          		tmp = a / c;
          	} else if (c <= -9.8e-51) {
          		tmp = (a / (d * d)) * c;
          	} else if (c <= 5.3e-49) {
          		tmp = b / d;
          	} else {
          		tmp = a / c;
          	}
          	return tmp;
          }
          
          real(8) function code(a, b, c, d)
              real(8), intent (in) :: a
              real(8), intent (in) :: b
              real(8), intent (in) :: c
              real(8), intent (in) :: d
              real(8) :: tmp
              if (c <= (-300000.0d0)) then
                  tmp = a / c
              else if (c <= (-9.8d-51)) then
                  tmp = (a / (d * d)) * c
              else if (c <= 5.3d-49) then
                  tmp = b / d
              else
                  tmp = a / c
              end if
              code = tmp
          end function
          
          public static double code(double a, double b, double c, double d) {
          	double tmp;
          	if (c <= -300000.0) {
          		tmp = a / c;
          	} else if (c <= -9.8e-51) {
          		tmp = (a / (d * d)) * c;
          	} else if (c <= 5.3e-49) {
          		tmp = b / d;
          	} else {
          		tmp = a / c;
          	}
          	return tmp;
          }
          
          def code(a, b, c, d):
          	tmp = 0
          	if c <= -300000.0:
          		tmp = a / c
          	elif c <= -9.8e-51:
          		tmp = (a / (d * d)) * c
          	elif c <= 5.3e-49:
          		tmp = b / d
          	else:
          		tmp = a / c
          	return tmp
          
          function code(a, b, c, d)
          	tmp = 0.0
          	if (c <= -300000.0)
          		tmp = Float64(a / c);
          	elseif (c <= -9.8e-51)
          		tmp = Float64(Float64(a / Float64(d * d)) * c);
          	elseif (c <= 5.3e-49)
          		tmp = Float64(b / d);
          	else
          		tmp = Float64(a / c);
          	end
          	return tmp
          end
          
          function tmp_2 = code(a, b, c, d)
          	tmp = 0.0;
          	if (c <= -300000.0)
          		tmp = a / c;
          	elseif (c <= -9.8e-51)
          		tmp = (a / (d * d)) * c;
          	elseif (c <= 5.3e-49)
          		tmp = b / d;
          	else
          		tmp = a / c;
          	end
          	tmp_2 = tmp;
          end
          
          code[a_, b_, c_, d_] := If[LessEqual[c, -300000.0], N[(a / c), $MachinePrecision], If[LessEqual[c, -9.8e-51], N[(N[(a / N[(d * d), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision], If[LessEqual[c, 5.3e-49], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;c \leq -300000:\\
          \;\;\;\;\frac{a}{c}\\
          
          \mathbf{elif}\;c \leq -9.8 \cdot 10^{-51}:\\
          \;\;\;\;\frac{a}{d \cdot d} \cdot c\\
          
          \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\
          \;\;\;\;\frac{b}{d}\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{a}{c}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if c < -3e5 or 5.3000000000000003e-49 < c

            1. Initial program 52.5%

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

              \[\leadsto \color{blue}{\frac{a}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f6465.6

                \[\leadsto \color{blue}{\frac{a}{c}} \]
            5. Applied rewrites65.6%

              \[\leadsto \color{blue}{\frac{a}{c}} \]

            if -3e5 < c < -9.79999999999999948e-51

            1. Initial program 93.3%

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

              \[\leadsto \color{blue}{\frac{a \cdot c}{{c}^{2} + {d}^{2}}} \]
            4. Step-by-step derivation
              1. *-commutativeN/A

                \[\leadsto \frac{\color{blue}{c \cdot a}}{{c}^{2} + {d}^{2}} \]
              2. associate-/l*N/A

                \[\leadsto \color{blue}{c \cdot \frac{a}{{c}^{2} + {d}^{2}}} \]
              3. *-commutativeN/A

                \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
              4. lower-*.f64N/A

                \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}} \cdot c} \]
              5. lower-/.f64N/A

                \[\leadsto \color{blue}{\frac{a}{{c}^{2} + {d}^{2}}} \cdot c \]
              6. +-commutativeN/A

                \[\leadsto \frac{a}{\color{blue}{{d}^{2} + {c}^{2}}} \cdot c \]
              7. unpow2N/A

                \[\leadsto \frac{a}{\color{blue}{d \cdot d} + {c}^{2}} \cdot c \]
              8. lower-fma.f64N/A

                \[\leadsto \frac{a}{\color{blue}{\mathsf{fma}\left(d, d, {c}^{2}\right)}} \cdot c \]
              9. unpow2N/A

                \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
              10. lower-*.f6474.0

                \[\leadsto \frac{a}{\mathsf{fma}\left(d, d, \color{blue}{c \cdot c}\right)} \cdot c \]
            5. Applied rewrites74.0%

              \[\leadsto \color{blue}{\frac{a}{\mathsf{fma}\left(d, d, c \cdot c\right)} \cdot c} \]
            6. Taylor expanded in c around 0

              \[\leadsto \frac{a}{{d}^{2}} \cdot c \]
            7. Step-by-step derivation
              1. Applied rewrites61.2%

                \[\leadsto \frac{a}{d \cdot d} \cdot c \]

              if -9.79999999999999948e-51 < c < 5.3000000000000003e-49

              1. Initial program 69.4%

                \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
              2. Add Preprocessing
              3. Taylor expanded in c around 0

                \[\leadsto \color{blue}{\frac{b}{d}} \]
              4. Step-by-step derivation
                1. lower-/.f6470.0

                  \[\leadsto \color{blue}{\frac{b}{d}} \]
              5. Applied rewrites70.0%

                \[\leadsto \color{blue}{\frac{b}{d}} \]
            8. Recombined 3 regimes into one program.
            9. Add Preprocessing

            Alternative 9: 64.3% accurate, 1.6× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -7.8 \cdot 10^{-38}:\\ \;\;\;\;\frac{a}{c}\\ \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\ \;\;\;\;\frac{b}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{a}{c}\\ \end{array} \end{array} \]
            (FPCore (a b c d)
             :precision binary64
             (if (<= c -7.8e-38) (/ a c) (if (<= c 5.3e-49) (/ b d) (/ a c))))
            double code(double a, double b, double c, double d) {
            	double tmp;
            	if (c <= -7.8e-38) {
            		tmp = a / c;
            	} else if (c <= 5.3e-49) {
            		tmp = b / d;
            	} else {
            		tmp = a / c;
            	}
            	return tmp;
            }
            
            real(8) function code(a, b, c, d)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: c
                real(8), intent (in) :: d
                real(8) :: tmp
                if (c <= (-7.8d-38)) then
                    tmp = a / c
                else if (c <= 5.3d-49) then
                    tmp = b / d
                else
                    tmp = a / c
                end if
                code = tmp
            end function
            
            public static double code(double a, double b, double c, double d) {
            	double tmp;
            	if (c <= -7.8e-38) {
            		tmp = a / c;
            	} else if (c <= 5.3e-49) {
            		tmp = b / d;
            	} else {
            		tmp = a / c;
            	}
            	return tmp;
            }
            
            def code(a, b, c, d):
            	tmp = 0
            	if c <= -7.8e-38:
            		tmp = a / c
            	elif c <= 5.3e-49:
            		tmp = b / d
            	else:
            		tmp = a / c
            	return tmp
            
            function code(a, b, c, d)
            	tmp = 0.0
            	if (c <= -7.8e-38)
            		tmp = Float64(a / c);
            	elseif (c <= 5.3e-49)
            		tmp = Float64(b / d);
            	else
            		tmp = Float64(a / c);
            	end
            	return tmp
            end
            
            function tmp_2 = code(a, b, c, d)
            	tmp = 0.0;
            	if (c <= -7.8e-38)
            		tmp = a / c;
            	elseif (c <= 5.3e-49)
            		tmp = b / d;
            	else
            		tmp = a / c;
            	end
            	tmp_2 = tmp;
            end
            
            code[a_, b_, c_, d_] := If[LessEqual[c, -7.8e-38], N[(a / c), $MachinePrecision], If[LessEqual[c, 5.3e-49], N[(b / d), $MachinePrecision], N[(a / c), $MachinePrecision]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;c \leq -7.8 \cdot 10^{-38}:\\
            \;\;\;\;\frac{a}{c}\\
            
            \mathbf{elif}\;c \leq 5.3 \cdot 10^{-49}:\\
            \;\;\;\;\frac{b}{d}\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{a}{c}\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if c < -7.7999999999999998e-38 or 5.3000000000000003e-49 < c

              1. Initial program 55.2%

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

                \[\leadsto \color{blue}{\frac{a}{c}} \]
              4. Step-by-step derivation
                1. lower-/.f6463.3

                  \[\leadsto \color{blue}{\frac{a}{c}} \]
              5. Applied rewrites63.3%

                \[\leadsto \color{blue}{\frac{a}{c}} \]

              if -7.7999999999999998e-38 < c < 5.3000000000000003e-49

              1. Initial program 70.3%

                \[\frac{a \cdot c + b \cdot d}{c \cdot c + d \cdot d} \]
              2. Add Preprocessing
              3. Taylor expanded in c around 0

                \[\leadsto \color{blue}{\frac{b}{d}} \]
              4. Step-by-step derivation
                1. lower-/.f6466.9

                  \[\leadsto \color{blue}{\frac{b}{d}} \]
              5. Applied rewrites66.9%

                \[\leadsto \color{blue}{\frac{b}{d}} \]
            3. Recombined 2 regimes into one program.
            4. Add Preprocessing

            Alternative 10: 42.6% accurate, 3.2× speedup?

            \[\begin{array}{l} \\ \frac{a}{c} \end{array} \]
            (FPCore (a b c d) :precision binary64 (/ a c))
            double code(double a, double b, double c, double d) {
            	return a / c;
            }
            
            real(8) function code(a, b, c, d)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: c
                real(8), intent (in) :: d
                code = a / c
            end function
            
            public static double code(double a, double b, double c, double d) {
            	return a / c;
            }
            
            def code(a, b, c, d):
            	return a / c
            
            function code(a, b, c, d)
            	return Float64(a / c)
            end
            
            function tmp = code(a, b, c, d)
            	tmp = a / c;
            end
            
            code[a_, b_, c_, d_] := N[(a / c), $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \frac{a}{c}
            \end{array}
            
            Derivation
            1. Initial program 61.0%

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

              \[\leadsto \color{blue}{\frac{a}{c}} \]
            4. Step-by-step derivation
              1. lower-/.f6444.7

                \[\leadsto \color{blue}{\frac{a}{c}} \]
            5. Applied rewrites44.7%

              \[\leadsto \color{blue}{\frac{a}{c}} \]
            6. Add Preprocessing

            Developer Target 1: 99.4% accurate, 0.6× speedup?

            \[\begin{array}{l} \\ \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} \end{array} \]
            (FPCore (a b c d)
             :precision binary64
             (if (< (fabs d) (fabs c))
               (/ (+ a (* b (/ d c))) (+ c (* d (/ d c))))
               (/ (+ b (* a (/ c d))) (+ d (* c (/ c d))))))
            double code(double a, double b, double c, double d) {
            	double tmp;
            	if (fabs(d) < fabs(c)) {
            		tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
            	} else {
            		tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
            	}
            	return tmp;
            }
            
            real(8) function code(a, b, c, d)
                real(8), intent (in) :: a
                real(8), intent (in) :: b
                real(8), intent (in) :: c
                real(8), intent (in) :: d
                real(8) :: tmp
                if (abs(d) < abs(c)) then
                    tmp = (a + (b * (d / c))) / (c + (d * (d / c)))
                else
                    tmp = (b + (a * (c / d))) / (d + (c * (c / d)))
                end if
                code = tmp
            end function
            
            public static double code(double a, double b, double c, double d) {
            	double tmp;
            	if (Math.abs(d) < Math.abs(c)) {
            		tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
            	} else {
            		tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
            	}
            	return tmp;
            }
            
            def code(a, b, c, d):
            	tmp = 0
            	if math.fabs(d) < math.fabs(c):
            		tmp = (a + (b * (d / c))) / (c + (d * (d / c)))
            	else:
            		tmp = (b + (a * (c / d))) / (d + (c * (c / d)))
            	return tmp
            
            function code(a, b, c, d)
            	tmp = 0.0
            	if (abs(d) < abs(c))
            		tmp = Float64(Float64(a + Float64(b * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
            	else
            		tmp = Float64(Float64(b + Float64(a * Float64(c / d))) / Float64(d + Float64(c * Float64(c / d))));
            	end
            	return tmp
            end
            
            function tmp_2 = code(a, b, c, d)
            	tmp = 0.0;
            	if (abs(d) < abs(c))
            		tmp = (a + (b * (d / c))) / (c + (d * (d / c)));
            	else
            		tmp = (b + (a * (c / d))) / (d + (c * (c / d)));
            	end
            	tmp_2 = tmp;
            end
            
            code[a_, b_, c_, d_] := If[Less[N[Abs[d], $MachinePrecision], N[Abs[c], $MachinePrecision]], N[(N[(a + N[(b * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b + N[(a * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(d + N[(c * N[(c / d), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \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}
            \end{array}
            

            Reproduce

            ?
            herbie shell --seed 2024295 
            (FPCore (a b c d)
              :name "Complex division, real part"
              :precision binary64
            
              :alt
              (! :herbie-platform default (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))))