Average Error: 6.7 → 1.8
Time: 4.6s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt{2}}}}{z} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{\sqrt{2}}}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{\sqrt[3]{y - t} \cdot \sqrt[3]{y - t}}{\sqrt{2}}}}{z} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{\sqrt{2}}}
double f(double x, double y, double z, double t) {
        double r539123 = x;
        double r539124 = 2.0;
        double r539125 = r539123 * r539124;
        double r539126 = y;
        double r539127 = z;
        double r539128 = r539126 * r539127;
        double r539129 = t;
        double r539130 = r539129 * r539127;
        double r539131 = r539128 - r539130;
        double r539132 = r539125 / r539131;
        return r539132;
}

double f(double x, double y, double z, double t) {
        double r539133 = x;
        double r539134 = cbrt(r539133);
        double r539135 = r539134 * r539134;
        double r539136 = y;
        double r539137 = t;
        double r539138 = r539136 - r539137;
        double r539139 = cbrt(r539138);
        double r539140 = r539139 * r539139;
        double r539141 = 2.0;
        double r539142 = sqrt(r539141);
        double r539143 = r539140 / r539142;
        double r539144 = r539135 / r539143;
        double r539145 = z;
        double r539146 = r539144 / r539145;
        double r539147 = r539139 / r539142;
        double r539148 = r539134 / r539147;
        double r539149 = r539146 * r539148;
        return r539149;
}

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.1
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.7

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

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

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

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

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

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

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

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

    \[\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}}}{\sqrt{2} \cdot \sqrt{2}}}\]
  12. Applied times-frac6.4

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

    \[\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}}{\sqrt{2}} \cdot \frac{\sqrt[3]{y - t}}{\sqrt{2}}}\]
  14. Applied times-frac6.6

    \[\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}}{\sqrt{2}}} \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{\sqrt{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}}{\sqrt{2}}}\right) \cdot \frac{\sqrt[3]{x}}{\frac{\sqrt[3]{y - t}}{\sqrt{2}}}}\]
  16. Simplified1.8

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

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

Reproduce

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