Average Error: 6.7 → 2.5
Time: 5.8s
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 r622303 = x;
        double r622304 = 2.0;
        double r622305 = r622303 * r622304;
        double r622306 = y;
        double r622307 = z;
        double r622308 = r622306 * r622307;
        double r622309 = t;
        double r622310 = r622309 * r622307;
        double r622311 = r622308 - r622310;
        double r622312 = r622305 / r622311;
        return r622312;
}

double f(double x, double y, double z, double t) {
        double r622313 = x;
        double r622314 = -7.516801027411023e-302;
        bool r622315 = r622313 <= r622314;
        double r622316 = 1.567521217467982e+132;
        bool r622317 = r622313 <= r622316;
        double r622318 = !r622317;
        bool r622319 = r622315 || r622318;
        double r622320 = cbrt(r622313);
        double r622321 = cbrt(r622320);
        double r622322 = r622321 * r622321;
        double r622323 = z;
        double r622324 = cbrt(r622323);
        double r622325 = r622324 * r622324;
        double r622326 = r622325 / r622322;
        double r622327 = r622322 / r622326;
        double r622328 = r622324 / r622321;
        double r622329 = r622321 / r622328;
        double r622330 = y;
        double r622331 = t;
        double r622332 = r622330 - r622331;
        double r622333 = 2.0;
        double r622334 = r622332 / r622333;
        double r622335 = r622320 / r622334;
        double r622336 = r622329 * r622335;
        double r622337 = r622327 * r622336;
        double r622338 = r622313 / r622323;
        double r622339 = r622338 / r622334;
        double r622340 = r622319 ? r622337 : r622339;
        return r622340;
}

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