Average Error: 24.2 → 9.5
Time: 26.1s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -2.52476166500410494 \cdot 10^{178} \lor \neg \left(z \le 6.03141286179893181 \cdot 10^{165}\right):\\ \;\;\;\;y \cdot \left(\frac{x}{z} - \frac{t}{z}\right) + t\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a - z}{y - z}} - \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\frac{a - z}{y - z}}{\sqrt[3]{x}}} - x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -2.52476166500410494 \cdot 10^{178} \lor \neg \left(z \le 6.03141286179893181 \cdot 10^{165}\right):\\
\;\;\;\;y \cdot \left(\frac{x}{z} - \frac{t}{z}\right) + t\\

\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a - z}{y - z}} - \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\frac{a - z}{y - z}}{\sqrt[3]{x}}} - x\right)\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r474994 = x;
        double r474995 = y;
        double r474996 = z;
        double r474997 = r474995 - r474996;
        double r474998 = t;
        double r474999 = r474998 - r474994;
        double r475000 = r474997 * r474999;
        double r475001 = a;
        double r475002 = r475001 - r474996;
        double r475003 = r475000 / r475002;
        double r475004 = r474994 + r475003;
        return r475004;
}

double f(double x, double y, double z, double t, double a) {
        double r475005 = z;
        double r475006 = -2.524761665004105e+178;
        bool r475007 = r475005 <= r475006;
        double r475008 = 6.031412861798932e+165;
        bool r475009 = r475005 <= r475008;
        double r475010 = !r475009;
        bool r475011 = r475007 || r475010;
        double r475012 = y;
        double r475013 = x;
        double r475014 = r475013 / r475005;
        double r475015 = t;
        double r475016 = r475015 / r475005;
        double r475017 = r475014 - r475016;
        double r475018 = r475012 * r475017;
        double r475019 = r475018 + r475015;
        double r475020 = a;
        double r475021 = r475020 - r475005;
        double r475022 = r475012 - r475005;
        double r475023 = r475021 / r475022;
        double r475024 = r475015 / r475023;
        double r475025 = cbrt(r475013);
        double r475026 = r475025 * r475025;
        double r475027 = r475023 / r475025;
        double r475028 = r475026 / r475027;
        double r475029 = r475028 - r475013;
        double r475030 = r475024 - r475029;
        double r475031 = r475011 ? r475019 : r475030;
        return r475031;
}

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.2
Target12.2
Herbie9.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. Split input into 2 regimes
  2. if z < -2.524761665004105e+178 or 6.031412861798932e+165 < z

    1. Initial program 47.8

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

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

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

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

    if -2.524761665004105e+178 < z < 6.031412861798932e+165

    1. Initial program 16.6

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{t}{\frac{a - z}{y - z}} - \left(\frac{x}{\frac{a - z}{y - z}} - x\right)}\]
    11. Using strategy rm
    12. Applied add-cube-cbrt7.5

      \[\leadsto \frac{t}{\frac{a - z}{y - z}} - \left(\frac{\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}}}{\frac{a - z}{y - z}} - x\right)\]
    13. Applied associate-/l*7.5

      \[\leadsto \frac{t}{\frac{a - z}{y - z}} - \left(\color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\frac{a - z}{y - z}}{\sqrt[3]{x}}}} - x\right)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;z \le -2.52476166500410494 \cdot 10^{178} \lor \neg \left(z \le 6.03141286179893181 \cdot 10^{165}\right):\\ \;\;\;\;y \cdot \left(\frac{x}{z} - \frac{t}{z}\right) + t\\ \mathbf{else}:\\ \;\;\;\;\frac{t}{\frac{a - z}{y - z}} - \left(\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\frac{a - z}{y - z}}{\sqrt[3]{x}}} - x\right)\\ \end{array}\]

Reproduce

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