Average Error: 24.1 → 9.0
Time: 22.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 r24338599 = x;
        double r24338600 = y;
        double r24338601 = z;
        double r24338602 = r24338600 - r24338601;
        double r24338603 = t;
        double r24338604 = r24338603 - r24338599;
        double r24338605 = r24338602 * r24338604;
        double r24338606 = a;
        double r24338607 = r24338606 - r24338601;
        double r24338608 = r24338605 / r24338607;
        double r24338609 = r24338599 + r24338608;
        return r24338609;
}

double f(double x, double y, double z, double t, double a) {
        double r24338610 = a;
        double r24338611 = -2.669212786079051e-109;
        bool r24338612 = r24338610 <= r24338611;
        double r24338613 = x;
        double r24338614 = y;
        double r24338615 = z;
        double r24338616 = r24338614 - r24338615;
        double r24338617 = r24338610 - r24338615;
        double r24338618 = r24338616 / r24338617;
        double r24338619 = t;
        double r24338620 = r24338619 - r24338613;
        double r24338621 = r24338618 * r24338620;
        double r24338622 = r24338613 + r24338621;
        double r24338623 = 2.1779022340014837e-87;
        bool r24338624 = r24338610 <= r24338623;
        double r24338625 = r24338615 / r24338614;
        double r24338626 = r24338613 / r24338625;
        double r24338627 = r24338619 + r24338626;
        double r24338628 = r24338619 / r24338625;
        double r24338629 = r24338627 - r24338628;
        double r24338630 = r24338624 ? r24338629 : r24338622;
        double r24338631 = r24338612 ? r24338622 : r24338630;
        return r24338631;
}

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))))