Average Error: 23.1 → 6.7
Time: 27.6s
Precision: binary64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
\[\begin{array}{l} t_1 := \left(y + z \cdot b\right) - z \cdot y\\ t_2 := {\left(b - y\right)}^{2}\\ t_3 := \mathsf{fma}\left(\frac{y}{t_2}, \frac{t}{z}, \frac{a}{b - y}\right)\\ t_4 := \frac{t}{b - y}\\ \mathbf{if}\;z \leq -345127.0157873039:\\ \;\;\;\;\left(t_4 + \frac{y}{z} \cdot \left(\frac{a}{t_2} + \frac{x}{b - y}\right)\right) - t_3\\ \mathbf{elif}\;z \leq -4.9404296087192797 \cdot 10^{-259}:\\ \;\;\;\;{\left(\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot t - z \cdot a\right)}\right)}^{-1}\\ \mathbf{elif}\;z \leq -2.6105144292203774 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9.985855448544829 \cdot 10^{+36}:\\ \;\;\;\;\left(\frac{z \cdot t}{t_1} + \frac{y \cdot x}{t_1}\right) - \frac{z \cdot a}{t_1}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, t_4\right) - t_3\\ \end{array} \]
(FPCore (x y z t a b)
 :precision binary64
 (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))
(FPCore (x y z t a b)
 :precision binary64
 (let* ((t_1 (- (+ y (* z b)) (* z y)))
        (t_2 (pow (- b y) 2.0))
        (t_3 (fma (/ y t_2) (/ t z) (/ a (- b y))))
        (t_4 (/ t (- b y))))
   (if (<= z -345127.0157873039)
     (- (+ t_4 (* (/ y z) (+ (/ a t_2) (/ x (- b y))))) t_3)
     (if (<= z -4.9404296087192797e-259)
       (pow (/ (fma z (- b y) y) (fma x y (- (* z t) (* z a)))) -1.0)
       (if (<= z -2.6105144292203774e-292)
         x
         (if (<= z 9.985855448544829e+36)
           (- (+ (/ (* z t) t_1) (/ (* y x) t_1)) (/ (* z a) t_1))
           (- (fma (/ y (- b y)) (/ x z) t_4) t_3)))))))
double code(double x, double y, double z, double t, double a, double b) {
	return ((x * y) + (z * (t - a))) / (y + (z * (b - y)));
}
double code(double x, double y, double z, double t, double a, double b) {
	double t_1 = (y + (z * b)) - (z * y);
	double t_2 = pow((b - y), 2.0);
	double t_3 = fma((y / t_2), (t / z), (a / (b - y)));
	double t_4 = t / (b - y);
	double tmp;
	if (z <= -345127.0157873039) {
		tmp = (t_4 + ((y / z) * ((a / t_2) + (x / (b - y))))) - t_3;
	} else if (z <= -4.9404296087192797e-259) {
		tmp = pow((fma(z, (b - y), y) / fma(x, y, ((z * t) - (z * a)))), -1.0);
	} else if (z <= -2.6105144292203774e-292) {
		tmp = x;
	} else if (z <= 9.985855448544829e+36) {
		tmp = (((z * t) / t_1) + ((y * x) / t_1)) - ((z * a) / t_1);
	} else {
		tmp = fma((y / (b - y)), (x / z), t_4) - t_3;
	}
	return tmp;
}
function code(x, y, z, t, a, b)
	return Float64(Float64(Float64(x * y) + Float64(z * Float64(t - a))) / Float64(y + Float64(z * Float64(b - y))))
end
function code(x, y, z, t, a, b)
	t_1 = Float64(Float64(y + Float64(z * b)) - Float64(z * y))
	t_2 = Float64(b - y) ^ 2.0
	t_3 = fma(Float64(y / t_2), Float64(t / z), Float64(a / Float64(b - y)))
	t_4 = Float64(t / Float64(b - y))
	tmp = 0.0
	if (z <= -345127.0157873039)
		tmp = Float64(Float64(t_4 + Float64(Float64(y / z) * Float64(Float64(a / t_2) + Float64(x / Float64(b - y))))) - t_3);
	elseif (z <= -4.9404296087192797e-259)
		tmp = Float64(fma(z, Float64(b - y), y) / fma(x, y, Float64(Float64(z * t) - Float64(z * a)))) ^ -1.0;
	elseif (z <= -2.6105144292203774e-292)
		tmp = x;
	elseif (z <= 9.985855448544829e+36)
		tmp = Float64(Float64(Float64(Float64(z * t) / t_1) + Float64(Float64(y * x) / t_1)) - Float64(Float64(z * a) / t_1));
	else
		tmp = Float64(fma(Float64(y / Float64(b - y)), Float64(x / z), t_4) - t_3);
	end
	return tmp
end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * N[(t - a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(y + N[(z * N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + N[(z * b), $MachinePrecision]), $MachinePrecision] - N[(z * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(b - y), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$3 = N[(N[(y / t$95$2), $MachinePrecision] * N[(t / z), $MachinePrecision] + N[(a / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t / N[(b - y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -345127.0157873039], N[(N[(t$95$4 + N[(N[(y / z), $MachinePrecision] * N[(N[(a / t$95$2), $MachinePrecision] + N[(x / N[(b - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision], If[LessEqual[z, -4.9404296087192797e-259], N[Power[N[(N[(z * N[(b - y), $MachinePrecision] + y), $MachinePrecision] / N[(x * y + N[(N[(z * t), $MachinePrecision] - N[(z * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], -1.0], $MachinePrecision], If[LessEqual[z, -2.6105144292203774e-292], x, If[LessEqual[z, 9.985855448544829e+36], N[(N[(N[(N[(z * t), $MachinePrecision] / t$95$1), $MachinePrecision] + N[(N[(y * x), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(z * a), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / N[(b - y), $MachinePrecision]), $MachinePrecision] * N[(x / z), $MachinePrecision] + t$95$4), $MachinePrecision] - t$95$3), $MachinePrecision]]]]]]]]]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\begin{array}{l}
t_1 := \left(y + z \cdot b\right) - z \cdot y\\
t_2 := {\left(b - y\right)}^{2}\\
t_3 := \mathsf{fma}\left(\frac{y}{t_2}, \frac{t}{z}, \frac{a}{b - y}\right)\\
t_4 := \frac{t}{b - y}\\
\mathbf{if}\;z \leq -345127.0157873039:\\
\;\;\;\;\left(t_4 + \frac{y}{z} \cdot \left(\frac{a}{t_2} + \frac{x}{b - y}\right)\right) - t_3\\

\mathbf{elif}\;z \leq -4.9404296087192797 \cdot 10^{-259}:\\
\;\;\;\;{\left(\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot t - z \cdot a\right)}\right)}^{-1}\\

\mathbf{elif}\;z \leq -2.6105144292203774 \cdot 10^{-292}:\\
\;\;\;\;x\\

\mathbf{elif}\;z \leq 9.985855448544829 \cdot 10^{+36}:\\
\;\;\;\;\left(\frac{z \cdot t}{t_1} + \frac{y \cdot x}{t_1}\right) - \frac{z \cdot a}{t_1}\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, t_4\right) - t_3\\


\end{array}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Bits error versus b

Target

Original23.1
Target17.5
Herbie6.7
\[\frac{z \cdot t + y \cdot x}{y + z \cdot \left(b - y\right)} - \frac{a}{\left(b - y\right) + \frac{y}{z}} \]

Derivation

  1. Split input into 5 regimes
  2. if z < -345127.01578730391

    1. Initial program 38.7

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
    2. Simplified38.7

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}} \]
    3. Taylor expanded in z around inf 22.6

      \[\leadsto \color{blue}{\left(\frac{y \cdot x}{\left(b - y\right) \cdot z} + \left(\frac{a \cdot y}{{\left(b - y\right)}^{2} \cdot z} + \frac{t}{b - y}\right)\right) - \left(\frac{y \cdot t}{{\left(b - y\right)}^{2} \cdot z} + \frac{a}{b - y}\right)} \]
    4. Simplified3.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, \mathsf{fma}\left(\frac{a}{{\left(b - y\right)}^{2}}, \frac{y}{z}, \frac{t}{b - y}\right)\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right)} \]
    5. Taylor expanded in x around 0 18.7

      \[\leadsto \color{blue}{\left(\frac{y \cdot x}{\left(b - y\right) \cdot z} + \left(\frac{y \cdot a}{{\left(b - y\right)}^{2} \cdot z} + \frac{t}{b - y}\right)\right)} - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right) \]
    6. Simplified4.6

      \[\leadsto \color{blue}{\left(\frac{t}{b - y} + \frac{y}{z} \cdot \left(\frac{a}{{\left(b - y\right)}^{2}} + \frac{x}{b - y}\right)\right)} - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right) \]

    if -345127.01578730391 < z < -4.9404296087192797e-259

    1. Initial program 8.7

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
    2. Simplified8.7

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}} \]
    3. Applied egg-rr8.8

      \[\leadsto \color{blue}{{\left(\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}\right)}^{-1}} \]
    4. Applied egg-rr8.8

      \[\leadsto {\left(\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, \color{blue}{t \cdot z + \left(-a\right) \cdot z}\right)}\right)}^{-1} \]

    if -4.9404296087192797e-259 < z < -2.6105144292203774e-292

    1. Initial program 9.2

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
    2. Simplified9.2

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}} \]
    3. Taylor expanded in z around 0 20.7

      \[\leadsto \color{blue}{x} \]

    if -2.6105144292203774e-292 < z < 9.9858554485448292e36

    1. Initial program 9.1

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
    2. Simplified9.1

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}} \]
    3. Taylor expanded in x around 0 9.1

      \[\leadsto \color{blue}{\left(\frac{t \cdot z}{\left(y + z \cdot b\right) - y \cdot z} + \frac{y \cdot x}{\left(y + z \cdot b\right) - y \cdot z}\right) - \frac{a \cdot z}{\left(y + z \cdot b\right) - y \cdot z}} \]

    if 9.9858554485448292e36 < z

    1. Initial program 41.0

      \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)} \]
    2. Simplified41.0

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}} \]
    3. Taylor expanded in z around inf 22.1

      \[\leadsto \color{blue}{\left(\frac{y \cdot x}{\left(b - y\right) \cdot z} + \left(\frac{a \cdot y}{{\left(b - y\right)}^{2} \cdot z} + \frac{t}{b - y}\right)\right) - \left(\frac{y \cdot t}{{\left(b - y\right)}^{2} \cdot z} + \frac{a}{b - y}\right)} \]
    4. Simplified3.3

      \[\leadsto \color{blue}{\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, \mathsf{fma}\left(\frac{a}{{\left(b - y\right)}^{2}}, \frac{y}{z}, \frac{t}{b - y}\right)\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right)} \]
    5. Taylor expanded in a around 0 1.9

      \[\leadsto \mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, \color{blue}{\frac{t}{b - y}}\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right) \]
  3. Recombined 5 regimes into one program.
  4. Final simplification6.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \leq -345127.0157873039:\\ \;\;\;\;\left(\frac{t}{b - y} + \frac{y}{z} \cdot \left(\frac{a}{{\left(b - y\right)}^{2}} + \frac{x}{b - y}\right)\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right)\\ \mathbf{elif}\;z \leq -4.9404296087192797 \cdot 10^{-259}:\\ \;\;\;\;{\left(\frac{\mathsf{fma}\left(z, b - y, y\right)}{\mathsf{fma}\left(x, y, z \cdot t - z \cdot a\right)}\right)}^{-1}\\ \mathbf{elif}\;z \leq -2.6105144292203774 \cdot 10^{-292}:\\ \;\;\;\;x\\ \mathbf{elif}\;z \leq 9.985855448544829 \cdot 10^{+36}:\\ \;\;\;\;\left(\frac{z \cdot t}{\left(y + z \cdot b\right) - z \cdot y} + \frac{y \cdot x}{\left(y + z \cdot b\right) - z \cdot y}\right) - \frac{z \cdot a}{\left(y + z \cdot b\right) - z \cdot y}\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(\frac{y}{b - y}, \frac{x}{z}, \frac{t}{b - y}\right) - \mathsf{fma}\left(\frac{y}{{\left(b - y\right)}^{2}}, \frac{t}{z}, \frac{a}{b - y}\right)\\ \end{array} \]

Reproduce

herbie shell --seed 2022133 
(FPCore (x y z t a b)
  :name "Development.Shake.Progress:decay from shake-0.15.5"
  :precision binary64

  :herbie-target
  (- (/ (+ (* z t) (* y x)) (+ y (* z (- b y)))) (/ a (+ (- b y) (/ y z))))

  (/ (+ (* x y) (* z (- t a))) (+ y (* z (- b y)))))