Average Error: 5.4 → 0.1
Time: 17.4s
Precision: 64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{\left(1 - x\right) \cdot 1}{y \cdot \frac{3}{3 - x}}\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{\left(1 - x\right) \cdot 1}{y \cdot \frac{3}{3 - x}}
double code(double x, double y) {
	return ((double) (((double) (((double) (1.0 - x)) * ((double) (3.0 - x)))) / ((double) (y * 3.0))));
}
double code(double x, double y) {
	return ((double) (((double) (((double) (1.0 - x)) * 1.0)) / ((double) (y * ((double) (3.0 / ((double) (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.1
\[\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 *-un-lft-identity5.4

    \[\leadsto \frac{\left(1 - x\right) \cdot \color{blue}{\left(1 \cdot \left(3 - x\right)\right)}}{y \cdot 3}\]
  4. Applied associate-*r*5.4

    \[\leadsto \frac{\color{blue}{\left(\left(1 - x\right) \cdot 1\right) \cdot \left(3 - x\right)}}{y \cdot 3}\]
  5. Applied associate-/l*0.3

    \[\leadsto \color{blue}{\frac{\left(1 - x\right) \cdot 1}{\frac{y \cdot 3}{3 - x}}}\]
  6. Using strategy rm
  7. Applied *-un-lft-identity0.3

    \[\leadsto \frac{\left(1 - x\right) \cdot 1}{\frac{y \cdot 3}{\color{blue}{1 \cdot \left(3 - x\right)}}}\]
  8. Applied times-frac0.1

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

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

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

Reproduce

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