Average Error: 7.0 → 1.8
Time: 8.1s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt[3]{x}}} \cdot \frac{\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{2}}}{z}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt[3]{x}}} \cdot \frac{\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{2}}}{z}
double f(double x, double y, double z, double t) {
        double r638118 = x;
        double r638119 = 2.0;
        double r638120 = r638118 * r638119;
        double r638121 = y;
        double r638122 = z;
        double r638123 = r638121 * r638122;
        double r638124 = t;
        double r638125 = r638124 * r638122;
        double r638126 = r638123 - r638125;
        double r638127 = r638120 / r638126;
        return r638127;
}

double f(double x, double y, double z, double t) {
        double r638128 = x;
        double r638129 = cbrt(r638128);
        double r638130 = y;
        double r638131 = t;
        double r638132 = r638130 - r638131;
        double r638133 = cbrt(r638132);
        double r638134 = r638133 * r638133;
        double r638135 = r638134 / r638129;
        double r638136 = r638129 / r638135;
        double r638137 = 2.0;
        double r638138 = r638133 / r638137;
        double r638139 = r638129 / r638138;
        double r638140 = z;
        double r638141 = r638139 / r638140;
        double r638142 = r638136 * r638141;
        return r638142;
}

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.0
Target2.2
Herbie1.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. Initial program 7.0

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \frac{1}{1} \cdot \color{blue}{\frac{\frac{x}{\frac{y - t}{2}}}{z}}\]
  15. Using strategy rm
  16. Applied *-un-lft-identity5.6

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

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

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

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

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

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

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

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

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

Reproduce

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