Average Error: 24.7 → 9.5
Time: 23.4s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} = -\infty:\\ \;\;\;\;\left(y - z\right) \cdot \frac{\frac{\frac{t - x}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}} + x\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le -1.539254624498238512905823682389083375771 \cdot 10^{-307}:\\ \;\;\;\;\left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z} + x\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le 0.0:\\ \;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} = -\infty:\\
\;\;\;\;\left(y - z\right) \cdot \frac{\frac{\frac{t - x}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}} + x\\

\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le -1.539254624498238512905823682389083375771 \cdot 10^{-307}:\\
\;\;\;\;\left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z} + x\\

\mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le 0.0:\\
\;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r33396303 = x;
        double r33396304 = y;
        double r33396305 = z;
        double r33396306 = r33396304 - r33396305;
        double r33396307 = t;
        double r33396308 = r33396307 - r33396303;
        double r33396309 = r33396306 * r33396308;
        double r33396310 = a;
        double r33396311 = r33396310 - r33396305;
        double r33396312 = r33396309 / r33396311;
        double r33396313 = r33396303 + r33396312;
        return r33396313;
}

double f(double x, double y, double z, double t, double a) {
        double r33396314 = x;
        double r33396315 = y;
        double r33396316 = z;
        double r33396317 = r33396315 - r33396316;
        double r33396318 = t;
        double r33396319 = r33396318 - r33396314;
        double r33396320 = r33396317 * r33396319;
        double r33396321 = a;
        double r33396322 = r33396321 - r33396316;
        double r33396323 = r33396320 / r33396322;
        double r33396324 = r33396314 + r33396323;
        double r33396325 = -inf.0;
        bool r33396326 = r33396324 <= r33396325;
        double r33396327 = cbrt(r33396322);
        double r33396328 = r33396319 / r33396327;
        double r33396329 = r33396328 / r33396327;
        double r33396330 = r33396329 / r33396327;
        double r33396331 = r33396317 * r33396330;
        double r33396332 = r33396331 + r33396314;
        double r33396333 = -1.5392546244982385e-307;
        bool r33396334 = r33396324 <= r33396333;
        double r33396335 = 1.0;
        double r33396336 = r33396335 / r33396322;
        double r33396337 = r33396320 * r33396336;
        double r33396338 = r33396337 + r33396314;
        double r33396339 = 0.0;
        bool r33396340 = r33396324 <= r33396339;
        double r33396341 = r33396314 * r33396315;
        double r33396342 = r33396341 / r33396316;
        double r33396343 = r33396318 + r33396342;
        double r33396344 = r33396315 * r33396318;
        double r33396345 = r33396344 / r33396316;
        double r33396346 = r33396343 - r33396345;
        double r33396347 = r33396319 / r33396322;
        double r33396348 = r33396317 * r33396347;
        double r33396349 = r33396314 + r33396348;
        double r33396350 = r33396340 ? r33396346 : r33396349;
        double r33396351 = r33396334 ? r33396338 : r33396350;
        double r33396352 = r33396326 ? r33396332 : r33396351;
        return r33396352;
}

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.7
Target11.5
Herbie9.5
\[\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. Split input into 4 regimes
  2. if (+ x (/ (* (- y z) (- t x)) (- a z))) < -inf.0

    1. Initial program 64.0

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

      \[\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-frac19.1

      \[\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 div-inv19.1

      \[\leadsto x + \color{blue}{\left(\left(y - z\right) \cdot \frac{1}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}}\right)} \cdot \frac{t - x}{\sqrt[3]{a - z}}\]
    7. Applied associate-*l*19.1

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

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

    if -inf.0 < (+ x (/ (* (- y z) (- t x)) (- a z))) < -1.5392546244982385e-307

    1. Initial program 1.9

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

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

    if -1.5392546244982385e-307 < (+ x (/ (* (- y z) (- t x)) (- a z))) < 0.0

    1. Initial program 61.3

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Taylor expanded around inf 18.9

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

    if 0.0 < (+ x (/ (* (- y z) (- t x)) (- a z)))

    1. Initial program 21.5

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity21.5

      \[\leadsto x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{\color{blue}{1 \cdot \left(a - z\right)}}\]
    4. Applied times-frac10.0

      \[\leadsto x + \color{blue}{\frac{y - z}{1} \cdot \frac{t - x}{a - z}}\]
    5. Simplified10.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} = -\infty:\\ \;\;\;\;\left(y - z\right) \cdot \frac{\frac{\frac{t - x}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}}}{\sqrt[3]{a - z}} + x\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le -1.539254624498238512905823682389083375771 \cdot 10^{-307}:\\ \;\;\;\;\left(\left(y - z\right) \cdot \left(t - x\right)\right) \cdot \frac{1}{a - z} + x\\ \mathbf{elif}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le 0.0:\\ \;\;\;\;\left(t + \frac{x \cdot y}{z}\right) - \frac{y \cdot t}{z}\\ \mathbf{else}:\\ \;\;\;\;x + \left(y - z\right) \cdot \frac{t - x}{a - z}\\ \end{array}\]

Reproduce

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