Average Error: 24.0 → 7.5
Time: 30.4s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\frac{t}{\frac{a - z}{y - z}} - \left(\frac{x}{\frac{a - z}{y - z}} - x\right)\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\frac{t}{\frac{a - z}{y - z}} - \left(\frac{x}{\frac{a - z}{y - z}} - x\right)
double f(double x, double y, double z, double t, double a) {
        double r542282 = x;
        double r542283 = y;
        double r542284 = z;
        double r542285 = r542283 - r542284;
        double r542286 = t;
        double r542287 = r542286 - r542282;
        double r542288 = r542285 * r542287;
        double r542289 = a;
        double r542290 = r542289 - r542284;
        double r542291 = r542288 / r542290;
        double r542292 = r542282 + r542291;
        return r542292;
}

double f(double x, double y, double z, double t, double a) {
        double r542293 = t;
        double r542294 = a;
        double r542295 = z;
        double r542296 = r542294 - r542295;
        double r542297 = y;
        double r542298 = r542297 - r542295;
        double r542299 = r542296 / r542298;
        double r542300 = r542293 / r542299;
        double r542301 = x;
        double r542302 = r542301 / r542299;
        double r542303 = r542302 - r542301;
        double r542304 = r542300 - r542303;
        return r542304;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original24.0
Target11.8
Herbie7.5
\[\begin{array}{l} \mathbf{if}\;z \lt -1.253613105609503593846459977496550767343 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.446702369113811028051510715777703865332 \cdot 10^{64}:\\ \;\;\;\;x + \frac{y - z}{\frac{a - z}{t - x}}\\ \mathbf{else}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \end{array}\]

Derivation

  1. Initial program 24.0

    \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
  2. Simplified11.5

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

    \[\leadsto \color{blue}{\frac{y - z}{a - z} \cdot \left(t - x\right) + x}\]
  5. Using strategy rm
  6. Applied clear-num11.6

    \[\leadsto \color{blue}{\frac{1}{\frac{a - z}{y - z}}} \cdot \left(t - x\right) + x\]
  7. Using strategy rm
  8. Applied associate-*l/11.5

    \[\leadsto \color{blue}{\frac{1 \cdot \left(t - x\right)}{\frac{a - z}{y - z}}} + x\]
  9. Simplified11.5

    \[\leadsto \frac{\color{blue}{t - x}}{\frac{a - z}{y - z}} + x\]
  10. Using strategy rm
  11. Applied div-sub11.5

    \[\leadsto \color{blue}{\left(\frac{t}{\frac{a - z}{y - z}} - \frac{x}{\frac{a - z}{y - z}}\right)} + x\]
  12. Applied associate-+l-7.5

    \[\leadsto \color{blue}{\frac{t}{\frac{a - z}{y - z}} - \left(\frac{x}{\frac{a - z}{y - z}} - x\right)}\]
  13. Final simplification7.5

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

Reproduce

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

  :herbie-target
  (if (< z -1.25361310560950359e188) (- t (* (/ y z) (- t x))) (if (< z 4.44670236911381103e64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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