Average Error: 23.8 → 8.8
Time: 24.7s
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} \le -5.175543709426314317899237427278029417013 \cdot 10^{-293}:\\ \;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{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}:\\ \;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}} + x\\ \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} \le -5.175543709426314317899237427278029417013 \cdot 10^{-293}:\\
\;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{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}:\\
\;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}} + x\\

\end{array}
double f(double x, double y, double z, double t, double a) {
        double r17937001 = x;
        double r17937002 = y;
        double r17937003 = z;
        double r17937004 = r17937002 - r17937003;
        double r17937005 = t;
        double r17937006 = r17937005 - r17937001;
        double r17937007 = r17937004 * r17937006;
        double r17937008 = a;
        double r17937009 = r17937008 - r17937003;
        double r17937010 = r17937007 / r17937009;
        double r17937011 = r17937001 + r17937010;
        return r17937011;
}

double f(double x, double y, double z, double t, double a) {
        double r17937012 = x;
        double r17937013 = y;
        double r17937014 = z;
        double r17937015 = r17937013 - r17937014;
        double r17937016 = t;
        double r17937017 = r17937016 - r17937012;
        double r17937018 = r17937015 * r17937017;
        double r17937019 = a;
        double r17937020 = r17937019 - r17937014;
        double r17937021 = r17937018 / r17937020;
        double r17937022 = r17937012 + r17937021;
        double r17937023 = -5.175543709426314e-293;
        bool r17937024 = r17937022 <= r17937023;
        double r17937025 = cbrt(r17937020);
        double r17937026 = r17937025 * r17937025;
        double r17937027 = r17937015 / r17937026;
        double r17937028 = r17937017 / r17937025;
        double r17937029 = r17937027 * r17937028;
        double r17937030 = r17937029 + r17937012;
        double r17937031 = 0.0;
        bool r17937032 = r17937022 <= r17937031;
        double r17937033 = r17937012 * r17937013;
        double r17937034 = r17937033 / r17937014;
        double r17937035 = r17937016 + r17937034;
        double r17937036 = r17937013 * r17937016;
        double r17937037 = r17937036 / r17937014;
        double r17937038 = r17937035 - r17937037;
        double r17937039 = r17937032 ? r17937038 : r17937030;
        double r17937040 = r17937024 ? r17937030 : r17937039;
        return r17937040;
}

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

Original23.8
Target11.4
Herbie8.8
\[\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 (+ x (/ (* (- y z) (- t x)) (- a z))) < -5.175543709426314e-293 or 0.0 < (+ x (/ (* (- y z) (- t x)) (- a z)))

    1. Initial program 20.5

      \[x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt21.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-frac7.8

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

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

    1. Initial program 59.9

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x + \frac{\left(y - z\right) \cdot \left(t - x\right)}{a - z} \le -5.175543709426314317899237427278029417013 \cdot 10^{-293}:\\ \;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{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}:\\ \;\;\;\;\frac{y - z}{\sqrt[3]{a - z} \cdot \sqrt[3]{a - z}} \cdot \frac{t - x}{\sqrt[3]{a - z}} + x\\ \end{array}\]

Reproduce

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