Average Error: 3.4 → 1.8
Time: 3.9s
Precision: binary64
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
\[x + \left(\frac{-0.3333333333333333}{z} \cdot y + \left(t \cdot \frac{0.3333333333333333}{z}\right) \cdot \frac{1}{y}\right)\]
\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}
x + \left(\frac{-0.3333333333333333}{z} \cdot y + \left(t \cdot \frac{0.3333333333333333}{z}\right) \cdot \frac{1}{y}\right)
(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
  (+
   (* (/ -0.3333333333333333 z) y)
   (* (* t (/ 0.3333333333333333 z)) (/ 1.0 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 + (((-0.3333333333333333 / z) * y) + ((t * (0.3333333333333333 / z)) * (1.0 / 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.4
Target1.7
Herbie1.8
\[\left(x - \frac{y}{z \cdot 3}\right) + \frac{\frac{t}{z \cdot 3}}{y}\]

Derivation

  1. Initial program 3.4

    \[\left(x - \frac{y}{z \cdot 3}\right) + \frac{t}{\left(z \cdot 3\right) \cdot y}\]
  2. Simplified3.8

    \[\leadsto \color{blue}{x + \frac{-0.3333333333333333}{z} \cdot \left(y - \frac{t}{y}\right)}\]
  3. Using strategy rm
  4. Applied div-inv_binary643.8

    \[\leadsto x + \color{blue}{\left(-0.3333333333333333 \cdot \frac{1}{z}\right)} \cdot \left(y - \frac{t}{y}\right)\]
  5. Using strategy rm
  6. Applied sub-neg_binary643.8

    \[\leadsto x + \left(-0.3333333333333333 \cdot \frac{1}{z}\right) \cdot \color{blue}{\left(y + \left(-\frac{t}{y}\right)\right)}\]
  7. Applied distribute-lft-in_binary643.8

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

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

    \[\leadsto x + \left(\frac{-0.3333333333333333}{z} \cdot y + \color{blue}{t \cdot \frac{\frac{0.3333333333333333}{z}}{y}}\right)\]
  10. Using strategy rm
  11. Applied div-inv_binary643.8

    \[\leadsto x + \left(\frac{-0.3333333333333333}{z} \cdot y + t \cdot \color{blue}{\left(\frac{0.3333333333333333}{z} \cdot \frac{1}{y}\right)}\right)\]
  12. Applied associate-*r*_binary641.8

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

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

Reproduce

herbie shell --seed 2020220 
(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))))