Average Error: 7.1 → 2.7
Time: 5.2s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;x \le -8.8263896362557053 \cdot 10^{-53}:\\ \;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\ \mathbf{elif}\;x \le 3.4056700725501648 \cdot 10^{171}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\frac{y - t}{2}} \cdot \sqrt[3]{\frac{y - t}{2}}}}{z} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{\frac{y - t}{2}}}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;x \le -8.8263896362557053 \cdot 10^{-53}:\\
\;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\

\mathbf{elif}\;x \le 3.4056700725501648 \cdot 10^{171}:\\
\;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r597499 = x;
        double r597500 = 2.0;
        double r597501 = r597499 * r597500;
        double r597502 = y;
        double r597503 = z;
        double r597504 = r597502 * r597503;
        double r597505 = t;
        double r597506 = r597505 * r597503;
        double r597507 = r597504 - r597506;
        double r597508 = r597501 / r597507;
        return r597508;
}

double f(double x, double y, double z, double t) {
        double r597509 = x;
        double r597510 = -8.826389636255705e-53;
        bool r597511 = r597509 <= r597510;
        double r597512 = 1.0;
        double r597513 = sqrt(r597512);
        double r597514 = r597513 / r597512;
        double r597515 = y;
        double r597516 = t;
        double r597517 = r597515 - r597516;
        double r597518 = 2.0;
        double r597519 = r597517 / r597518;
        double r597520 = r597509 / r597519;
        double r597521 = z;
        double r597522 = r597520 / r597521;
        double r597523 = r597514 * r597522;
        double r597524 = 3.405670072550165e+171;
        bool r597525 = r597509 <= r597524;
        double r597526 = r597517 * r597521;
        double r597527 = r597509 / r597526;
        double r597528 = r597527 * r597518;
        double r597529 = cbrt(r597509);
        double r597530 = r597529 * r597529;
        double r597531 = cbrt(r597519);
        double r597532 = r597531 * r597531;
        double r597533 = r597530 / r597532;
        double r597534 = r597533 / r597521;
        double r597535 = r597529 / r597531;
        double r597536 = r597534 * r597535;
        double r597537 = r597525 ? r597528 : r597536;
        double r597538 = r597511 ? r597523 : r597537;
        return r597538;
}

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

Original7.1
Target2.1
Herbie2.7
\[\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 3 regimes
  2. if x < -8.826389636255705e-53

    1. Initial program 9.9

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

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

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

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

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

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

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

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

      \[\leadsto \frac{\color{blue}{\sqrt{1} \cdot \sqrt{1}}}{1 \cdot z} \cdot \frac{x}{\frac{y - t}{2}}\]
    12. Applied times-frac2.4

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

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

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

    if -8.826389636255705e-53 < x < 3.405670072550165e+171

    1. Initial program 4.3

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

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

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

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

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

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

      \[\leadsto \color{blue}{\frac{1}{z}} \cdot \frac{x}{\frac{y - t}{2}}\]
    9. Using strategy rm
    10. Applied associate-/r/6.9

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

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

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

    if 3.405670072550165e+171 < x

    1. Initial program 17.8

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le -8.8263896362557053 \cdot 10^{-53}:\\ \;\;\;\;\frac{\sqrt{1}}{1} \cdot \frac{\frac{x}{\frac{y - t}{2}}}{z}\\ \mathbf{elif}\;x \le 3.4056700725501648 \cdot 10^{171}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\sqrt[3]{\frac{y - t}{2}} \cdot \sqrt[3]{\frac{y - t}{2}}}}{z} \cdot \frac{\sqrt[3]{x}}{\sqrt[3]{\frac{y - t}{2}}}\\ \end{array}\]

Reproduce

herbie shell --seed 2020049 
(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))))