Average Error: 6.9 → 1.8
Time: 6.3s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\frac{\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt[3]{x}}}}{z} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{2}}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\frac{\frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt[3]{x}}}}{z} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{2}}
double f(double x, double y, double z, double t) {
        double r532396 = x;
        double r532397 = 2.0;
        double r532398 = r532396 * r532397;
        double r532399 = y;
        double r532400 = z;
        double r532401 = r532399 * r532400;
        double r532402 = t;
        double r532403 = r532402 * r532400;
        double r532404 = r532401 - r532403;
        double r532405 = r532398 / r532404;
        return r532405;
}

double f(double x, double y, double z, double t) {
        double r532406 = x;
        double r532407 = cbrt(r532406);
        double r532408 = y;
        double r532409 = t;
        double r532410 = r532408 - r532409;
        double r532411 = cbrt(r532410);
        double r532412 = r532411 * r532411;
        double r532413 = r532412 / r532407;
        double r532414 = r532407 / r532413;
        double r532415 = z;
        double r532416 = r532414 / r532415;
        double r532417 = 2.0;
        double r532418 = r532411 / r532417;
        double r532419 = r532407 / r532418;
        double r532420 = r532416 * r532419;
        return r532420;
}

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.9
Target2.3
Herbie1.8
\[\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. Initial program 6.9

    \[\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}{z} \cdot \frac{x}{\frac{y - t}{\color{blue}{1 \cdot 2}}}\]
  11. Applied add-cube-cbrt6.2

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

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

    \[\leadsto \frac{1}{z} \cdot \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}}\]
  14. Applied times-frac6.4

    \[\leadsto \frac{1}{z} \cdot \color{blue}{\left(\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}}\right)}\]
  15. Applied associate-*r*1.8

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

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

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

Reproduce

herbie shell --seed 2020056 +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))))