Average Error: 2.0 → 0.2
Time: 23.4s
Precision: 64
\[x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\]
\[\mathsf{fma}\left(a, \frac{z}{t - \left(z - 1\right)} - \frac{y}{t - \left(z - 1\right)}, x\right)\]
x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}
\mathsf{fma}\left(a, \frac{z}{t - \left(z - 1\right)} - \frac{y}{t - \left(z - 1\right)}, x\right)
double f(double x, double y, double z, double t, double a) {
        double r516092 = x;
        double r516093 = y;
        double r516094 = z;
        double r516095 = r516093 - r516094;
        double r516096 = t;
        double r516097 = r516096 - r516094;
        double r516098 = 1.0;
        double r516099 = r516097 + r516098;
        double r516100 = a;
        double r516101 = r516099 / r516100;
        double r516102 = r516095 / r516101;
        double r516103 = r516092 - r516102;
        return r516103;
}

double f(double x, double y, double z, double t, double a) {
        double r516104 = a;
        double r516105 = z;
        double r516106 = t;
        double r516107 = 1.0;
        double r516108 = r516105 - r516107;
        double r516109 = r516106 - r516108;
        double r516110 = r516105 / r516109;
        double r516111 = y;
        double r516112 = r516111 / r516109;
        double r516113 = r516110 - r516112;
        double r516114 = x;
        double r516115 = fma(r516104, r516113, r516114);
        return r516115;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original2.0
Target0.2
Herbie0.2
\[x - \frac{y - z}{\left(t - z\right) + 1} \cdot a\]

Derivation

  1. Initial program 2.0

    \[x - \frac{y - z}{\frac{\left(t - z\right) + 1}{a}}\]
  2. Simplified0.2

    \[\leadsto \color{blue}{\mathsf{fma}\left(a, \frac{z - y}{\left(t - z\right) + 1}, x\right)}\]
  3. Using strategy rm
  4. Applied div-sub0.2

    \[\leadsto \mathsf{fma}\left(a, \color{blue}{\frac{z}{\left(t - z\right) + 1} - \frac{y}{\left(t - z\right) + 1}}, x\right)\]
  5. Using strategy rm
  6. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(a, \frac{z}{\left(t - z\right) + 1} - \color{blue}{1 \cdot \frac{y}{\left(t - z\right) + 1}}, x\right)\]
  7. Applied *-un-lft-identity0.2

    \[\leadsto \mathsf{fma}\left(a, \color{blue}{1 \cdot \frac{z}{\left(t - z\right) + 1}} - 1 \cdot \frac{y}{\left(t - z\right) + 1}, x\right)\]
  8. Applied distribute-lft-out--0.2

    \[\leadsto \mathsf{fma}\left(a, \color{blue}{1 \cdot \left(\frac{z}{\left(t - z\right) + 1} - \frac{y}{\left(t - z\right) + 1}\right)}, x\right)\]
  9. Simplified0.2

    \[\leadsto \mathsf{fma}\left(a, 1 \cdot \color{blue}{\left(\frac{z}{t - \left(z - 1\right)} - \frac{y}{t - \left(z - 1\right)}\right)}, x\right)\]
  10. Final simplification0.2

    \[\leadsto \mathsf{fma}\left(a, \frac{z}{t - \left(z - 1\right)} - \frac{y}{t - \left(z - 1\right)}, x\right)\]

Reproduce

herbie shell --seed 2019306 +o rules:numerics
(FPCore (x y z t a)
  :name "Graphics.Rendering.Chart.SparkLine:renderSparkLine from Chart-1.5.3"
  :precision binary64

  :herbie-target
  (- x (* (/ (- y z) (+ (- t z) 1)) a))

  (- x (/ (- y z) (/ (+ (- t z) 1) a))))