Average Error: 5.5 → 0.1
Time: 5.6s
Precision: 64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{-\left(1 - x\right)}{\frac{3}{3 - x} \cdot \left(-y\right)}\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{-\left(1 - x\right)}{\frac{3}{3 - x} \cdot \left(-y\right)}
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 - x) / ((3.0 / (3.0 - x)) * -y));
}

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.5
Target0.1
Herbie0.1
\[\frac{1 - x}{y} \cdot \frac{3 - x}{3}\]

Derivation

  1. Initial program 5.5

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

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

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

    \[\leadsto \color{blue}{\frac{3 - x}{3} \cdot \frac{1 - x}{y}}\]
  6. Using strategy rm
  7. Applied frac-2neg0.1

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

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

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

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

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

Reproduce

herbie shell --seed 2020066 +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)))