Average Error: 7.1 → 2.5
Time: 3.1s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.965321482920660680349091574476919503658 \cdot 10^{-41} \lor \neg \left(y \le 5590.79461763998097012517973780632019043\right):\\ \;\;\;\;\left(1 \cdot \left(\left(x - z\right) \cdot t\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;y \le -2.965321482920660680349091574476919503658 \cdot 10^{-41} \lor \neg \left(y \le 5590.79461763998097012517973780632019043\right):\\
\;\;\;\;\left(1 \cdot \left(\left(x - z\right) \cdot t\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r423764 = x;
        double r423765 = y;
        double r423766 = r423764 * r423765;
        double r423767 = z;
        double r423768 = r423767 * r423765;
        double r423769 = r423766 - r423768;
        double r423770 = t;
        double r423771 = r423769 * r423770;
        return r423771;
}

double f(double x, double y, double z, double t) {
        double r423772 = y;
        double r423773 = -2.9653214829206607e-41;
        bool r423774 = r423772 <= r423773;
        double r423775 = 5590.794617639981;
        bool r423776 = r423772 <= r423775;
        double r423777 = !r423776;
        bool r423778 = r423774 || r423777;
        double r423779 = 1.0;
        double r423780 = x;
        double r423781 = z;
        double r423782 = r423780 - r423781;
        double r423783 = t;
        double r423784 = r423782 * r423783;
        double r423785 = r423779 * r423784;
        double r423786 = r423785 * r423772;
        double r423787 = -r423781;
        double r423788 = fma(r423787, r423779, r423781);
        double r423789 = r423772 * r423788;
        double r423790 = r423789 * r423783;
        double r423791 = r423786 + r423790;
        double r423792 = r423772 * r423782;
        double r423793 = r423783 * r423792;
        double r423794 = r423778 ? r423791 : r423793;
        return r423794;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.1
Target3.0
Herbie2.5
\[\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 2 regimes
  2. if y < -2.9653214829206607e-41 or 5590.794617639981 < y

    1. Initial program 14.1

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified14.1

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

      \[\leadsto t \cdot \left(y \cdot \left(x - \color{blue}{\left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}}\right)\right)\]
    5. Applied add-cube-cbrt15.0

      \[\leadsto t \cdot \left(y \cdot \left(\color{blue}{\left(\sqrt[3]{x} \cdot \sqrt[3]{x}\right) \cdot \sqrt[3]{x}} - \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right) \cdot \sqrt[3]{z}\right)\right)\]
    6. Applied prod-diff15.0

      \[\leadsto t \cdot \left(y \cdot \color{blue}{\left(\mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\right)\]
    7. Applied distribute-lft-in15.0

      \[\leadsto t \cdot \color{blue}{\left(y \cdot \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right) + y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    8. Applied distribute-lft-in15.0

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \mathsf{fma}\left(\sqrt[3]{x} \cdot \sqrt[3]{x}, \sqrt[3]{x}, -\sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right) + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)}\]
    9. Simplified10.4

      \[\leadsto \color{blue}{\left(t \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right) \cdot y} + t \cdot \left(y \cdot \mathsf{fma}\left(-\sqrt[3]{z}, \sqrt[3]{z} \cdot \sqrt[3]{z}, \sqrt[3]{z} \cdot \left(\sqrt[3]{z} \cdot \sqrt[3]{z}\right)\right)\right)\]
    10. Simplified3.6

      \[\leadsto \left(t \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right) \cdot y + \color{blue}{\left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity3.6

      \[\leadsto \left(\color{blue}{\left(1 \cdot t\right)} \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]
    13. Applied associate-*l*3.6

      \[\leadsto \color{blue}{\left(1 \cdot \left(t \cdot \left(1 \cdot {\left(\sqrt[3]{x}\right)}^{3} + \left(-z\right)\right)\right)\right)} \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]
    14. Simplified3.1

      \[\leadsto \left(1 \cdot \color{blue}{\left(\left(x - z\right) \cdot t\right)}\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\]

    if -2.9653214829206607e-41 < y < 5590.794617639981

    1. Initial program 2.1

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

      \[\leadsto \color{blue}{t \cdot \left(y \cdot \left(x - z\right)\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification2.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.965321482920660680349091574476919503658 \cdot 10^{-41} \lor \neg \left(y \le 5590.79461763998097012517973780632019043\right):\\ \;\;\;\;\left(1 \cdot \left(\left(x - z\right) \cdot t\right)\right) \cdot y + \left(y \cdot \mathsf{fma}\left(-z, 1, z\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;t \cdot \left(y \cdot \left(x - z\right)\right)\\ \end{array}\]

Reproduce

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