Average Error: 5.4 → 0.2
Time: 1.9s
Precision: 64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{1}{\frac{y}{1 - x} \cdot \frac{3}{3 - x}}\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{1}{\frac{y}{1 - x} \cdot \frac{3}{3 - x}}
double code(double x, double y) {
	return (((1.0 - x) * (3.0 - x)) / (y * 3.0));
}
double code(double x, double y) {
	return (1.0 / ((y / (1.0 - x)) * (3.0 / (3.0 - x))));
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original5.4
Target0.1
Herbie0.2
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3}\]

Derivation

  1. Initial program 5.4

    \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
  2. Using strategy rm
  3. Applied times-frac0.1

    \[\leadsto \color{blue}{\frac{1 - x}{y} \cdot \frac{3 - x}{3}}\]
  4. Using strategy rm
  5. Applied clear-num0.2

    \[\leadsto \frac{1 - x}{y} \cdot \color{blue}{\frac{1}{\frac{3}{3 - x}}}\]
  6. Applied clear-num0.2

    \[\leadsto \color{blue}{\frac{1}{\frac{y}{1 - x}}} \cdot \frac{1}{\frac{3}{3 - x}}\]
  7. Applied frac-times0.2

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

    \[\leadsto \frac{\color{blue}{1}}{\frac{y}{1 - x} \cdot \frac{3}{3 - x}}\]
  9. Final simplification0.2

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

Reproduce

herbie shell --seed 2020078 
(FPCore (x y)
  :name "Diagrams.TwoD.Arc:bezierFromSweepQ1 from diagrams-lib-1.3.0.3"
  :precision binary64

  :herbie-target
  (* (/ (- 1 x) y) (/ (- 3 x) 3))

  (/ (* (- 1 x) (- 3 x)) (* y 3)))