Average Error: 24.8 → 8.5
Time: 6.0s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[t \cdot \frac{\sqrt[3]{y - z} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y - z}} \cdot \sqrt[3]{\sqrt[3]{y - z}}\right) \cdot \sqrt[3]{\sqrt[3]{y - z}}\right)}{\frac{a - z}{\sqrt[3]{y - z}}} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
t \cdot \frac{\sqrt[3]{y - z} \cdot \left(\left(\sqrt[3]{\sqrt[3]{y - z}} \cdot \sqrt[3]{\sqrt[3]{y - z}}\right) \cdot \sqrt[3]{\sqrt[3]{y - z}}\right)}{\frac{a - z}{\sqrt[3]{y - z}}} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)
double f(double x, double y, double z, double t, double a) {
        double r659745 = x;
        double r659746 = y;
        double r659747 = z;
        double r659748 = r659746 - r659747;
        double r659749 = t;
        double r659750 = r659749 - r659745;
        double r659751 = r659748 * r659750;
        double r659752 = a;
        double r659753 = r659752 - r659747;
        double r659754 = r659751 / r659753;
        double r659755 = r659745 + r659754;
        return r659755;
}

double f(double x, double y, double z, double t, double a) {
        double r659756 = t;
        double r659757 = y;
        double r659758 = z;
        double r659759 = r659757 - r659758;
        double r659760 = cbrt(r659759);
        double r659761 = cbrt(r659760);
        double r659762 = r659761 * r659761;
        double r659763 = r659762 * r659761;
        double r659764 = r659760 * r659763;
        double r659765 = a;
        double r659766 = r659765 - r659758;
        double r659767 = r659766 / r659760;
        double r659768 = r659764 / r659767;
        double r659769 = r659756 * r659768;
        double r659770 = x;
        double r659771 = -r659770;
        double r659772 = r659759 / r659766;
        double r659773 = fma(r659771, r659772, r659770);
        double r659774 = r659769 + r659773;
        return r659774;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original24.8
Target11.9
Herbie8.5
\[\begin{array}{l} \mathbf{if}\;z \lt -1.25361310560950359 \cdot 10^{188}:\\ \;\;\;\;t - \frac{y}{z} \cdot \left(t - x\right)\\ \mathbf{elif}\;z \lt 4.44670236911381103 \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.8

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

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

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

    \[\leadsto \frac{y - z}{a - z} \cdot \color{blue}{\left(t + \left(-x\right)\right)} + x\]
  7. Applied distribute-rgt-in11.7

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

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

    \[\leadsto t \cdot \frac{y - z}{a - z} + \color{blue}{\mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)}\]
  10. Using strategy rm
  11. Applied add-cube-cbrt8.3

    \[\leadsto t \cdot \frac{\color{blue}{\left(\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}\right) \cdot \sqrt[3]{y - z}}}{a - z} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
  12. Applied associate-/l*8.3

    \[\leadsto t \cdot \color{blue}{\frac{\sqrt[3]{y - z} \cdot \sqrt[3]{y - z}}{\frac{a - z}{\sqrt[3]{y - z}}}} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
  13. Using strategy rm
  14. Applied add-cube-cbrt8.5

    \[\leadsto t \cdot \frac{\sqrt[3]{y - z} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{y - z}} \cdot \sqrt[3]{\sqrt[3]{y - z}}\right) \cdot \sqrt[3]{\sqrt[3]{y - z}}\right)}}{\frac{a - z}{\sqrt[3]{y - z}}} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\]
  15. Final simplification8.5

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

Reproduce

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