Average Error: 5.8 → 0.1
Time: 10.6s
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 r874401 = 1.0;
        double r874402 = x;
        double r874403 = r874401 - r874402;
        double r874404 = 3.0;
        double r874405 = r874404 - r874402;
        double r874406 = r874403 * r874405;
        double r874407 = y;
        double r874408 = r874407 * r874404;
        double r874409 = r874406 / r874408;
        return r874409;
}

double f(double x, double y) {
        double r874410 = 1.0;
        double r874411 = x;
        double r874412 = r874410 - r874411;
        double r874413 = y;
        double r874414 = 3.0;
        double r874415 = r874414 - r874411;
        double r874416 = r874414 / r874415;
        double r874417 = r874413 * r874416;
        double r874418 = r874412 / r874417;
        return r874418;
}

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

Derivation

  1. Initial program 5.8

    \[\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. Simplified0.1

    \[\leadsto \frac{1 - x}{\color{blue}{y \cdot \frac{3}{3 - x}}}\]
  5. Using strategy rm
  6. Applied expm1-log1p-u0.1

    \[\leadsto \frac{1 - x}{y \cdot \color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{3}{3 - x}\right)\right)}}\]
  7. Using strategy rm
  8. Applied expm1-log1p0.1

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

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

Reproduce

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