Average Error: 0.3 → 0.3
Time: 15.0s
Precision: binary64
Cost: 384
\[\frac{x}{y \cdot 3}\]
\[-\frac{x}{y \cdot -3}\]
\frac{x}{y \cdot 3}
-\frac{x}{y \cdot -3}
(FPCore (x y) :precision binary64 (/ x (* y 3.0)))
(FPCore (x y) :precision binary64 (- (/ x (* y -3.0))))
double code(double x, double y) {
	return x / (y * 3.0);
}
double code(double x, double y) {
	return -(x / (y * -3.0));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original0.3
Target0.2
Herbie0.3
\[\frac{\frac{x}{y}}{3}\]

Derivation

  1. Initial program 0.3

    \[\frac{x}{y \cdot 3}\]
  2. Using strategy rm
  3. Applied frac-2neg_binary64_205490.3

    \[\leadsto \color{blue}{\frac{-x}{-y \cdot 3}}\]
  4. Simplified0.3

    \[\leadsto \frac{-x}{\color{blue}{y \cdot -3}}\]
  5. Using strategy rm
  6. Applied pow1_binary64_205990.3

    \[\leadsto \color{blue}{{\left(\frac{-x}{y \cdot -3}\right)}^{1}}\]
  7. Using strategy rm
  8. Applied distribute-frac-neg_binary64_205010.3

    \[\leadsto {\color{blue}{\left(-\frac{x}{y \cdot -3}\right)}}^{1}\]
  9. Final simplification0.3

    \[\leadsto -\frac{x}{y \cdot -3}\]

Reproduce

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

  :herbie-target
  (/ (/ x y) 3.0)

  (/ x (* y 3.0)))