Complex division, imag part

Percentage Accurate: 61.4% → 79.1%
Time: 8.4s
Alternatives: 18
Speedup: 1.5×

Specification

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

\\
\frac{b \cdot c - a \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 18 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.4% accurate, 1.0× speedup?

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

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

Alternative 1: 79.1% accurate, 0.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)\\ t_1 := \frac{t\_0}{c}\\ t_2 := \frac{0}{c \cdot c}\\ t_3 := 1 - t\_2\\ t_4 := \mathsf{fma}\left(t\_1, \frac{0}{c}, \frac{t\_3 \cdot b}{{c}^{3}}\right)\\ \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{+114}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-\mathsf{fma}\left(\mathsf{fma}\left(-b, \frac{\left(-1 - t\_2\right) \cdot 0}{{c}^{5}}, \mathsf{fma}\left(0, \frac{t\_4}{c \cdot c}, \frac{t\_3}{c} \cdot t\_1\right)\right), d, t\_4\right), d, t\_0\right), d, \frac{b}{c}\right)\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (fma (/ a (* c c)) -1.0 (* (/ 0.0 (pow c 3.0)) b)))
        (t_1 (/ t_0 c))
        (t_2 (/ 0.0 (* c c)))
        (t_3 (- 1.0 t_2))
        (t_4 (fma t_1 (/ 0.0 c) (/ (* t_3 b) (pow c 3.0)))))
   (if (<= c -2.4e-34)
     (fma (/ (- a) c) (/ d c) (/ b c))
     (if (<= c 2.4e-142)
       (/ (fma (/ c d) b (- a)) d)
       (if (<= c 1.05e+114)
         (/ (- (* b c) (* d a)) (fma d d (* c c)))
         (fma
          (fma
           (-
            (fma
             (fma
              (- b)
              (/ (* (- -1.0 t_2) 0.0) (pow c 5.0))
              (fma 0.0 (/ t_4 (* c c)) (* (/ t_3 c) t_1)))
             d
             t_4))
           d
           t_0)
          d
          (/ b c)))))))
double code(double a, double b, double c, double d) {
	double t_0 = fma((a / (c * c)), -1.0, ((0.0 / pow(c, 3.0)) * b));
	double t_1 = t_0 / c;
	double t_2 = 0.0 / (c * c);
	double t_3 = 1.0 - t_2;
	double t_4 = fma(t_1, (0.0 / c), ((t_3 * b) / pow(c, 3.0)));
	double tmp;
	if (c <= -2.4e-34) {
		tmp = fma((-a / c), (d / c), (b / c));
	} else if (c <= 2.4e-142) {
		tmp = fma((c / d), b, -a) / d;
	} else if (c <= 1.05e+114) {
		tmp = ((b * c) - (d * a)) / fma(d, d, (c * c));
	} else {
		tmp = fma(fma(-fma(fma(-b, (((-1.0 - t_2) * 0.0) / pow(c, 5.0)), fma(0.0, (t_4 / (c * c)), ((t_3 / c) * t_1))), d, t_4), d, t_0), d, (b / c));
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = fma(Float64(a / Float64(c * c)), -1.0, Float64(Float64(0.0 / (c ^ 3.0)) * b))
	t_1 = Float64(t_0 / c)
	t_2 = Float64(0.0 / Float64(c * c))
	t_3 = Float64(1.0 - t_2)
	t_4 = fma(t_1, Float64(0.0 / c), Float64(Float64(t_3 * b) / (c ^ 3.0)))
	tmp = 0.0
	if (c <= -2.4e-34)
		tmp = fma(Float64(Float64(-a) / c), Float64(d / c), Float64(b / c));
	elseif (c <= 2.4e-142)
		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
	elseif (c <= 1.05e+114)
		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / fma(d, d, Float64(c * c)));
	else
		tmp = fma(fma(Float64(-fma(fma(Float64(-b), Float64(Float64(Float64(-1.0 - t_2) * 0.0) / (c ^ 5.0)), fma(0.0, Float64(t_4 / Float64(c * c)), Float64(Float64(t_3 / c) * t_1))), d, t_4)), d, t_0), d, Float64(b / c));
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(a / N[(c * c), $MachinePrecision]), $MachinePrecision] * -1.0 + N[(N[(0.0 / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / c), $MachinePrecision]}, Block[{t$95$2 = N[(0.0 / N[(c * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(1.0 - t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$1 * N[(0.0 / c), $MachinePrecision] + N[(N[(t$95$3 * b), $MachinePrecision] / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -2.4e-34], N[(N[((-a) / c), $MachinePrecision] * N[(d / c), $MachinePrecision] + N[(b / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.4e-142], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.05e+114], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-N[(N[((-b) * N[(N[(N[(-1.0 - t$95$2), $MachinePrecision] * 0.0), $MachinePrecision] / N[Power[c, 5.0], $MachinePrecision]), $MachinePrecision] + N[(0.0 * N[(t$95$4 / N[(c * c), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$3 / c), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * d + t$95$4), $MachinePrecision]) * d + t$95$0), $MachinePrecision] * d + N[(b / c), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)\\
t_1 := \frac{t\_0}{c}\\
t_2 := \frac{0}{c \cdot c}\\
t_3 := 1 - t\_2\\
t_4 := \mathsf{fma}\left(t\_1, \frac{0}{c}, \frac{t\_3 \cdot b}{{c}^{3}}\right)\\
\mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-\mathsf{fma}\left(\mathsf{fma}\left(-b, \frac{\left(-1 - t\_2\right) \cdot 0}{{c}^{5}}, \mathsf{fma}\left(0, \frac{t\_4}{c \cdot c}, \frac{t\_3}{c} \cdot t\_1\right)\right), d, t\_4\right), d, t\_0\right), d, \frac{b}{c}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -2.39999999999999991e-34

    1. Initial program 49.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6449.2

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(a \cdot d\right)}{{c}^{2}}} + \frac{b}{c} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{{c}^{2}} + \frac{b}{c} \]
      3. unpow2N/A

        \[\leadsto \frac{\left(-1 \cdot a\right) \cdot d}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-fracN/A

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

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

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

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

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

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

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

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

    if -2.39999999999999991e-34 < c < 2.39999999999999988e-142

    1. Initial program 70.4%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6464.3

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites64.3%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
      3. div-subN/A

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

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      7. distribute-lft-neg-outN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      8. lift-neg.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      10. frac-subN/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
    7. Applied rewrites32.4%

      \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
    8. Taylor expanded in c around inf

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
      8. mul-1-negN/A

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

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

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

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

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

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. unpow2N/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
      6. div-subN/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
      8. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + \left(\mathsf{neg}\left(a\right)\right)}}{d} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      10. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot b} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      11. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, b, -1 \cdot a\right)}{d} \]
      14. mul-1-negN/A

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

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

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

    if 2.39999999999999988e-142 < c < 1.05e114

    1. Initial program 79.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6479.8

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

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

    if 1.05e114 < c

    1. Initial program 38.4%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\frac{\left(c \cdot c\right) \cdot \left(c \cdot c\right) - \left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}}} \]
      3. div-subN/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\frac{\left(c \cdot c\right) \cdot \left(c \cdot c\right)}{c \cdot c - d \cdot d} - \frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}}} \]
      4. sub-negN/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\frac{\left(c \cdot c\right) \cdot \left(c \cdot c\right)}{c \cdot c - d \cdot d} + \left(\mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)}} \]
      5. associate-/l*N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\left(c \cdot c\right) \cdot \frac{c \cdot c}{c \cdot c - d \cdot d}} + \left(\mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      6. lower-fma.f64N/A

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \color{blue}{\frac{c \cdot c}{c \cdot c - d \cdot d}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      8. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\color{blue}{c \cdot c} - d \cdot d}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{c \cdot c - \color{blue}{d \cdot d}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      10. difference-of-squaresN/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\color{blue}{\left(c + d\right) \cdot \left(c - d\right)}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      11. *-commutativeN/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\color{blue}{\left(c - d\right) \cdot \left(c + d\right)}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\color{blue}{\left(c - d\right) \cdot \left(c + d\right)}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      13. lower--.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\color{blue}{\left(c - d\right)} \cdot \left(c + d\right)}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      14. +-commutativeN/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\left(c - d\right) \cdot \color{blue}{\left(d + c\right)}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      15. lower-+.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\left(c - d\right) \cdot \color{blue}{\left(d + c\right)}}, \mathsf{neg}\left(\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}\right)\right)} \]
      16. lower-neg.f64N/A

        \[\leadsto \frac{b \cdot c - a \cdot d}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\left(c - d\right) \cdot \left(d + c\right)}, \color{blue}{-\frac{\left(d \cdot d\right) \cdot \left(d \cdot d\right)}{c \cdot c - d \cdot d}}\right)} \]
      17. lower-/.f64N/A

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

      \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{\mathsf{fma}\left(c \cdot c, \frac{c \cdot c}{\left(c - d\right) \cdot \left(d + c\right)}, -\frac{{d}^{4}}{\left(c - d\right) \cdot \left(d + c\right)}\right)}} \]
    5. Taylor expanded in d around 0

      \[\leadsto \color{blue}{d \cdot \left(\left(-1 \cdot \frac{a}{{c}^{2}} + d \cdot \left(-1 \cdot \left(d \cdot \left(-1 \cdot \frac{b \cdot \left(\left(c + -1 \cdot c\right) \cdot \left(1 - -1 \cdot \frac{{\left(c + -1 \cdot c\right)}^{2}}{{c}^{2}}\right)\right)}{{c}^{5}} + \left(\frac{\left(c + -1 \cdot c\right) \cdot \left(-1 \cdot \frac{\left(c + -1 \cdot c\right) \cdot \left(-1 \cdot \frac{a}{{c}^{2}} - -1 \cdot \frac{b \cdot \left(c + -1 \cdot c\right)}{{c}^{3}}\right)}{{c}^{2}} + \frac{b \cdot \left(1 - -1 \cdot \frac{{\left(c + -1 \cdot c\right)}^{2}}{{c}^{2}}\right)}{{c}^{3}}\right)}{{c}^{2}} + \frac{\left(1 - -1 \cdot \frac{{\left(c + -1 \cdot c\right)}^{2}}{{c}^{2}}\right) \cdot \left(-1 \cdot \frac{a}{{c}^{2}} - -1 \cdot \frac{b \cdot \left(c + -1 \cdot c\right)}{{c}^{3}}\right)}{{c}^{2}}\right)\right)\right) - \left(-1 \cdot \frac{\left(c + -1 \cdot c\right) \cdot \left(-1 \cdot \frac{a}{{c}^{2}} - -1 \cdot \frac{b \cdot \left(c + -1 \cdot c\right)}{{c}^{3}}\right)}{{c}^{2}} + \frac{b \cdot \left(1 - -1 \cdot \frac{{\left(c + -1 \cdot c\right)}^{2}}{{c}^{2}}\right)}{{c}^{3}}\right)\right)\right) - -1 \cdot \frac{b \cdot \left(c + -1 \cdot c\right)}{{c}^{3}}\right) + \frac{b}{c}} \]
    6. Applied rewrites91.9%

      \[\leadsto \color{blue}{\mathsf{fma}\left(\mathsf{fma}\left(-\mathsf{fma}\left(\mathsf{fma}\left(-b, \frac{0 \cdot \left(1 - \frac{0}{c \cdot c}\right)}{{c}^{5}}, \mathsf{fma}\left(0, \frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, b \cdot \frac{0}{{c}^{3}}\right)}{c}, \frac{0}{c}, \frac{\left(1 - \frac{0}{c \cdot c}\right) \cdot b}{{c}^{3}}\right)}{c \cdot c}, \frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, b \cdot \frac{0}{{c}^{3}}\right)}{c} \cdot \frac{1 - \frac{0}{c \cdot c}}{c}\right)\right), d, \mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, b \cdot \frac{0}{{c}^{3}}\right)}{c}, \frac{0}{c}, \frac{\left(1 - \frac{0}{c \cdot c}\right) \cdot b}{{c}^{3}}\right)\right), d, \mathsf{fma}\left(\frac{a}{c \cdot c}, -1, b \cdot \frac{0}{{c}^{3}}\right)\right), d, \frac{b}{c}\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{+114}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\mathsf{fma}\left(-\mathsf{fma}\left(\mathsf{fma}\left(-b, \frac{\left(-1 - \frac{0}{c \cdot c}\right) \cdot 0}{{c}^{5}}, \mathsf{fma}\left(0, \frac{\mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)}{c}, \frac{0}{c}, \frac{\left(1 - \frac{0}{c \cdot c}\right) \cdot b}{{c}^{3}}\right)}{c \cdot c}, \frac{1 - \frac{0}{c \cdot c}}{c} \cdot \frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)}{c}\right)\right), d, \mathsf{fma}\left(\frac{\mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)}{c}, \frac{0}{c}, \frac{\left(1 - \frac{0}{c \cdot c}\right) \cdot b}{{c}^{3}}\right)\right), d, \mathsf{fma}\left(\frac{a}{c \cdot c}, -1, \frac{0}{{c}^{3}} \cdot b\right)\right), d, \frac{b}{c}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.1% accurate, 0.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{+114}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{c \cdot c}\right), d, \frac{b}{c}\right)\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (if (<= c -2.4e-34)
   (fma (/ (- a) c) (/ d c) (/ b c))
   (if (<= c 2.4e-142)
     (/ (fma (/ c d) b (- a)) d)
     (if (<= c 1.05e+114)
       (/ (- (* b c) (* d a)) (fma d d (* c c)))
       (fma (- (fma b (/ d (pow c 3.0)) (/ a (* c c)))) d (/ b c))))))
double code(double a, double b, double c, double d) {
	double tmp;
	if (c <= -2.4e-34) {
		tmp = fma((-a / c), (d / c), (b / c));
	} else if (c <= 2.4e-142) {
		tmp = fma((c / d), b, -a) / d;
	} else if (c <= 1.05e+114) {
		tmp = ((b * c) - (d * a)) / fma(d, d, (c * c));
	} else {
		tmp = fma(-fma(b, (d / pow(c, 3.0)), (a / (c * c))), d, (b / c));
	}
	return tmp;
}
function code(a, b, c, d)
	tmp = 0.0
	if (c <= -2.4e-34)
		tmp = fma(Float64(Float64(-a) / c), Float64(d / c), Float64(b / c));
	elseif (c <= 2.4e-142)
		tmp = Float64(fma(Float64(c / d), b, Float64(-a)) / d);
	elseif (c <= 1.05e+114)
		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / fma(d, d, Float64(c * c)));
	else
		tmp = fma(Float64(-fma(b, Float64(d / (c ^ 3.0)), Float64(a / Float64(c * c)))), d, Float64(b / c));
	end
	return tmp
end
code[a_, b_, c_, d_] := If[LessEqual[c, -2.4e-34], N[(N[((-a) / c), $MachinePrecision] * N[(d / c), $MachinePrecision] + N[(b / c), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.4e-142], N[(N[(N[(c / d), $MachinePrecision] * b + (-a)), $MachinePrecision] / d), $MachinePrecision], If[LessEqual[c, 1.05e+114], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[((-N[(b * N[(d / N[Power[c, 3.0], $MachinePrecision]), $MachinePrecision] + N[(a / N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]) * d + N[(b / c), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\

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

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

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{c \cdot c}\right), d, \frac{b}{c}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -2.39999999999999991e-34

    1. Initial program 49.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6449.2

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(a \cdot d\right)}{{c}^{2}}} + \frac{b}{c} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{{c}^{2}} + \frac{b}{c} \]
      3. unpow2N/A

        \[\leadsto \frac{\left(-1 \cdot a\right) \cdot d}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-fracN/A

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

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

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

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

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

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

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

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

    if -2.39999999999999991e-34 < c < 2.39999999999999988e-142

    1. Initial program 70.4%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6464.3

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites64.3%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
      3. div-subN/A

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

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      7. distribute-lft-neg-outN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      8. lift-neg.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      10. frac-subN/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
    7. Applied rewrites32.4%

      \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
    8. Taylor expanded in c around inf

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
      8. mul-1-negN/A

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

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

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

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

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

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. unpow2N/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
      6. div-subN/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
      8. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + \left(\mathsf{neg}\left(a\right)\right)}}{d} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      10. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot b} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      11. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, b, -1 \cdot a\right)}{d} \]
      14. mul-1-negN/A

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

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

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

    if 2.39999999999999988e-142 < c < 1.05e114

    1. Initial program 79.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6479.8

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

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

    if 1.05e114 < c

    1. Initial program 38.4%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6438.4

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

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

      \[\leadsto \color{blue}{d \cdot \left(-1 \cdot \frac{a}{{c}^{2}} + -1 \cdot \frac{b \cdot d}{{c}^{3}}\right) + \frac{b}{c}} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{\left(-1 \cdot \frac{a}{{c}^{2}} + -1 \cdot \frac{b \cdot d}{{c}^{3}}\right) \cdot d} + \frac{b}{c} \]
      2. lower-fma.f64N/A

        \[\leadsto \color{blue}{\mathsf{fma}\left(-1 \cdot \frac{a}{{c}^{2}} + -1 \cdot \frac{b \cdot d}{{c}^{3}}, d, \frac{b}{c}\right)} \]
      3. +-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{-1 \cdot \frac{b \cdot d}{{c}^{3}} + -1 \cdot \frac{a}{{c}^{2}}}, d, \frac{b}{c}\right) \]
      4. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\left(\mathsf{neg}\left(\frac{b \cdot d}{{c}^{3}}\right)\right)} + -1 \cdot \frac{a}{{c}^{2}}, d, \frac{b}{c}\right) \]
      5. mul-1-negN/A

        \[\leadsto \mathsf{fma}\left(\left(\mathsf{neg}\left(\frac{b \cdot d}{{c}^{3}}\right)\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{{c}^{2}}\right)\right)}, d, \frac{b}{c}\right) \]
      6. distribute-neg-outN/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{\mathsf{neg}\left(\left(\frac{b \cdot d}{{c}^{3}} + \frac{a}{{c}^{2}}\right)\right)}, d, \frac{b}{c}\right) \]
      7. lower-neg.f64N/A

        \[\leadsto \mathsf{fma}\left(\color{blue}{-\left(\frac{b \cdot d}{{c}^{3}} + \frac{a}{{c}^{2}}\right)}, d, \frac{b}{c}\right) \]
      8. associate-/l*N/A

        \[\leadsto \mathsf{fma}\left(-\left(\color{blue}{b \cdot \frac{d}{{c}^{3}}} + \frac{a}{{c}^{2}}\right), d, \frac{b}{c}\right) \]
      9. lower-fma.f64N/A

        \[\leadsto \mathsf{fma}\left(-\color{blue}{\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{{c}^{2}}\right)}, d, \frac{b}{c}\right) \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(-\mathsf{fma}\left(b, \color{blue}{\frac{d}{{c}^{3}}}, \frac{a}{{c}^{2}}\right), d, \frac{b}{c}\right) \]
      11. lower-pow.f64N/A

        \[\leadsto \mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{\color{blue}{{c}^{3}}}, \frac{a}{{c}^{2}}\right), d, \frac{b}{c}\right) \]
      12. lower-/.f64N/A

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

        \[\leadsto \mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{\color{blue}{c \cdot c}}\right), d, \frac{b}{c}\right) \]
      14. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{\color{blue}{c \cdot c}}\right), d, \frac{b}{c}\right) \]
      15. lower-/.f6491.9

        \[\leadsto \mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{c \cdot c}\right), d, \color{blue}{\frac{b}{c}}\right) \]
    7. Applied rewrites91.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.05 \cdot 10^{+114}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(-\mathsf{fma}\left(b, \frac{d}{{c}^{3}}, \frac{a}{c \cdot c}\right), d, \frac{b}{c}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 66.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ t_1 := \left(-d\right) \cdot a\\ \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, b, t\_1\right)}{c \cdot c}\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{t\_1}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- a) d)) (t_1 (* (- d) a)))
   (if (<= d -8.6e+58)
     t_0
     (if (<= d -6.6e-60)
       (/ (- (* b c) (* d a)) (* d d))
       (if (<= d -1.15e-149)
         (/ (fma c b t_1) (* c c))
         (if (<= d 9.2e-115)
           (/ b c)
           (if (<= d 2.6e+89) (/ t_1 (fma d d (* c c))) t_0)))))))
double code(double a, double b, double c, double d) {
	double t_0 = -a / d;
	double t_1 = -d * a;
	double tmp;
	if (d <= -8.6e+58) {
		tmp = t_0;
	} else if (d <= -6.6e-60) {
		tmp = ((b * c) - (d * a)) / (d * d);
	} else if (d <= -1.15e-149) {
		tmp = fma(c, b, t_1) / (c * c);
	} else if (d <= 9.2e-115) {
		tmp = b / c;
	} else if (d <= 2.6e+89) {
		tmp = t_1 / fma(d, d, (c * c));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(-a) / d)
	t_1 = Float64(Float64(-d) * a)
	tmp = 0.0
	if (d <= -8.6e+58)
		tmp = t_0;
	elseif (d <= -6.6e-60)
		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(d * d));
	elseif (d <= -1.15e-149)
		tmp = Float64(fma(c, b, t_1) / Float64(c * c));
	elseif (d <= 9.2e-115)
		tmp = Float64(b / c);
	elseif (d <= 2.6e+89)
		tmp = Float64(t_1 / fma(d, d, Float64(c * c)));
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[((-d) * a), $MachinePrecision]}, If[LessEqual[d, -8.6e+58], t$95$0, If[LessEqual[d, -6.6e-60], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.15e-149], N[(N[(c * b + t$95$1), $MachinePrecision] / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-115], N[(b / c), $MachinePrecision], If[LessEqual[d, 2.6e+89], N[(t$95$1 / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := \left(-d\right) \cdot a\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\
\;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\

\mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\
\;\;\;\;\frac{\mathsf{fma}\left(c, b, t\_1\right)}{c \cdot c}\\

\mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;d \leq 2.6 \cdot 10^{+89}:\\
\;\;\;\;\frac{t\_1}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -8.59999999999999982e58 or 2.6000000000000001e89 < d

    1. Initial program 39.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
      4. lower-neg.f6473.5

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Applied rewrites73.5%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if -8.59999999999999982e58 < d < -6.5999999999999996e-60

    1. Initial program 78.0%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6464.1

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites64.1%

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

    if -6.5999999999999996e-60 < d < -1.15e-149

    1. Initial program 91.1%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

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

        \[\leadsto \frac{\color{blue}{b \cdot c + \left(\mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      3. lift-*.f64N/A

        \[\leadsto \frac{\color{blue}{b \cdot c} + \left(\mathsf{neg}\left(a \cdot d\right)\right)}{c \cdot c + d \cdot d} \]
      4. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c \cdot b} + \left(\mathsf{neg}\left(a \cdot d\right)\right)}{c \cdot c + d \cdot d} \]
      5. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(c, b, \mathsf{neg}\left(a \cdot d\right)\right)}}{c \cdot c + d \cdot d} \]
      6. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(c, b, \mathsf{neg}\left(\color{blue}{a \cdot d}\right)\right)}{c \cdot c + d \cdot d} \]
      7. *-commutativeN/A

        \[\leadsto \frac{\mathsf{fma}\left(c, b, \mathsf{neg}\left(\color{blue}{d \cdot a}\right)\right)}{c \cdot c + d \cdot d} \]
      8. distribute-lft-neg-inN/A

        \[\leadsto \frac{\mathsf{fma}\left(c, b, \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}\right)}{c \cdot c + d \cdot d} \]
      9. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(c, b, \color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}\right)}{c \cdot c + d \cdot d} \]
      10. lower-neg.f6491.2

        \[\leadsto \frac{\mathsf{fma}\left(c, b, \color{blue}{\left(-d\right)} \cdot a\right)}{c \cdot c + d \cdot d} \]
    4. Applied rewrites91.2%

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

      \[\leadsto \frac{\mathsf{fma}\left(c, b, \left(-d\right) \cdot a\right)}{\color{blue}{{c}^{2}}} \]
    6. Step-by-step derivation
      1. unpow2N/A

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

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

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

    if -1.15e-149 < d < 9.19999999999999938e-115

    1. Initial program 74.0%

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

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    5. Applied rewrites77.1%

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

    if 9.19999999999999938e-115 < d < 2.6000000000000001e89

    1. Initial program 66.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6466.8

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(a \cdot d\right)}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      3. mul-1-negN/A

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

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

      \[\leadsto \frac{\color{blue}{\left(-a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification69.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\ \;\;\;\;\frac{\mathsf{fma}\left(c, b, \left(-d\right) \cdot a\right)}{c \cdot c}\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 66.0% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ t_1 := b \cdot c - d \cdot a\\ \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\ \;\;\;\;\frac{t\_1}{d \cdot d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\ \;\;\;\;\frac{t\_1}{c \cdot c}\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (/ (- a) d)) (t_1 (- (* b c) (* d a))))
   (if (<= d -8.6e+58)
     t_0
     (if (<= d -6.6e-60)
       (/ t_1 (* d d))
       (if (<= d -1.15e-149)
         (/ t_1 (* c c))
         (if (<= d 9.2e-115)
           (/ b c)
           (if (<= d 2.6e+89) (/ (* (- d) a) (fma d d (* c c))) t_0)))))))
double code(double a, double b, double c, double d) {
	double t_0 = -a / d;
	double t_1 = (b * c) - (d * a);
	double tmp;
	if (d <= -8.6e+58) {
		tmp = t_0;
	} else if (d <= -6.6e-60) {
		tmp = t_1 / (d * d);
	} else if (d <= -1.15e-149) {
		tmp = t_1 / (c * c);
	} else if (d <= 9.2e-115) {
		tmp = b / c;
	} else if (d <= 2.6e+89) {
		tmp = (-d * a) / fma(d, d, (c * c));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = Float64(Float64(-a) / d)
	t_1 = Float64(Float64(b * c) - Float64(d * a))
	tmp = 0.0
	if (d <= -8.6e+58)
		tmp = t_0;
	elseif (d <= -6.6e-60)
		tmp = Float64(t_1 / Float64(d * d));
	elseif (d <= -1.15e-149)
		tmp = Float64(t_1 / Float64(c * c));
	elseif (d <= 9.2e-115)
		tmp = Float64(b / c);
	elseif (d <= 2.6e+89)
		tmp = Float64(Float64(Float64(-d) * a) / fma(d, d, Float64(c * c)));
	else
		tmp = t_0;
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, Block[{t$95$1 = N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[d, -8.6e+58], t$95$0, If[LessEqual[d, -6.6e-60], N[(t$95$1 / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, -1.15e-149], N[(t$95$1 / N[(c * c), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 9.2e-115], N[(b / c), $MachinePrecision], If[LessEqual[d, 2.6e+89], N[(N[((-d) * a), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{-a}{d}\\
t_1 := b \cdot c - d \cdot a\\
\mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\
\;\;\;\;\frac{t\_1}{d \cdot d}\\

\mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\
\;\;\;\;\frac{t\_1}{c \cdot c}\\

\mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\
\;\;\;\;\frac{b}{c}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if d < -8.59999999999999982e58 or 2.6000000000000001e89 < d

    1. Initial program 39.9%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
      4. lower-neg.f6473.5

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Applied rewrites73.5%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if -8.59999999999999982e58 < d < -6.5999999999999996e-60

    1. Initial program 78.0%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6464.1

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites64.1%

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

    if -6.5999999999999996e-60 < d < -1.15e-149

    1. Initial program 91.1%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c}} \]
      2. lower-*.f6479.1

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c}} \]
    5. Applied rewrites79.1%

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

    if -1.15e-149 < d < 9.19999999999999938e-115

    1. Initial program 74.0%

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

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    5. Applied rewrites77.1%

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

    if 9.19999999999999938e-115 < d < 2.6000000000000001e89

    1. Initial program 66.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6466.8

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(a \cdot d\right)}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      3. mul-1-negN/A

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

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

      \[\leadsto \frac{\color{blue}{\left(-a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification69.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -6.6 \cdot 10^{-60}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq -1.15 \cdot 10^{-149}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{c \cdot c}\\ \mathbf{elif}\;d \leq 9.2 \cdot 10^{-115}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;d \leq 2.6 \cdot 10^{+89}:\\ \;\;\;\;\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.2% accurate, 0.6× speedup?

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

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\
\mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\
\;\;\;\;t\_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if c < -2.39999999999999991e-34 or 1.4499999999999999e75 < c

    1. Initial program 47.6%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

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

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

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a \cdot d}{{c}^{2}} + \frac{b}{c}} \]
    6. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot \left(a \cdot d\right)}{{c}^{2}}} + \frac{b}{c} \]
      2. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{{c}^{2}} + \frac{b}{c} \]
      3. unpow2N/A

        \[\leadsto \frac{\left(-1 \cdot a\right) \cdot d}{\color{blue}{c \cdot c}} + \frac{b}{c} \]
      4. times-fracN/A

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

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

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

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

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

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

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

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

    if -2.39999999999999991e-34 < c < 2.39999999999999988e-142

    1. Initial program 70.4%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6464.3

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites64.3%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
      3. div-subN/A

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

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      7. distribute-lft-neg-outN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      8. lift-neg.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      10. frac-subN/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
    7. Applied rewrites32.4%

      \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
    8. Taylor expanded in c around inf

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
      8. mul-1-negN/A

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

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

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

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

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

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

        \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
      3. unsub-negN/A

        \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
      4. unpow2N/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
      6. div-subN/A

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

        \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
      8. sub-negN/A

        \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + \left(\mathsf{neg}\left(a\right)\right)}}{d} \]
      9. *-commutativeN/A

        \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      10. associate-*l/N/A

        \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot b} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
      11. mul-1-negN/A

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, b, -1 \cdot a\right)}{d} \]
      14. mul-1-negN/A

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

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

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

    if 2.39999999999999988e-142 < c < 1.4499999999999999e75

    1. Initial program 78.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6478.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 1.45 \cdot 10^{+75}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{-a}{c}, \frac{d}{c}, \frac{b}{c}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 64.0% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\
\;\;\;\;\frac{-a}{d}\\

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

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

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -9.99999999999999928e-35 or 1.15e145 < c

    1. Initial program 45.3%

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

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    5. Applied rewrites70.2%

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

    if -9.99999999999999928e-35 < c < 1.6000000000000001e-114

    1. Initial program 71.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
      4. lower-neg.f6467.4

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Applied rewrites67.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if 1.6000000000000001e-114 < c < 2.35e-54

    1. Initial program 81.8%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6481.8

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

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

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

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

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

    if 2.35e-54 < c < 1.15e145

    1. Initial program 72.4%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c}} \]
      2. lower-*.f6460.0

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c}} \]
    5. Applied rewrites60.0%

      \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{c \cdot c}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification68.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 2.35 \cdot 10^{-54}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 1.15 \cdot 10^{+145}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{c \cdot c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 63.3% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\ \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 5.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{b \cdot c}{t\_0}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+66}:\\ \;\;\;\;\frac{\left(-d\right) \cdot a}{t\_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
(FPCore (a b c d)
 :precision binary64
 (let* ((t_0 (fma d d (* c c))))
   (if (<= c -1e-34)
     (/ b c)
     (if (<= c 1.6e-114)
       (/ (- a) d)
       (if (<= c 5.5e-32)
         (/ (* b c) t_0)
         (if (<= c 1.1e+66) (/ (* (- d) a) t_0) (/ b c)))))))
double code(double a, double b, double c, double d) {
	double t_0 = fma(d, d, (c * c));
	double tmp;
	if (c <= -1e-34) {
		tmp = b / c;
	} else if (c <= 1.6e-114) {
		tmp = -a / d;
	} else if (c <= 5.5e-32) {
		tmp = (b * c) / t_0;
	} else if (c <= 1.1e+66) {
		tmp = (-d * a) / t_0;
	} else {
		tmp = b / c;
	}
	return tmp;
}
function code(a, b, c, d)
	t_0 = fma(d, d, Float64(c * c))
	tmp = 0.0
	if (c <= -1e-34)
		tmp = Float64(b / c);
	elseif (c <= 1.6e-114)
		tmp = Float64(Float64(-a) / d);
	elseif (c <= 5.5e-32)
		tmp = Float64(Float64(b * c) / t_0);
	elseif (c <= 1.1e+66)
		tmp = Float64(Float64(Float64(-d) * a) / t_0);
	else
		tmp = Float64(b / c);
	end
	return tmp
end
code[a_, b_, c_, d_] := Block[{t$95$0 = N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1e-34], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.6e-114], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 5.5e-32], N[(N[(b * c), $MachinePrecision] / t$95$0), $MachinePrecision], If[LessEqual[c, 1.1e+66], N[(N[((-d) * a), $MachinePrecision] / t$95$0), $MachinePrecision], N[(b / c), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(d, d, c \cdot c\right)\\
\mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\
\;\;\;\;\frac{-a}{d}\\

\mathbf{elif}\;c \leq 5.5 \cdot 10^{-32}:\\
\;\;\;\;\frac{b \cdot c}{t\_0}\\

\mathbf{elif}\;c \leq 1.1 \cdot 10^{+66}:\\
\;\;\;\;\frac{\left(-d\right) \cdot a}{t\_0}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -9.99999999999999928e-35 or 1.0999999999999999e66 < c

    1. Initial program 47.6%

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

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    5. Applied rewrites68.3%

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

    if -9.99999999999999928e-35 < c < 1.6000000000000001e-114

    1. Initial program 71.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
      4. lower-neg.f6467.4

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Applied rewrites67.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if 1.6000000000000001e-114 < c < 5.50000000000000024e-32

    1. Initial program 85.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6485.2

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

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      2. lower-*.f6476.5

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

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

    if 5.50000000000000024e-32 < c < 1.0999999999999999e66

    1. Initial program 68.0%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6468.0

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

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

      \[\leadsto \frac{\color{blue}{-1 \cdot \left(a \cdot d\right)}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      2. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right) \cdot d}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right)} \cdot d}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      4. lower-neg.f6450.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 5.5 \cdot 10^{-32}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 1.1 \cdot 10^{+66}:\\ \;\;\;\;\frac{\left(-d\right) \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 62.3% accurate, 0.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\
\;\;\;\;\frac{b}{c}\\

\mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\
\;\;\;\;\frac{-a}{d}\\

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

\mathbf{elif}\;c \leq 6.5 \cdot 10^{+38}:\\
\;\;\;\;\frac{\frac{-a}{c} \cdot d}{c}\\

\mathbf{else}:\\
\;\;\;\;\frac{b}{c}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if c < -9.99999999999999928e-35 or 6.5e38 < c

    1. Initial program 48.7%

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

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

        \[\leadsto \color{blue}{\frac{b}{c}} \]
    5. Applied rewrites66.3%

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

    if -9.99999999999999928e-35 < c < 1.6000000000000001e-114

    1. Initial program 71.8%

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

      \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      2. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
      3. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
      4. lower-neg.f6467.4

        \[\leadsto \frac{\color{blue}{-a}}{d} \]
    5. Applied rewrites67.4%

      \[\leadsto \color{blue}{\frac{-a}{d}} \]

    if 1.6000000000000001e-114 < c < 7.4e-32

    1. Initial program 85.2%

      \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-+.f64N/A

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
      4. lower-fma.f6485.2

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

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

      \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
    6. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      2. lower-*.f6476.5

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

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

    if 7.4e-32 < c < 6.5e38

    1. Initial program 68.1%

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

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

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
      2. lower-*.f6414.6

        \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
    5. Applied rewrites14.6%

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

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

        \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
      3. div-subN/A

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

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
      5. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      6. *-commutativeN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
      7. distribute-lft-neg-outN/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      8. lift-neg.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
      10. frac-subN/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
      11. lower-/.f64N/A

        \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
    7. Applied rewrites8.6%

      \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
    8. Taylor expanded in c around inf

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

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

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

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

        \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
      5. distribute-lft-neg-inN/A

        \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
      6. mul-1-negN/A

        \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
      7. lower-fma.f64N/A

        \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
      8. mul-1-negN/A

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

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

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

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

      \[\leadsto \frac{-1 \cdot \frac{a \cdot d}{c}}{c} \]
    12. Step-by-step derivation
      1. Applied rewrites55.6%

        \[\leadsto \frac{\left(-d\right) \cdot \frac{a}{c}}{c} \]
    13. Recombined 4 regimes into one program.
    14. Final simplification66.9%

      \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 7.4 \cdot 10^{-32}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+38}:\\ \;\;\;\;\frac{\frac{-a}{c} \cdot d}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
    15. Add Preprocessing

    Alternative 9: 62.3% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 7.4 \cdot 10^{-32}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+38}:\\ \;\;\;\;\frac{-d}{c} \cdot \frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \end{array} \]
    (FPCore (a b c d)
     :precision binary64
     (if (<= c -1e-34)
       (/ b c)
       (if (<= c 1.6e-114)
         (/ (- a) d)
         (if (<= c 7.4e-32)
           (/ (* b c) (fma d d (* c c)))
           (if (<= c 6.5e+38) (* (/ (- d) c) (/ a c)) (/ b c))))))
    double code(double a, double b, double c, double d) {
    	double tmp;
    	if (c <= -1e-34) {
    		tmp = b / c;
    	} else if (c <= 1.6e-114) {
    		tmp = -a / d;
    	} else if (c <= 7.4e-32) {
    		tmp = (b * c) / fma(d, d, (c * c));
    	} else if (c <= 6.5e+38) {
    		tmp = (-d / c) * (a / c);
    	} else {
    		tmp = b / c;
    	}
    	return tmp;
    }
    
    function code(a, b, c, d)
    	tmp = 0.0
    	if (c <= -1e-34)
    		tmp = Float64(b / c);
    	elseif (c <= 1.6e-114)
    		tmp = Float64(Float64(-a) / d);
    	elseif (c <= 7.4e-32)
    		tmp = Float64(Float64(b * c) / fma(d, d, Float64(c * c)));
    	elseif (c <= 6.5e+38)
    		tmp = Float64(Float64(Float64(-d) / c) * Float64(a / c));
    	else
    		tmp = Float64(b / c);
    	end
    	return tmp
    end
    
    code[a_, b_, c_, d_] := If[LessEqual[c, -1e-34], N[(b / c), $MachinePrecision], If[LessEqual[c, 1.6e-114], N[((-a) / d), $MachinePrecision], If[LessEqual[c, 7.4e-32], N[(N[(b * c), $MachinePrecision] / N[(d * d + N[(c * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 6.5e+38], N[(N[((-d) / c), $MachinePrecision] * N[(a / c), $MachinePrecision]), $MachinePrecision], N[(b / c), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\
    \;\;\;\;\frac{b}{c}\\
    
    \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\
    \;\;\;\;\frac{-a}{d}\\
    
    \mathbf{elif}\;c \leq 7.4 \cdot 10^{-32}:\\
    \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\
    
    \mathbf{elif}\;c \leq 6.5 \cdot 10^{+38}:\\
    \;\;\;\;\frac{-d}{c} \cdot \frac{a}{c}\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{b}{c}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if c < -9.99999999999999928e-35 or 6.5e38 < c

      1. Initial program 48.7%

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

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

          \[\leadsto \color{blue}{\frac{b}{c}} \]
      5. Applied rewrites66.3%

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

      if -9.99999999999999928e-35 < c < 1.6000000000000001e-114

      1. Initial program 71.8%

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

        \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
      4. Step-by-step derivation
        1. associate-*r/N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
        2. lower-/.f64N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
        3. mul-1-negN/A

          \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
        4. lower-neg.f6467.4

          \[\leadsto \frac{\color{blue}{-a}}{d} \]
      5. Applied rewrites67.4%

        \[\leadsto \color{blue}{\frac{-a}{d}} \]

      if 1.6000000000000001e-114 < c < 7.4e-32

      1. Initial program 85.2%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

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

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

          \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
        4. lower-fma.f6485.2

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

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

        \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
        2. lower-*.f6476.5

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

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

      if 7.4e-32 < c < 6.5e38

      1. Initial program 68.1%

        \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
      2. Add Preprocessing
      3. Step-by-step derivation
        1. lift-+.f64N/A

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

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

          \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
        4. lower-fma.f6468.1

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

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

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

          \[\leadsto \color{blue}{\mathsf{neg}\left(\frac{-1 \cdot b + \frac{a \cdot d}{c}}{c}\right)} \]
        2. distribute-neg-frac2N/A

          \[\leadsto \color{blue}{\frac{-1 \cdot b + \frac{a \cdot d}{c}}{\mathsf{neg}\left(c\right)}} \]
        3. mul-1-negN/A

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

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

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

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

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

          \[\leadsto \frac{\mathsf{fma}\left(a, \color{blue}{\frac{d}{c}}, -1 \cdot b\right)}{-1 \cdot c} \]
        9. mul-1-negN/A

          \[\leadsto \frac{\mathsf{fma}\left(a, \frac{d}{c}, \color{blue}{\mathsf{neg}\left(b\right)}\right)}{-1 \cdot c} \]
        10. lower-neg.f64N/A

          \[\leadsto \frac{\mathsf{fma}\left(a, \frac{d}{c}, \color{blue}{-b}\right)}{-1 \cdot c} \]
        11. mul-1-negN/A

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

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

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

        \[\leadsto -1 \cdot \color{blue}{\frac{a \cdot d}{{c}^{2}}} \]
      9. Step-by-step derivation
        1. Applied rewrites55.6%

          \[\leadsto \frac{-a}{c} \cdot \color{blue}{\frac{d}{c}} \]
      10. Recombined 4 regimes into one program.
      11. Final simplification66.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 7.4 \cdot 10^{-32}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+38}:\\ \;\;\;\;\frac{-d}{c} \cdot \frac{a}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
      12. Add Preprocessing

      Alternative 10: 79.9% accurate, 0.7× speedup?

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

        1. Initial program 45.4%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6414.0

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites14.0%

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
          3. div-subN/A

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

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          7. distribute-lft-neg-outN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          8. lift-neg.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          10. frac-subN/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
          11. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
        7. Applied rewrites3.3%

          \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
        8. Taylor expanded in c around inf

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
          5. distribute-lft-neg-inN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
          6. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
          8. mul-1-negN/A

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

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

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

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

        if -2.39999999999999991e-34 < c < 2.39999999999999988e-142

        1. Initial program 70.4%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6464.3

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites64.3%

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
          3. div-subN/A

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

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          7. distribute-lft-neg-outN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          8. lift-neg.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          10. frac-subN/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
          11. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
        7. Applied rewrites32.4%

          \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
        8. Taylor expanded in c around inf

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
          5. distribute-lft-neg-inN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
          6. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
          8. mul-1-negN/A

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

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

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

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

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

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

            \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
          3. unsub-negN/A

            \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
          4. unpow2N/A

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
          6. div-subN/A

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
          8. sub-negN/A

            \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + \left(\mathsf{neg}\left(a\right)\right)}}{d} \]
          9. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
          10. associate-*l/N/A

            \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot b} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
          11. mul-1-negN/A

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

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

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, b, -1 \cdot a\right)}{d} \]
          14. mul-1-negN/A

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

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

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

        if 2.39999999999999988e-142 < c < 6.5000000000000002e137

        1. Initial program 78.0%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
          4. lower-fma.f6478.0

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq 2.4 \cdot 10^{-142}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\frac{c}{d}, b, -a\right)}{d}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+137}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 11: 72.2% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-59}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{+122}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (a b c d)
       :precision binary64
       (let* ((t_0 (/ (- a) d)))
         (if (<= d -8.6e+58)
           t_0
           (if (<= d -1e-59)
             (/ (- (* b c) (* d a)) (* d d))
             (if (<= d 2.1e+122) (/ (- b (/ (* d a) c)) c) t_0)))))
      double code(double a, double b, double c, double d) {
      	double t_0 = -a / d;
      	double tmp;
      	if (d <= -8.6e+58) {
      		tmp = t_0;
      	} else if (d <= -1e-59) {
      		tmp = ((b * c) - (d * a)) / (d * d);
      	} else if (d <= 2.1e+122) {
      		tmp = (b - ((d * a) / c)) / c;
      	} else {
      		tmp = t_0;
      	}
      	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) :: t_0
          real(8) :: tmp
          t_0 = -a / d
          if (d <= (-8.6d+58)) then
              tmp = t_0
          else if (d <= (-1d-59)) then
              tmp = ((b * c) - (d * a)) / (d * d)
          else if (d <= 2.1d+122) then
              tmp = (b - ((d * a) / c)) / c
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      public static double code(double a, double b, double c, double d) {
      	double t_0 = -a / d;
      	double tmp;
      	if (d <= -8.6e+58) {
      		tmp = t_0;
      	} else if (d <= -1e-59) {
      		tmp = ((b * c) - (d * a)) / (d * d);
      	} else if (d <= 2.1e+122) {
      		tmp = (b - ((d * a) / c)) / c;
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      def code(a, b, c, d):
      	t_0 = -a / d
      	tmp = 0
      	if d <= -8.6e+58:
      		tmp = t_0
      	elif d <= -1e-59:
      		tmp = ((b * c) - (d * a)) / (d * d)
      	elif d <= 2.1e+122:
      		tmp = (b - ((d * a) / c)) / c
      	else:
      		tmp = t_0
      	return tmp
      
      function code(a, b, c, d)
      	t_0 = Float64(Float64(-a) / d)
      	tmp = 0.0
      	if (d <= -8.6e+58)
      		tmp = t_0;
      	elseif (d <= -1e-59)
      		tmp = Float64(Float64(Float64(b * c) - Float64(d * a)) / Float64(d * d));
      	elseif (d <= 2.1e+122)
      		tmp = Float64(Float64(b - Float64(Float64(d * a) / c)) / c);
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      function tmp_2 = code(a, b, c, d)
      	t_0 = -a / d;
      	tmp = 0.0;
      	if (d <= -8.6e+58)
      		tmp = t_0;
      	elseif (d <= -1e-59)
      		tmp = ((b * c) - (d * a)) / (d * d);
      	elseif (d <= 2.1e+122)
      		tmp = (b - ((d * a) / c)) / c;
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -8.6e+58], t$95$0, If[LessEqual[d, -1e-59], N[(N[(N[(b * c), $MachinePrecision] - N[(d * a), $MachinePrecision]), $MachinePrecision] / N[(d * d), $MachinePrecision]), $MachinePrecision], If[LessEqual[d, 2.1e+122], N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision], t$95$0]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \frac{-a}{d}\\
      \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;d \leq -1 \cdot 10^{-59}:\\
      \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\
      
      \mathbf{elif}\;d \leq 2.1 \cdot 10^{+122}:\\
      \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if d < -8.59999999999999982e58 or 2.10000000000000016e122 < d

        1. Initial program 40.5%

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

          \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
        4. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
          2. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
          3. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
          4. lower-neg.f6475.5

            \[\leadsto \frac{\color{blue}{-a}}{d} \]
        5. Applied rewrites75.5%

          \[\leadsto \color{blue}{\frac{-a}{d}} \]

        if -8.59999999999999982e58 < d < -1e-59

        1. Initial program 78.0%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6464.1

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites64.1%

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

        if -1e-59 < d < 2.10000000000000016e122

        1. Initial program 72.9%

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

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

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

            \[\leadsto \frac{b + \color{blue}{\left(\mathsf{neg}\left(\frac{a \cdot d}{c}\right)\right)}}{c} \]
          3. unsub-negN/A

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

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

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

            \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
          7. lower-*.f6477.7

            \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
        5. Applied rewrites77.7%

          \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification75.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;d \leq -8.6 \cdot 10^{+58}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;d \leq -1 \cdot 10^{-59}:\\ \;\;\;\;\frac{b \cdot c - d \cdot a}{d \cdot d}\\ \mathbf{elif}\;d \leq 2.1 \cdot 10^{+122}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{else}:\\ \;\;\;\;\frac{-a}{d}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 12: 64.3% accurate, 0.8× speedup?

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

        1. Initial program 46.2%

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

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

            \[\leadsto \color{blue}{\frac{b}{c}} \]
        5. Applied rewrites67.7%

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

        if -9.99999999999999928e-35 < c < 1.6000000000000001e-114

        1. Initial program 71.8%

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

          \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
        4. Step-by-step derivation
          1. associate-*r/N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
          2. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
          3. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
          4. lower-neg.f6467.4

            \[\leadsto \frac{\color{blue}{-a}}{d} \]
        5. Applied rewrites67.4%

          \[\leadsto \color{blue}{\frac{-a}{d}} \]

        if 1.6000000000000001e-114 < c < 6.5000000000000002e111

        1. Initial program 77.9%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d} + c \cdot c} \]
          4. lower-fma.f6477.9

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

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

          \[\leadsto \frac{\color{blue}{b \cdot c}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
        6. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
          2. lower-*.f6453.6

            \[\leadsto \frac{\color{blue}{c \cdot b}}{\mathsf{fma}\left(d, d, c \cdot c\right)} \]
        7. Applied rewrites53.6%

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -1 \cdot 10^{-34}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{elif}\;c \leq 1.6 \cdot 10^{-114}:\\ \;\;\;\;\frac{-a}{d}\\ \mathbf{elif}\;c \leq 6.5 \cdot 10^{+111}:\\ \;\;\;\;\frac{b \cdot c}{\mathsf{fma}\left(d, d, c \cdot c\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{b}{c}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 13: 77.1% accurate, 0.9× speedup?

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

        1. Initial program 52.5%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6414.9

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites14.9%

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
          3. div-subN/A

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

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          7. distribute-lft-neg-outN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          8. lift-neg.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          10. frac-subN/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
          11. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
        7. Applied rewrites4.4%

          \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
        8. Taylor expanded in c around inf

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
          5. distribute-lft-neg-inN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
          6. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
          8. mul-1-negN/A

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

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

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

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

        if -2.39999999999999991e-34 < c < 2.79999999999999985e-53

        1. Initial program 73.2%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6461.9

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites61.9%

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
          3. div-subN/A

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

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          7. distribute-lft-neg-outN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          8. lift-neg.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          10. frac-subN/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
          11. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
        7. Applied rewrites31.6%

          \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
        8. Taylor expanded in c around inf

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
          5. distribute-lft-neg-inN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
          6. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
          8. mul-1-negN/A

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

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

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

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

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

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

            \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
          3. unsub-negN/A

            \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
          4. unpow2N/A

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
          6. div-subN/A

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d} - a}{d}} \]
          8. sub-negN/A

            \[\leadsto \frac{\color{blue}{\frac{b \cdot c}{d} + \left(\mathsf{neg}\left(a\right)\right)}}{d} \]
          9. *-commutativeN/A

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
          10. associate-*l/N/A

            \[\leadsto \frac{\color{blue}{\frac{c}{d} \cdot b} + \left(\mathsf{neg}\left(a\right)\right)}{d} \]
          11. mul-1-negN/A

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

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

            \[\leadsto \frac{\mathsf{fma}\left(\color{blue}{\frac{c}{d}}, b, -1 \cdot a\right)}{d} \]
          14. mul-1-negN/A

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

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

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

      Alternative 14: 77.1% accurate, 0.9× speedup?

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

        1. Initial program 52.5%

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

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

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
          2. lower-*.f6414.9

            \[\leadsto \frac{b \cdot c - a \cdot d}{\color{blue}{d \cdot d}} \]
        5. Applied rewrites14.9%

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

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

            \[\leadsto \frac{\color{blue}{b \cdot c - a \cdot d}}{d \cdot d} \]
          3. div-subN/A

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

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \color{blue}{\frac{\mathsf{neg}\left(a \cdot d\right)}{\mathsf{neg}\left(d \cdot d\right)}} \]
          5. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{a \cdot d}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          6. *-commutativeN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\mathsf{neg}\left(\color{blue}{d \cdot a}\right)}{\mathsf{neg}\left(d \cdot d\right)} \]
          7. distribute-lft-neg-outN/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(\mathsf{neg}\left(d\right)\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          8. lift-neg.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right)} \cdot a}{\mathsf{neg}\left(d \cdot d\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{b \cdot c}{d \cdot d} - \frac{\color{blue}{\left(-d\right) \cdot a}}{\mathsf{neg}\left(d \cdot d\right)} \]
          10. frac-subN/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
          11. lower-/.f64N/A

            \[\leadsto \color{blue}{\frac{\left(b \cdot c\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(\mathsf{neg}\left(d \cdot d\right)\right)}} \]
        7. Applied rewrites4.4%

          \[\leadsto \color{blue}{\frac{\left(c \cdot b\right) \cdot \left(-d \cdot d\right) - \left(d \cdot d\right) \cdot \left(\left(-d\right) \cdot a\right)}{\left(d \cdot d\right) \cdot \left(-d \cdot d\right)}} \]
        8. Taylor expanded in c around inf

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

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

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

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

            \[\leadsto \frac{\left(\mathsf{neg}\left(\color{blue}{a \cdot \frac{d}{c}}\right)\right) + b}{c} \]
          5. distribute-lft-neg-inN/A

            \[\leadsto \frac{\color{blue}{\left(\mathsf{neg}\left(a\right)\right) \cdot \frac{d}{c}} + b}{c} \]
          6. mul-1-negN/A

            \[\leadsto \frac{\color{blue}{\left(-1 \cdot a\right)} \cdot \frac{d}{c} + b}{c} \]
          7. lower-fma.f64N/A

            \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(-1 \cdot a, \frac{d}{c}, b\right)}}{c} \]
          8. mul-1-negN/A

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

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

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

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

        if -2.39999999999999991e-34 < c < 2.79999999999999985e-53

        1. Initial program 73.2%

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

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

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

            \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
          3. unsub-negN/A

            \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
          4. unpow2N/A

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

            \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
          6. div-subN/A

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

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

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

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

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
          11. lower-*.f6483.9

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
        5. Applied rewrites83.9%

          \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification80.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \mathbf{elif}\;c \leq 2.8 \cdot 10^{-53}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(-a, \frac{d}{c}, b\right)}{c}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 15: 78.1% accurate, 0.9× speedup?

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

        1. Initial program 50.5%

          \[\frac{b \cdot c - a \cdot d}{c \cdot c + d \cdot d} \]
        2. Add Preprocessing
        3. Step-by-step derivation
          1. lift-+.f64N/A

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

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

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

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

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

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

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

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

            \[\leadsto \frac{\frac{b \cdot c}{d} + \color{blue}{\left(\mathsf{neg}\left(a\right)\right)}}{d} \]
          4. sub-negN/A

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

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

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

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
          8. lower-*.f6474.5

            \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
        7. Applied rewrites74.5%

          \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]
        8. Step-by-step derivation
          1. Applied rewrites75.5%

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

          if -1e-59 < d < 2.80000000000000008e56

          1. Initial program 73.6%

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

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

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

              \[\leadsto \frac{b + \color{blue}{\left(\mathsf{neg}\left(\frac{a \cdot d}{c}\right)\right)}}{c} \]
            3. unsub-negN/A

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

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

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

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            7. lower-*.f6481.0

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
          5. Applied rewrites81.0%

            \[\leadsto \color{blue}{\frac{b - \frac{d \cdot a}{c}}{c}} \]
        9. Recombined 2 regimes into one program.
        10. Add Preprocessing

        Alternative 16: 75.6% accurate, 0.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;c \leq 2.8 \cdot 10^{-53}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- b (/ (* d a) c)) c)))
           (if (<= c -2.4e-34) t_0 (if (<= c 2.8e-53) (/ (- (/ (* b c) d) a) d) t_0))))
        double code(double a, double b, double c, double d) {
        	double t_0 = (b - ((d * a) / c)) / c;
        	double tmp;
        	if (c <= -2.4e-34) {
        		tmp = t_0;
        	} else if (c <= 2.8e-53) {
        		tmp = (((b * c) / d) - a) / d;
        	} else {
        		tmp = t_0;
        	}
        	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) :: t_0
            real(8) :: tmp
            t_0 = (b - ((d * a) / c)) / c
            if (c <= (-2.4d-34)) then
                tmp = t_0
            else if (c <= 2.8d-53) then
                tmp = (((b * c) / d) - a) / d
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double t_0 = (b - ((d * a) / c)) / c;
        	double tmp;
        	if (c <= -2.4e-34) {
        		tmp = t_0;
        	} else if (c <= 2.8e-53) {
        		tmp = (((b * c) / d) - a) / d;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	t_0 = (b - ((d * a) / c)) / c
        	tmp = 0
        	if c <= -2.4e-34:
        		tmp = t_0
        	elif c <= 2.8e-53:
        		tmp = (((b * c) / d) - a) / d
        	else:
        		tmp = t_0
        	return tmp
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(b - Float64(Float64(d * a) / c)) / c)
        	tmp = 0.0
        	if (c <= -2.4e-34)
        		tmp = t_0;
        	elseif (c <= 2.8e-53)
        		tmp = Float64(Float64(Float64(Float64(b * c) / d) - a) / d);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	t_0 = (b - ((d * a) / c)) / c;
        	tmp = 0.0;
        	if (c <= -2.4e-34)
        		tmp = t_0;
        	elseif (c <= 2.8e-53)
        		tmp = (((b * c) / d) - a) / d;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[(N[(b - N[(N[(d * a), $MachinePrecision] / c), $MachinePrecision]), $MachinePrecision] / c), $MachinePrecision]}, If[LessEqual[c, -2.4e-34], t$95$0, If[LessEqual[c, 2.8e-53], N[(N[(N[(N[(b * c), $MachinePrecision] / d), $MachinePrecision] - a), $MachinePrecision] / d), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{b - \frac{d \cdot a}{c}}{c}\\
        \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;c \leq 2.8 \cdot 10^{-53}:\\
        \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if c < -2.39999999999999991e-34 or 2.79999999999999985e-53 < c

          1. Initial program 52.5%

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

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

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

              \[\leadsto \frac{b + \color{blue}{\left(\mathsf{neg}\left(\frac{a \cdot d}{c}\right)\right)}}{c} \]
            3. unsub-negN/A

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

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

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

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
            7. lower-*.f6473.1

              \[\leadsto \frac{b - \frac{\color{blue}{d \cdot a}}{c}}{c} \]
          5. Applied rewrites73.1%

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

          if -2.39999999999999991e-34 < c < 2.79999999999999985e-53

          1. Initial program 73.2%

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

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

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

              \[\leadsto \frac{b \cdot c}{{d}^{2}} + \color{blue}{\left(\mathsf{neg}\left(\frac{a}{d}\right)\right)} \]
            3. unsub-negN/A

              \[\leadsto \color{blue}{\frac{b \cdot c}{{d}^{2}} - \frac{a}{d}} \]
            4. unpow2N/A

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

              \[\leadsto \color{blue}{\frac{\frac{b \cdot c}{d}}{d}} - \frac{a}{d} \]
            6. div-subN/A

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

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

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

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

              \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
            11. lower-*.f6483.9

              \[\leadsto \frac{\frac{\color{blue}{c \cdot b}}{d} - a}{d} \]
          5. Applied rewrites83.9%

            \[\leadsto \color{blue}{\frac{\frac{c \cdot b}{d} - a}{d}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification78.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;c \leq -2.4 \cdot 10^{-34}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \mathbf{elif}\;c \leq 2.8 \cdot 10^{-53}:\\ \;\;\;\;\frac{\frac{b \cdot c}{d} - a}{d}\\ \mathbf{else}:\\ \;\;\;\;\frac{b - \frac{d \cdot a}{c}}{c}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 17: 63.9% accurate, 1.5× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{-a}{d}\\ \mathbf{if}\;d \leq -5.2 \cdot 10^{-40}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;d \leq 3.5 \cdot 10^{-30}:\\ \;\;\;\;\frac{b}{c}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (a b c d)
         :precision binary64
         (let* ((t_0 (/ (- a) d)))
           (if (<= d -5.2e-40) t_0 (if (<= d 3.5e-30) (/ b c) t_0))))
        double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (d <= -5.2e-40) {
        		tmp = t_0;
        	} else if (d <= 3.5e-30) {
        		tmp = b / c;
        	} else {
        		tmp = t_0;
        	}
        	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) :: t_0
            real(8) :: tmp
            t_0 = -a / d
            if (d <= (-5.2d-40)) then
                tmp = t_0
            else if (d <= 3.5d-30) then
                tmp = b / c
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double a, double b, double c, double d) {
        	double t_0 = -a / d;
        	double tmp;
        	if (d <= -5.2e-40) {
        		tmp = t_0;
        	} else if (d <= 3.5e-30) {
        		tmp = b / c;
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	t_0 = -a / d
        	tmp = 0
        	if d <= -5.2e-40:
        		tmp = t_0
        	elif d <= 3.5e-30:
        		tmp = b / c
        	else:
        		tmp = t_0
        	return tmp
        
        function code(a, b, c, d)
        	t_0 = Float64(Float64(-a) / d)
        	tmp = 0.0
        	if (d <= -5.2e-40)
        		tmp = t_0;
        	elseif (d <= 3.5e-30)
        		tmp = Float64(b / c);
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(a, b, c, d)
        	t_0 = -a / d;
        	tmp = 0.0;
        	if (d <= -5.2e-40)
        		tmp = t_0;
        	elseif (d <= 3.5e-30)
        		tmp = b / c;
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[a_, b_, c_, d_] := Block[{t$95$0 = N[((-a) / d), $MachinePrecision]}, If[LessEqual[d, -5.2e-40], t$95$0, If[LessEqual[d, 3.5e-30], N[(b / c), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \frac{-a}{d}\\
        \mathbf{if}\;d \leq -5.2 \cdot 10^{-40}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;d \leq 3.5 \cdot 10^{-30}:\\
        \;\;\;\;\frac{b}{c}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if d < -5.2000000000000003e-40 or 3.5000000000000003e-30 < d

          1. Initial program 51.4%

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

            \[\leadsto \color{blue}{-1 \cdot \frac{a}{d}} \]
          4. Step-by-step derivation
            1. associate-*r/N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
            2. lower-/.f64N/A

              \[\leadsto \color{blue}{\frac{-1 \cdot a}{d}} \]
            3. mul-1-negN/A

              \[\leadsto \frac{\color{blue}{\mathsf{neg}\left(a\right)}}{d} \]
            4. lower-neg.f6462.0

              \[\leadsto \frac{\color{blue}{-a}}{d} \]
          5. Applied rewrites62.0%

            \[\leadsto \color{blue}{\frac{-a}{d}} \]

          if -5.2000000000000003e-40 < d < 3.5000000000000003e-30

          1. Initial program 75.8%

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

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

              \[\leadsto \color{blue}{\frac{b}{c}} \]
          5. Applied rewrites63.9%

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

        Alternative 18: 42.9% accurate, 3.2× speedup?

        \[\begin{array}{l} \\ \frac{b}{c} \end{array} \]
        (FPCore (a b c d) :precision binary64 (/ b c))
        double code(double a, double b, double c, double d) {
        	return b / 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 = b / c
        end function
        
        public static double code(double a, double b, double c, double d) {
        	return b / c;
        }
        
        def code(a, b, c, d):
        	return b / c
        
        function code(a, b, c, d)
        	return Float64(b / c)
        end
        
        function tmp = code(a, b, c, d)
        	tmp = b / c;
        end
        
        code[a_, b_, c_, d_] := N[(b / c), $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \frac{b}{c}
        \end{array}
        
        Derivation
        1. Initial program 62.2%

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

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

            \[\leadsto \color{blue}{\frac{b}{c}} \]
        5. Applied rewrites42.4%

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

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

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\left|d\right| < \left|c\right|:\\ \;\;\;\;\frac{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(-a\right) + b \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))
           (/ (- b (* a (/ d c))) (+ c (* d (/ d c))))
           (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
        double code(double a, double b, double c, double d) {
        	double tmp;
        	if (fabs(d) < fabs(c)) {
        		tmp = (b - (a * (d / c))) / (c + (d * (d / c)));
        	} else {
        		tmp = (-a + (b * (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 = (b - (a * (d / c))) / (c + (d * (d / c)))
            else
                tmp = (-a + (b * (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 = (b - (a * (d / c))) / (c + (d * (d / c)));
        	} else {
        		tmp = (-a + (b * (c / d))) / (d + (c * (c / d)));
        	}
        	return tmp;
        }
        
        def code(a, b, c, d):
        	tmp = 0
        	if math.fabs(d) < math.fabs(c):
        		tmp = (b - (a * (d / c))) / (c + (d * (d / c)))
        	else:
        		tmp = (-a + (b * (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(b - Float64(a * Float64(d / c))) / Float64(c + Float64(d * Float64(d / c))));
        	else
        		tmp = Float64(Float64(Float64(-a) + Float64(b * 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 = (b - (a * (d / c))) / (c + (d * (d / c)));
        	else
        		tmp = (-a + (b * (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[(b - N[(a * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(c + N[(d * N[(d / c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[((-a) + N[(b * 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{b - a \cdot \frac{d}{c}}{c + d \cdot \frac{d}{c}}\\
        
        \mathbf{else}:\\
        \;\;\;\;\frac{\left(-a\right) + b \cdot \frac{c}{d}}{d + c \cdot \frac{c}{d}}\\
        
        
        \end{array}
        \end{array}
        

        Reproduce

        ?
        herbie shell --seed 2024249 
        (FPCore (a b c d)
          :name "Complex division, imag part"
          :precision binary64
        
          :alt
          (! :herbie-platform default (if (< (fabs d) (fabs c)) (/ (- b (* a (/ d c))) (+ c (* d (/ d c)))) (/ (+ (- a) (* b (/ c d))) (+ d (* c (/ c d))))))
        
          (/ (- (* b c) (* a d)) (+ (* c c) (* d d))))