Average Error: 6.7 → 2.5
Time: 7.3s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -7.5168010274110233 \cdot 10^{-302} \lor \neg \left(x \le 1.567521217467982 \cdot 10^{132}\right):\\ \;\;\;\;\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\right)\\ \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 -7.5168010274110233 \cdot 10^{-302} \lor \neg \left(x \le 1.567521217467982 \cdot 10^{132}\right):\\
\;\;\;\;\frac{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}}} \cdot \left(\frac{\sqrt[3]{\sqrt[3]{x}}}{\frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r441239 = x;
        double r441240 = 2.0;
        double r441241 = r441239 * r441240;
        double r441242 = y;
        double r441243 = z;
        double r441244 = r441242 * r441243;
        double r441245 = t;
        double r441246 = r441245 * r441243;
        double r441247 = r441244 - r441246;
        double r441248 = r441241 / r441247;
        return r441248;
}

double f(double x, double y, double z, double t) {
        double r441249 = x;
        double r441250 = -7.516801027411023e-302;
        bool r441251 = r441249 <= r441250;
        double r441252 = 1.567521217467982e+132;
        bool r441253 = r441249 <= r441252;
        double r441254 = !r441253;
        bool r441255 = r441251 || r441254;
        double r441256 = cbrt(r441249);
        double r441257 = cbrt(r441256);
        double r441258 = r441257 * r441257;
        double r441259 = z;
        double r441260 = cbrt(r441259);
        double r441261 = r441260 * r441260;
        double r441262 = r441261 / r441258;
        double r441263 = r441258 / r441262;
        double r441264 = r441260 / r441257;
        double r441265 = r441257 / r441264;
        double r441266 = y;
        double r441267 = t;
        double r441268 = r441266 - r441267;
        double r441269 = 2.0;
        double r441270 = r441268 / r441269;
        double r441271 = r441256 / r441270;
        double r441272 = r441265 * r441271;
        double r441273 = r441263 * r441272;
        double r441274 = r441249 / r441259;
        double r441275 = r441274 / r441270;
        double r441276 = r441255 ? r441273 : r441275;
        return r441276;
}

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.7
Target2.3
Herbie2.5
\[\begin{array}{l} \mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \lt -2.559141628295061 \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.04502782733012586 \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 < -7.516801027411023e-302 or 1.567521217467982e+132 < x

    1. Initial program 8.2

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{\sqrt[3]{x}}{\frac{z}{\sqrt[3]{x}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    9. Using strategy rm
    10. Applied add-cube-cbrt6.3

      \[\leadsto \frac{\sqrt[3]{x}}{\frac{z}{\color{blue}{\left(\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}\right) \cdot \sqrt[3]{\sqrt[3]{x}}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    11. Applied add-cube-cbrt6.4

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

      \[\leadsto \frac{\sqrt[3]{x}}{\color{blue}{\frac{\sqrt[3]{z} \cdot \sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}} \cdot \sqrt[3]{\sqrt[3]{x}}} \cdot \frac{\sqrt[3]{z}}{\sqrt[3]{\sqrt[3]{x}}}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{2}}\]
    13. Applied add-cube-cbrt6.7

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

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

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

    if -7.516801027411023e-302 < x < 1.567521217467982e+132

    1. Initial program 4.3

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

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

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

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

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

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

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

Reproduce

herbie shell --seed 2020062 +o rules:numerics
(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))))