Average Error: 24.1 → 9.0
Time: 21.6s
Precision: 64
\[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
\[\begin{array}{l} \mathbf{if}\;a \le -2.669212786079050965464533172334442113648 \cdot 10^{-109}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\ \mathbf{elif}\;a \le 2.177902234001483733637034366006302694435 \cdot 10^{-87}:\\ \;\;\;\;\left(t + \frac{x}{\frac{z}{y}}\right) - \frac{t}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\ \end{array}\]
x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}
\begin{array}{l}
\mathbf{if}\;a \le -2.669212786079050965464533172334442113648 \cdot 10^{-109}:\\
\;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\

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

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

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r27110431 = x;
        double r27110432 = y;
        double r27110433 = z;
        double r27110434 = r27110432 - r27110433;
        double r27110435 = t;
        double r27110436 = r27110435 - r27110431;
        double r27110437 = r27110434 * r27110436;
        double r27110438 = a;
        double r27110439 = r27110438 - r27110433;
        double r27110440 = r27110437 / r27110439;
        double r27110441 = r27110431 + r27110440;
        return r27110441;
}

double f(double x, double y, double z, double t, double a) {
        double r27110442 = a;
        double r27110443 = -2.669212786079051e-109;
        bool r27110444 = r27110442 <= r27110443;
        double r27110445 = x;
        double r27110446 = y;
        double r27110447 = z;
        double r27110448 = r27110446 - r27110447;
        double r27110449 = r27110442 - r27110447;
        double r27110450 = r27110448 / r27110449;
        double r27110451 = t;
        double r27110452 = r27110451 - r27110445;
        double r27110453 = r27110450 * r27110452;
        double r27110454 = r27110445 + r27110453;
        double r27110455 = 2.1779022340014837e-87;
        bool r27110456 = r27110442 <= r27110455;
        double r27110457 = r27110447 / r27110446;
        double r27110458 = r27110445 / r27110457;
        double r27110459 = r27110451 + r27110458;
        double r27110460 = r27110451 / r27110457;
        double r27110461 = r27110459 - r27110460;
        double r27110462 = r27110456 ? r27110461 : r27110454;
        double r27110463 = r27110444 ? r27110454 : r27110462;
        return r27110463;
}

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.1
Target12.1
Herbie9.0
\[\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 2 regimes
  2. if a < -2.669212786079051e-109 or 2.1779022340014837e-87 < a

    1. Initial program 22.0

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied associate-/l*10.5

      \[\leadsto x + \color{blue}{\frac{y - z}{\frac{a - z}{t - x}}}\]
    4. Using strategy rm
    5. Applied associate-/r/8.0

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

    if -2.669212786079051e-109 < a < 2.1779022340014837e-87

    1. Initial program 28.8

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

      \[\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-frac21.2

      \[\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. Taylor expanded around inf 15.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;a \le -2.669212786079050965464533172334442113648 \cdot 10^{-109}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\ \mathbf{elif}\;a \le 2.177902234001483733637034366006302694435 \cdot 10^{-87}:\\ \;\;\;\;\left(t + \frac{x}{\frac{z}{y}}\right) - \frac{t}{\frac{z}{y}}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - z}{a - z} \cdot \left(t - x\right)\\ \end{array}\]

Reproduce

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