Average Error: 1.8 → 1.6
Time: 5.0s
Precision: 64
\[x + \left(y - x\right) \cdot \frac{z}{t}\]
\[\begin{array}{l} \mathbf{if}\;x \le -1.1131496519401694 \cdot 10^{-128} \lor \neg \left(x \le 1.1326421016751084 \cdot 10^{-125}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\\ \end{array}\]
x + \left(y - x\right) \cdot \frac{z}{t}
\begin{array}{l}
\mathbf{if}\;x \le -1.1131496519401694 \cdot 10^{-128} \lor \neg \left(x \le 1.1326421016751084 \cdot 10^{-125}\right):\\
\;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r760633 = x;
        double r760634 = y;
        double r760635 = r760634 - r760633;
        double r760636 = z;
        double r760637 = t;
        double r760638 = r760636 / r760637;
        double r760639 = r760635 * r760638;
        double r760640 = r760633 + r760639;
        return r760640;
}

double f(double x, double y, double z, double t) {
        double r760641 = x;
        double r760642 = -1.1131496519401694e-128;
        bool r760643 = r760641 <= r760642;
        double r760644 = 1.1326421016751084e-125;
        bool r760645 = r760641 <= r760644;
        double r760646 = !r760645;
        bool r760647 = r760643 || r760646;
        double r760648 = y;
        double r760649 = r760648 - r760641;
        double r760650 = z;
        double r760651 = t;
        double r760652 = r760650 / r760651;
        double r760653 = r760649 * r760652;
        double r760654 = r760641 + r760653;
        double r760655 = cbrt(r760651);
        double r760656 = r760655 * r760655;
        double r760657 = r760649 / r760656;
        double r760658 = r760650 / r760655;
        double r760659 = r760657 * r760658;
        double r760660 = r760641 + r760659;
        double r760661 = r760647 ? r760654 : r760660;
        return r760661;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original1.8
Target2.0
Herbie1.6
\[\begin{array}{l} \mathbf{if}\;\left(y - x\right) \cdot \frac{z}{t} \lt -1013646692435.887:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \mathbf{elif}\;\left(y - x\right) \cdot \frac{z}{t} \lt -0.0:\\ \;\;\;\;x + \frac{\left(y - x\right) \cdot z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\frac{t}{z}}\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -1.1131496519401694e-128 or 1.1326421016751084e-125 < x

    1. Initial program 0.6

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

    if -1.1131496519401694e-128 < x < 1.1326421016751084e-125

    1. Initial program 4.5

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

      \[\leadsto x + \left(y - x\right) \cdot \frac{z}{\color{blue}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}}\]
    4. Applied *-un-lft-identity5.2

      \[\leadsto x + \left(y - x\right) \cdot \frac{\color{blue}{1 \cdot z}}{\left(\sqrt[3]{t} \cdot \sqrt[3]{t}\right) \cdot \sqrt[3]{t}}\]
    5. Applied times-frac5.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -1.1131496519401694 \cdot 10^{-128} \lor \neg \left(x \le 1.1326421016751084 \cdot 10^{-125}\right):\\ \;\;\;\;x + \left(y - x\right) \cdot \frac{z}{t}\\ \mathbf{else}:\\ \;\;\;\;x + \frac{y - x}{\sqrt[3]{t} \cdot \sqrt[3]{t}} \cdot \frac{z}{\sqrt[3]{t}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (x y z t)
  :name "Graphics.Rendering.Plot.Render.Plot.Axis:tickPosition from plot-0.2.3.4"
  :precision binary64

  :herbie-target
  (if (< (* (- y x) (/ z t)) -1013646692435.887) (+ x (/ (- y x) (/ t z))) (if (< (* (- y x) (/ z t)) -0.0) (+ x (/ (* (- y x) z) t)) (+ x (/ (- y x) (/ t z)))))

  (+ x (* (- y x) (/ z t))))