Average Error: 6.6 → 3.4
Time: 6.0s
Precision: 64
\[\frac{x \cdot 2}{y \cdot z - t \cdot z}\]
\[\begin{array}{l} \mathbf{if}\;z \le -4.15387447039997915 \cdot 10^{140}:\\ \;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\ \mathbf{elif}\;z \le 1.85210845097292845 \cdot 10^{55}:\\ \;\;\;\;\frac{x}{\left(y - t\right) \cdot z} \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{1} \cdot \frac{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{1}{\sqrt{2}}}}{\frac{z}{\frac{\sqrt[3]{x}}{\frac{y - t}{\sqrt{2}}}}}\\ \end{array}\]
\frac{x \cdot 2}{y \cdot z - t \cdot z}
\begin{array}{l}
\mathbf{if}\;z \le -4.15387447039997915 \cdot 10^{140}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r540575 = x;
        double r540576 = 2.0;
        double r540577 = r540575 * r540576;
        double r540578 = y;
        double r540579 = z;
        double r540580 = r540578 * r540579;
        double r540581 = t;
        double r540582 = r540581 * r540579;
        double r540583 = r540580 - r540582;
        double r540584 = r540577 / r540583;
        return r540584;
}

double f(double x, double y, double z, double t) {
        double r540585 = z;
        double r540586 = -4.153874470399979e+140;
        bool r540587 = r540585 <= r540586;
        double r540588 = x;
        double r540589 = r540588 / r540585;
        double r540590 = y;
        double r540591 = t;
        double r540592 = r540590 - r540591;
        double r540593 = 2.0;
        double r540594 = r540592 / r540593;
        double r540595 = r540589 / r540594;
        double r540596 = 1.8521084509729285e+55;
        bool r540597 = r540585 <= r540596;
        double r540598 = r540592 * r540585;
        double r540599 = r540588 / r540598;
        double r540600 = r540599 * r540593;
        double r540601 = 1.0;
        double r540602 = r540601 / r540601;
        double r540603 = cbrt(r540588);
        double r540604 = r540603 * r540603;
        double r540605 = sqrt(r540593);
        double r540606 = r540601 / r540605;
        double r540607 = r540604 / r540606;
        double r540608 = r540592 / r540605;
        double r540609 = r540603 / r540608;
        double r540610 = r540585 / r540609;
        double r540611 = r540607 / r540610;
        double r540612 = r540602 * r540611;
        double r540613 = r540597 ? r540600 : r540612;
        double r540614 = r540587 ? r540595 : r540613;
        return r540614;
}

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
Target2.0
Herbie3.4
\[\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 z < -4.153874470399979e+140

    1. Initial program 14.1

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

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

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

      \[\leadsto \frac{x}{\color{blue}{\frac{z}{1} \cdot \frac{y - t}{2}}}\]
    6. Applied associate-/r*2.1

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

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

    if -4.153874470399979e+140 < z < 1.8521084509729285e+55

    1. Initial program 2.9

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

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

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

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

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

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

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

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

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

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

    if 1.8521084509729285e+55 < z

    1. Initial program 12.1

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{1} \cdot \color{blue}{\frac{\frac{x}{\frac{y - t}{2}}}{z}}\]
    15. Using strategy rm
    16. Applied add-sqr-sqrt3.0

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

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

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

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

      \[\leadsto \frac{1}{1} \cdot \frac{\color{blue}{\frac{\sqrt[3]{x} \cdot \sqrt[3]{x}}{\frac{1}{\sqrt{2}}} \cdot \frac{\sqrt[3]{x}}{\frac{y - t}{\sqrt{2}}}}}{z}\]
    21. Applied associate-/l*6.1

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

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

Reproduce

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