Average Error: 23.3 → 23.2
Time: 6.1s
Precision: 64
\[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
\[\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}\]
\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}
\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}
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) {
	return (fma(x, y, (z * (t - a))) / fma(z, (b - y), y));
}

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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original23.3
Target18.1
Herbie23.2
\[\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. Initial program 23.3

    \[\frac{x \cdot y + z \cdot \left(t - a\right)}{y + z \cdot \left(b - y\right)}\]
  2. Using strategy rm
  3. Applied *-un-lft-identity23.3

    \[\leadsto \frac{x \cdot y + z \cdot \left(t - a\right)}{\color{blue}{1 \cdot \left(y + z \cdot \left(b - y\right)\right)}}\]
  4. Applied *-un-lft-identity23.3

    \[\leadsto \frac{\color{blue}{1 \cdot \left(x \cdot y + z \cdot \left(t - a\right)\right)}}{1 \cdot \left(y + z \cdot \left(b - y\right)\right)}\]
  5. Applied times-frac23.3

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

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

    \[\leadsto 1 \cdot \color{blue}{\frac{\mathsf{fma}\left(x, y, z \cdot \left(t - a\right)\right)}{\mathsf{fma}\left(z, b - y, y\right)}}\]
  8. Final simplification23.2

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

Reproduce

herbie shell --seed 2020103 +o rules:numerics
(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)))))