Average Error: 23.9 → 8.1
Time: 7.2s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.5046416024944056 \cdot 10^{-203} \lor \neg \left(a \le 3.1595740263796063 \cdot 10^{-93}\right):\\ \;\;\;\;\left(\frac{y - z}{a - z} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right) \cdot \sqrt[3]{t} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{a - z} \cdot t + \frac{x \cdot y}{z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.5046416024944056 \cdot 10^{-203} \lor \neg \left(a \le 3.1595740263796063 \cdot 10^{-93}\right):\\
\;\;\;\;\left(\frac{y - z}{a - z} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right) \cdot \sqrt[3]{t} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{y - z}{a - z} \cdot t + \frac{x \cdot y}{z}\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r645314 = x;
        double r645315 = y;
        double r645316 = z;
        double r645317 = r645315 - r645316;
        double r645318 = t;
        double r645319 = r645318 - r645314;
        double r645320 = r645317 * r645319;
        double r645321 = a;
        double r645322 = r645321 - r645316;
        double r645323 = r645320 / r645322;
        double r645324 = r645314 + r645323;
        return r645324;
}

double f(double x, double y, double z, double t, double a) {
        double r645325 = a;
        double r645326 = -2.5046416024944056e-203;
        bool r645327 = r645325 <= r645326;
        double r645328 = 3.1595740263796063e-93;
        bool r645329 = r645325 <= r645328;
        double r645330 = !r645329;
        bool r645331 = r645327 || r645330;
        double r645332 = y;
        double r645333 = z;
        double r645334 = r645332 - r645333;
        double r645335 = r645325 - r645333;
        double r645336 = r645334 / r645335;
        double r645337 = t;
        double r645338 = cbrt(r645337);
        double r645339 = r645338 * r645338;
        double r645340 = r645336 * r645339;
        double r645341 = r645340 * r645338;
        double r645342 = x;
        double r645343 = -r645342;
        double r645344 = fma(r645343, r645336, r645342);
        double r645345 = r645341 + r645344;
        double r645346 = r645336 * r645337;
        double r645347 = r645342 * r645332;
        double r645348 = r645347 / r645333;
        double r645349 = r645346 + r645348;
        double r645350 = r645331 ? r645345 : r645349;
        return r645350;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Bits error versus a

Target

Original23.9
Target12.0
Herbie8.1
\[\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. Split input into 2 regimes
  2. if a < -2.5046416024944056e-203 or 3.1595740263796063e-93 < a

    1. Initial program 22.5

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

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

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

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

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

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

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

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

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

    if -2.5046416024944056e-203 < a < 3.1595740263796063e-93

    1. Initial program 28.6

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

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

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

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

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

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

      \[\leadsto \frac{y - z}{a - z} \cdot t + \color{blue}{\mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)}\]
    10. Taylor expanded around inf 11.6

      \[\leadsto \frac{y - z}{a - z} \cdot t + \color{blue}{\frac{x \cdot y}{z}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.5046416024944056 \cdot 10^{-203} \lor \neg \left(a \le 3.1595740263796063 \cdot 10^{-93}\right):\\ \;\;\;\;\left(\frac{y - z}{a - z} \cdot \left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right)\right) \cdot \sqrt[3]{t} + \mathsf{fma}\left(-x, \frac{y - z}{a - z}, x\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{y - z}{a - z} \cdot t + \frac{x \cdot y}{z}\\ \end{array}\]

Reproduce

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