Average Error: 5.7 → 0.1
Time: 3.5s
Precision: 64
\[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
\[\frac{1 - x}{y \cdot \frac{3}{3 - x}}\]
\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}
\frac{1 - x}{y \cdot \frac{3}{3 - x}}
double f(double x, double y) {
        double r673094 = 1.0;
        double r673095 = x;
        double r673096 = r673094 - r673095;
        double r673097 = 3.0;
        double r673098 = r673097 - r673095;
        double r673099 = r673096 * r673098;
        double r673100 = y;
        double r673101 = r673100 * r673097;
        double r673102 = r673099 / r673101;
        return r673102;
}

double f(double x, double y) {
        double r673103 = 1.0;
        double r673104 = x;
        double r673105 = r673103 - r673104;
        double r673106 = y;
        double r673107 = 3.0;
        double r673108 = r673107 - r673104;
        double r673109 = r673107 / r673108;
        double r673110 = r673106 * r673109;
        double r673111 = r673105 / r673110;
        return r673111;
}

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

Derivation

  1. Initial program 5.7

    \[\frac{\left(1 - x\right) \cdot \left(3 - x\right)}{y \cdot 3}\]
  2. Using strategy rm
  3. Applied associate-/l*0.3

    \[\leadsto \color{blue}{\frac{1 - x}{\frac{y \cdot 3}{3 - x}}}\]
  4. Using strategy rm
  5. Applied *-un-lft-identity0.3

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

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

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

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

Reproduce

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