Average Error: 6.6 → 2.9
Time: 13.5s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \cdot 2 \le -8.487545604087800663717439236716923273121 \cdot 10^{116}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{x \cdot 2}{y - t}} \cdot \sqrt[3]{\frac{x \cdot 2}{y - t}}}{\frac{z}{\sqrt[3]{\frac{x \cdot 2}{y - t}}}}\\ \mathbf{elif}\;x \cdot 2 \le 4.672191924242227383090621876278125047429 \cdot 10^{-197}:\\ \;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\ \mathbf{elif}\;x \cdot 2 \le 3.071367817763602617128651373833917514734 \cdot 10^{113}:\\ \;\;\;\;\frac{\frac{x \cdot 2}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(y - t\right)}}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{x \cdot 2}{y - t}} \cdot \sqrt[3]{\frac{x \cdot 2}{y - t}}}{\frac{z}{\sqrt[3]{\frac{x \cdot 2}{y - t}}}}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \le -8.487545604087800663717439236716923273121 \cdot 10^{116}:\\
\;\;\;\;\frac{\sqrt[3]{\frac{x \cdot 2}{y - t}} \cdot \sqrt[3]{\frac{x \cdot 2}{y - t}}}{\frac{z}{\sqrt[3]{\frac{x \cdot 2}{y - t}}}}\\

\mathbf{elif}\;x \cdot 2 \le 4.672191924242227383090621876278125047429 \cdot 10^{-197}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\

\mathbf{elif}\;x \cdot 2 \le 3.071367817763602617128651373833917514734 \cdot 10^{113}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(y - t\right)}}{\sqrt[3]{z}}\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r368924 = x;
        double r368925 = 2.0;
        double r368926 = r368924 * r368925;
        double r368927 = y;
        double r368928 = z;
        double r368929 = r368927 * r368928;
        double r368930 = t;
        double r368931 = r368930 * r368928;
        double r368932 = r368929 - r368931;
        double r368933 = r368926 / r368932;
        return r368933;
}

double f(double x, double y, double z, double t) {
        double r368934 = x;
        double r368935 = 2.0;
        double r368936 = r368934 * r368935;
        double r368937 = -8.4875456040878e+116;
        bool r368938 = r368936 <= r368937;
        double r368939 = y;
        double r368940 = t;
        double r368941 = r368939 - r368940;
        double r368942 = r368936 / r368941;
        double r368943 = cbrt(r368942);
        double r368944 = r368943 * r368943;
        double r368945 = z;
        double r368946 = r368945 / r368943;
        double r368947 = r368944 / r368946;
        double r368948 = 4.6721919242422274e-197;
        bool r368949 = r368936 <= r368948;
        double r368950 = r368936 / r368945;
        double r368951 = r368950 / r368941;
        double r368952 = 3.0713678177636026e+113;
        bool r368953 = r368936 <= r368952;
        double r368954 = cbrt(r368945);
        double r368955 = r368954 * r368954;
        double r368956 = r368955 * r368941;
        double r368957 = r368936 / r368956;
        double r368958 = r368957 / r368954;
        double r368959 = r368953 ? r368958 : r368947;
        double r368960 = r368949 ? r368951 : r368959;
        double r368961 = r368938 ? r368947 : r368960;
        return r368961;
}

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.6
Target1.9
Herbie2.9
\[\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.045027827330126029709547581125571222799 \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 3 regimes
  2. if (* x 2.0) < -8.4875456040878e+116 or 3.0713678177636026e+113 < (* x 2.0)

    1. Initial program 14.4

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

      \[\leadsto \color{blue}{\frac{2}{y - t} \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied associate-*r/4.0

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

      \[\leadsto \frac{\color{blue}{\frac{x \cdot 2}{y - t}}}{z}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt4.9

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

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

    if -8.4875456040878e+116 < (* x 2.0) < 4.6721919242422274e-197

    1. Initial program 3.8

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

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

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

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

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

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

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

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

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

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

    if 4.6721919242422274e-197 < (* x 2.0) < 3.0713678177636026e+113

    1. Initial program 3.5

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

      \[\leadsto \color{blue}{\frac{2}{y - t} \cdot \frac{x}{z}}\]
    3. Using strategy rm
    4. Applied associate-*r/4.6

      \[\leadsto \color{blue}{\frac{\frac{2}{y - t} \cdot x}{z}}\]
    5. Simplified4.5

      \[\leadsto \frac{\color{blue}{\frac{x \cdot 2}{y - t}}}{z}\]
    6. Using strategy rm
    7. Applied add-cube-cbrt5.3

      \[\leadsto \frac{\frac{x \cdot 2}{y - t}}{\color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}}\]
    8. Applied associate-/r*5.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot 2 \le -8.487545604087800663717439236716923273121 \cdot 10^{116}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{x \cdot 2}{y - t}} \cdot \sqrt[3]{\frac{x \cdot 2}{y - t}}}{\frac{z}{\sqrt[3]{\frac{x \cdot 2}{y - t}}}}\\ \mathbf{elif}\;x \cdot 2 \le 4.672191924242227383090621876278125047429 \cdot 10^{-197}:\\ \;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\ \mathbf{elif}\;x \cdot 2 \le 3.071367817763602617128651373833917514734 \cdot 10^{113}:\\ \;\;\;\;\frac{\frac{x \cdot 2}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \left(y - t\right)}}{\sqrt[3]{z}}\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt[3]{\frac{x \cdot 2}{y - t}} \cdot \sqrt[3]{\frac{x \cdot 2}{y - t}}}{\frac{z}{\sqrt[3]{\frac{x \cdot 2}{y - t}}}}\\ \end{array}\]

Reproduce

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

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

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