Average Error: 7.2 → 3.0
Time: 17.9s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -24528.73585804069443838670849800109863281:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;y \le 2.583080580921436072391451137817466644029 \cdot 10^{67}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -24528.73585804069443838670849800109863281:\\
\;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\

\mathbf{elif}\;y \le 2.583080580921436072391451137817466644029 \cdot 10^{67}:\\
\;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\

\mathbf{else}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

\end{array}
double f(double x, double y, double z, double t) {
        double r359027 = x;
        double r359028 = y;
        double r359029 = r359027 * r359028;
        double r359030 = z;
        double r359031 = r359030 * r359028;
        double r359032 = r359029 - r359031;
        double r359033 = t;
        double r359034 = r359032 * r359033;
        return r359034;
}

double f(double x, double y, double z, double t) {
        double r359035 = y;
        double r359036 = -24528.735858040694;
        bool r359037 = r359035 <= r359036;
        double r359038 = t;
        double r359039 = r359038 * r359035;
        double r359040 = x;
        double r359041 = z;
        double r359042 = r359040 - r359041;
        double r359043 = r359039 * r359042;
        double r359044 = 2.583080580921436e+67;
        bool r359045 = r359035 <= r359044;
        double r359046 = r359035 * r359042;
        double r359047 = r359046 * r359038;
        double r359048 = r359042 * r359038;
        double r359049 = r359035 * r359048;
        double r359050 = r359045 ? r359047 : r359049;
        double r359051 = r359037 ? r359043 : r359050;
        return r359051;
}

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.2
Target3.2
Herbie3.0
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886776938073886590448747944753 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877116200336808272775217995 \cdot 10^{83}:\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \end{array}\]

Derivation

  1. Split input into 3 regimes
  2. if y < -24528.735858040694

    1. Initial program 15.9

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified15.9

      \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right) \cdot t}\]
    3. Using strategy rm
    4. Applied pow115.9

      \[\leadsto \left(y \cdot \left(x - z\right)\right) \cdot \color{blue}{{t}^{1}}\]
    5. Applied pow115.9

      \[\leadsto \left(y \cdot \color{blue}{{\left(x - z\right)}^{1}}\right) \cdot {t}^{1}\]
    6. Applied pow115.9

      \[\leadsto \left(\color{blue}{{y}^{1}} \cdot {\left(x - z\right)}^{1}\right) \cdot {t}^{1}\]
    7. Applied pow-prod-down15.9

      \[\leadsto \color{blue}{{\left(y \cdot \left(x - z\right)\right)}^{1}} \cdot {t}^{1}\]
    8. Applied pow-prod-down15.9

      \[\leadsto \color{blue}{{\left(\left(y \cdot \left(x - z\right)\right) \cdot t\right)}^{1}}\]
    9. Simplified3.4

      \[\leadsto {\color{blue}{\left(y \cdot \left(\left(x - z\right) \cdot t\right)\right)}}^{1}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt4.4

      \[\leadsto {\left(\color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \sqrt[3]{y}\right)} \cdot \left(\left(x - z\right) \cdot t\right)\right)}^{1}\]
    12. Applied associate-*l*4.4

      \[\leadsto {\color{blue}{\left(\left(\sqrt[3]{y} \cdot \sqrt[3]{y}\right) \cdot \left(\sqrt[3]{y} \cdot \left(\left(x - z\right) \cdot t\right)\right)\right)}}^{1}\]
    13. Using strategy rm
    14. Applied add-cube-cbrt4.7

      \[\leadsto {\left(\left(\sqrt[3]{y} \cdot \color{blue}{\left(\left(\sqrt[3]{\sqrt[3]{y}} \cdot \sqrt[3]{\sqrt[3]{y}}\right) \cdot \sqrt[3]{\sqrt[3]{y}}\right)}\right) \cdot \left(\sqrt[3]{y} \cdot \left(\left(x - z\right) \cdot t\right)\right)\right)}^{1}\]
    15. Taylor expanded around inf 15.9

      \[\leadsto {\color{blue}{\left(t \cdot \left(x \cdot y\right) - t \cdot \left(z \cdot y\right)\right)}}^{1}\]
    16. Simplified4.5

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

    if -24528.735858040694 < y < 2.583080580921436e+67

    1. Initial program 2.4

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified2.4

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

    if 2.583080580921436e+67 < y

    1. Initial program 19.4

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified19.4

      \[\leadsto \color{blue}{\left(y \cdot \left(x - z\right)\right) \cdot t}\]
    3. Using strategy rm
    4. Applied pow119.4

      \[\leadsto \left(y \cdot \left(x - z\right)\right) \cdot \color{blue}{{t}^{1}}\]
    5. Applied pow119.4

      \[\leadsto \left(y \cdot \color{blue}{{\left(x - z\right)}^{1}}\right) \cdot {t}^{1}\]
    6. Applied pow119.4

      \[\leadsto \left(\color{blue}{{y}^{1}} \cdot {\left(x - z\right)}^{1}\right) \cdot {t}^{1}\]
    7. Applied pow-prod-down19.4

      \[\leadsto \color{blue}{{\left(y \cdot \left(x - z\right)\right)}^{1}} \cdot {t}^{1}\]
    8. Applied pow-prod-down19.4

      \[\leadsto \color{blue}{{\left(\left(y \cdot \left(x - z\right)\right) \cdot t\right)}^{1}}\]
    9. Simplified4.0

      \[\leadsto {\color{blue}{\left(y \cdot \left(\left(x - z\right) \cdot t\right)\right)}}^{1}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.0

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -24528.73585804069443838670849800109863281:\\ \;\;\;\;\left(t \cdot y\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;y \le 2.583080580921436072391451137817466644029 \cdot 10^{67}:\\ \;\;\;\;\left(y \cdot \left(x - z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019323 +o rules:numerics
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"
  :precision binary64

  :herbie-target
  (if (< t -9.231879582886777e-80) (* (* y t) (- x z)) (if (< t 2.543067051564877e+83) (* y (* t (- x z))) (* (* y (- x z)) t)))

  (* (- (* x y) (* z y)) t))