Average Error: 6.8 → 2.8
Time: 4.3s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -2.320741883373177528540339099083515625063 \cdot 10^{180} \lor \neg \left(x \le 266999013784891418240589234176\right):\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \le -2.320741883373177528540339099083515625063 \cdot 10^{180} \lor \neg \left(x \le 266999013784891418240589234176\right):\\
\;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\

\end{array}
double f(double x, double y, double z, double t) {
        double r704038 = x;
        double r704039 = 2.0;
        double r704040 = r704038 * r704039;
        double r704041 = y;
        double r704042 = z;
        double r704043 = r704041 * r704042;
        double r704044 = t;
        double r704045 = r704044 * r704042;
        double r704046 = r704043 - r704045;
        double r704047 = r704040 / r704046;
        return r704047;
}

double f(double x, double y, double z, double t) {
        double r704048 = x;
        double r704049 = -2.3207418833731775e+180;
        bool r704050 = r704048 <= r704049;
        double r704051 = 2.6699901378489142e+29;
        bool r704052 = r704048 <= r704051;
        double r704053 = !r704052;
        bool r704054 = r704050 || r704053;
        double r704055 = 1.0;
        double r704056 = cbrt(r704055);
        double r704057 = r704056 * r704056;
        double r704058 = r704057 / r704055;
        double r704059 = y;
        double r704060 = t;
        double r704061 = r704059 - r704060;
        double r704062 = 2.0;
        double r704063 = r704061 / r704062;
        double r704064 = r704048 / r704063;
        double r704065 = z;
        double r704066 = r704064 / r704065;
        double r704067 = r704058 * r704066;
        double r704068 = r704048 / r704065;
        double r704069 = r704068 / r704063;
        double r704070 = r704054 ? r704067 : r704069;
        return r704070;
}

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

Original6.8
Target2.1
Herbie2.8
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt -2.559141628295061113708240820439530037456 \cdot 10^{-13}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt 1.045027827330125861587720199944080049996 \cdot 10^{-269}:\\ \;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\ \mathbf{else}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \end{array}\]

Derivation

  1. Split input into 2 regimes
  2. if x < -2.3207418833731775e+180 or 2.6699901378489142e+29 < x

    1. Initial program 13.0

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
    2. Simplified12.4

      \[\leadsto \color{blue}{\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity12.4

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

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{y - t}{2}}}\]
    6. Applied *-un-lft-identity12.4

      \[\leadsto \frac{\color{blue}{1 \cdot x}}{\frac{z}{1} \cdot \frac{y - t}{2}}\]
    7. Applied times-frac3.2

      \[\leadsto \color{blue}{\frac{1}{\frac{z}{1}} \cdot \frac{x}{\frac{y - t}{2}}}\]
    8. Simplified3.2

      \[\leadsto \color{blue}{\frac{1}{z}} \cdot \frac{x}{\frac{y - t}{2}}\]
    9. Using strategy rm
    10. Applied *-un-lft-identity3.2

      \[\leadsto \frac{1}{\color{blue}{1 \cdot z}} \cdot \frac{x}{\frac{y - t}{2}}\]
    11. Applied add-cube-cbrt3.2

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

      \[\leadsto \color{blue}{\left(\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{z}\right)} \cdot \frac{x}{\frac{y - t}{2}}\]
    13. Applied associate-*l*3.2

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

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

    if -2.3207418833731775e+180 < x < 2.6699901378489142e+29

    1. Initial program 4.5

      \[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
    2. Simplified3.1

      \[\leadsto \color{blue}{\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity3.1

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

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{y - t}{2}}}\]
    6. Applied associate-/r*2.7

      \[\leadsto \color{blue}{\frac{\frac{x}{\frac{z}{1}}}{\frac{y - t}{2}}}\]
    7. Simplified2.7

      \[\leadsto \frac{\color{blue}{\frac{x}{z}}}{\frac{y - t}{2}}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.8

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -2.320741883373177528540339099083515625063 \cdot 10^{180} \lor \neg \left(x \le 266999013784891418240589234176\right):\\ \;\;\;\;\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019362 
(FPCore (x y z t)
  :name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
  :precision binary64

  :herbie-target
  (if (< (/ (* x 2) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))

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