Average Error: 23.8 → 7.3
Time: 27.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 r26972961 = x;
        double r26972962 = y;
        double r26972963 = z;
        double r26972964 = r26972962 - r26972963;
        double r26972965 = t;
        double r26972966 = r26972965 - r26972961;
        double r26972967 = r26972964 * r26972966;
        double r26972968 = a;
        double r26972969 = r26972968 - r26972963;
        double r26972970 = r26972967 / r26972969;
        double r26972971 = r26972961 + r26972970;
        return r26972971;
}

double f(double x, double y, double z, double t, double a) {
        double r26972972 = t;
        double r26972973 = a;
        double r26972974 = z;
        double r26972975 = r26972973 - r26972974;
        double r26972976 = y;
        double r26972977 = r26972976 - r26972974;
        double r26972978 = r26972975 / r26972977;
        double r26972979 = r26972972 / r26972978;
        double r26972980 = x;
        double r26972981 = r26972980 / r26972978;
        double r26972982 = r26972981 - r26972980;
        double r26972983 = r26972979 - r26972982;
        return r26972983;
}

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

Original23.8
Target11.4
Herbie7.3
\[\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 23.8

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

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

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

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

    \[\leadsto \color{blue}{\frac{t - x}{\frac{a - z}{y - z}}} + x\]
  8. Using strategy rm
  9. Applied div-sub11.3

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

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

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

Reproduce

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

  :herbie-target
  (if (< z -1.2536131056095036e+188) (- t (* (/ y z) (- t x))) (if (< z 4.446702369113811e+64) (+ x (/ (- y z) (/ (- a z) (- t x)))) (- t (* (/ y z) (- t x)))))

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