Average Error: 24.5 → 10.3
Time: 17.9s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -5.229039851220961 \cdot 10^{234} \lor \neg \left(z \le 1.15096756339151705 \cdot 10^{227}\right):\\ \;\;\;\;t + y \cdot \left(\frac{x}{z} - \frac{t}{z}\right)\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;z \le -5.229039851220961 \cdot 10^{234} \lor \neg \left(z \le 1.15096756339151705 \cdot 10^{227}\right):\\
\;\;\;\;t + y \cdot \left(\frac{x}{z} - \frac{t}{z}\right)\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r509747 = x;
        double r509748 = y;
        double r509749 = z;
        double r509750 = r509748 - r509749;
        double r509751 = t;
        double r509752 = r509751 - r509747;
        double r509753 = r509750 * r509752;
        double r509754 = a;
        double r509755 = r509754 - r509749;
        double r509756 = r509753 / r509755;
        double r509757 = r509747 + r509756;
        return r509757;
}

double f(double x, double y, double z, double t, double a) {
        double r509758 = z;
        double r509759 = -5.229039851220961e+234;
        bool r509760 = r509758 <= r509759;
        double r509761 = 1.150967563391517e+227;
        bool r509762 = r509758 <= r509761;
        double r509763 = !r509762;
        bool r509764 = r509760 || r509763;
        double r509765 = t;
        double r509766 = y;
        double r509767 = x;
        double r509768 = r509767 / r509758;
        double r509769 = r509765 / r509758;
        double r509770 = r509768 - r509769;
        double r509771 = r509766 * r509770;
        double r509772 = r509765 + r509771;
        double r509773 = r509766 - r509758;
        double r509774 = a;
        double r509775 = r509774 - r509758;
        double r509776 = cbrt(r509775);
        double r509777 = r509776 * r509776;
        double r509778 = r509773 / r509777;
        double r509779 = r509765 - r509767;
        double r509780 = r509779 / r509776;
        double r509781 = r509778 * r509780;
        double r509782 = r509767 + r509781;
        double r509783 = r509764 ? r509772 : r509782;
        return r509783;
}

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.5
Target12.0
Herbie10.3
\[\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 < -5.229039851220961e+234 or 1.150967563391517e+227 < z

    1. Initial program 52.2

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt52.4

      \[\leadsto x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
    4. Applied times-frac27.7

      \[\leadsto x + \color{blue}{\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt27.7

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

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

      \[\leadsto x + \frac{y - z}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \sqrt[3]{\sqrt[3]{a - z}}}} \cdot \frac{t - x}{\sqrt[3]{a - z}}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt27.9

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

      \[\leadsto x + \color{blue}{\left(\frac{y - z}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right) \cdot \sqrt[3]{\sqrt[3]{a - z}}} \cdot \left(\sqrt[3]{\frac{t - x}{\sqrt[3]{a - z}}} \cdot \sqrt[3]{\frac{t - x}{\sqrt[3]{a - z}}}\right)\right) \cdot \sqrt[3]{\frac{t - x}{\sqrt[3]{a - z}}}}\]
    12. Taylor expanded around inf 23.2

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

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

    if -5.229039851220961e+234 < z < 1.150967563391517e+227

    1. Initial program 19.8

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt20.3

      \[\leadsto x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{\color{blue}{\left(\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}\right) \cdot \sqrt[3]{a - z}}}\]
    4. Applied times-frac9.9

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

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

Reproduce

herbie shell --seed 2020046 
(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))))