Average Error: 3.6 → 1.8
Time: 8.9s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{3 \cdot z}}{y}\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
\left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{3 \cdot z}}{y}
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))
(FPCore (x y z t)
 :precision binary64
 (+ (- x (/ (/ y 3.0) z)) (/ (/ t (* 3.0 z)) y)))
double code(double x, double y, double z, double t) {
	return (x - (y / (z * 3.0))) + (t / ((z * 3.0) * y));
}
double code(double x, double y, double z, double t) {
	return (x - ((y / 3.0) / z)) + ((t / (3.0 * z)) / y);
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original3.6
Target1.8
Herbie1.8
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Initial program 3.6

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
  2. Using strategy rm
  3. Applied associate-/r*_binary64_157081.8

    \[\leadsto \left(x - \frac{y}{z \cdot 3}\right) + \color{blue}{\frac{\frac{t}{z \cdot 3}}{y}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity_binary64_157641.8

    \[\leadsto \left(x - \frac{\color{blue}{1 \cdot y}}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  6. Applied times-frac_binary64_157701.8

    \[\leadsto \left(x - \color{blue}{\frac{1}{z} \cdot \frac{y}{3}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  7. Using strategy rm
  8. Applied associate-*l/_binary64_157071.8

    \[\leadsto \left(x - \color{blue}{\frac{1 \cdot \frac{y}{3}}{z}}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  9. Simplified1.8

    \[\leadsto \left(x - \frac{\color{blue}{\frac{y}{3}}}{z}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]
  10. Final simplification1.8

    \[\leadsto \left(x - \frac{\frac{y}{3}}{z}\right) + \frac{\frac{t}{3 \cdot z}}{y}\]

Reproduce

herbie shell --seed 2020342 
(FPCore (x y z t)
  :name "Diagrams.Solve.Polynomial:cubForm  from diagrams-solve-0.1, H"
  :precision binary64

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

  (+ (- x (/ y (* z 3.0))) (/ t (* (* z 3.0) y))))