Average Error: 5.7 → 0.2
Time: 2.3s
Precision: binary64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{1}{y} + \left(0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right) - \frac{x}{y} \cdot 1.3333333333333333\right)\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{1}{y} + \left(0.3333333333333333 \cdot \left(x \cdot \frac{x}{y}\right) - \frac{x}{y} \cdot 1.3333333333333333\right)
(FPCore (x y) :precision binary64 (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))
(FPCore (x y)
 :precision binary64
 (+
  (/ 1.0 y)
  (- (* 0.3333333333333333 (* x (/ x y))) (* (/ x y) 1.3333333333333333))))
double code(double x, double y) {
	return (((double) (((double) (1.0 - x)) * ((double) (3.0 - x)))) / ((double) (y * 3.0)));
}
double code(double x, double y) {
	return ((double) ((1.0 / y) + ((double) (((double) (0.3333333333333333 * ((double) (x * (x / y))))) - ((double) ((x / y) * 1.3333333333333333))))));
}

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

Derivation

  1. Initial program Error: 5.7 bits

    \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
  2. SimplifiedError: 0.4 bits

    \[\leadsto \color{blue}{\left(1 - x\right) \cdot \frac{3 - x}{3 \cdot y}}\]
  3. Using strategy rm
  4. Applied div-invError: 0.5 bits

    \[\leadsto \left(1 - x\right) \cdot \color{blue}{\left(\left(3 - x\right) \cdot \frac{1}{3 \cdot y}\right)}\]
  5. SimplifiedError: 0.2 bits

    \[\leadsto \left(1 - x\right) \cdot \left(\left(3 - x\right) \cdot \color{blue}{\frac{\frac{1}{y}}{3}}\right)\]
  6. Taylor expanded around 0 Error: 5.6 bits

    \[\leadsto \color{blue}{\left(1 \cdot \frac{1}{y} + 0.3333333333333333 \cdot \frac{{x}^{2}}{y}\right) - 1.3333333333333333 \cdot \frac{x}{y}}\]
  7. SimplifiedError: 0.2 bits

    \[\leadsto \color{blue}{\frac{1}{y} + \left(0.3333333333333333 \cdot \left(\frac{x}{y} \cdot x\right) - \frac{x}{y} \cdot 1.3333333333333333\right)}\]
  8. Final simplificationError: 0.2 bits

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

Reproduce

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

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

  (/ (* (- 1.0 x) (- 3.0 x)) (* y 3.0)))