Average Error: 7.0 → 3.0
Time: 10.6s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;t \le -7.89855730043848662453832577712094659601 \cdot 10^{102} \lor \neg \left(t \le 1.942514649585053196773819820514152676405 \cdot 10^{-44}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(-y\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}\;t \le -7.89855730043848662453832577712094659601 \cdot 10^{102} \lor \neg \left(t \le 1.942514649585053196773819820514152676405 \cdot 10^{-44}\right):\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(-y\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 r351241 = x;
        double r351242 = y;
        double r351243 = r351241 * r351242;
        double r351244 = z;
        double r351245 = r351244 * r351242;
        double r351246 = r351243 - r351245;
        double r351247 = t;
        double r351248 = r351246 * r351247;
        return r351248;
}

double f(double x, double y, double z, double t) {
        double r351249 = t;
        double r351250 = -7.898557300438487e+102;
        bool r351251 = r351249 <= r351250;
        double r351252 = 1.9425146495850532e-44;
        bool r351253 = r351249 <= r351252;
        double r351254 = !r351253;
        bool r351255 = r351251 || r351254;
        double r351256 = x;
        double r351257 = y;
        double r351258 = z;
        double r351259 = -r351257;
        double r351260 = r351258 * r351259;
        double r351261 = fma(r351256, r351257, r351260);
        double r351262 = r351261 * r351249;
        double r351263 = r351256 - r351258;
        double r351264 = r351263 * r351249;
        double r351265 = r351257 * r351264;
        double r351266 = r351255 ? r351262 : r351265;
        return r351266;
}

Error

Bits error versus x

Bits error versus y

Bits error versus z

Bits error versus t

Target

Original7.0
Target3.1
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 2 regimes
  2. if t < -7.898557300438487e+102 or 1.9425146495850532e-44 < t

    1. Initial program 3.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied fma-neg3.6

      \[\leadsto \color{blue}{\mathsf{fma}\left(x, y, -z \cdot y\right)} \cdot t\]
    4. Simplified3.6

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

    if -7.898557300438487e+102 < t < 1.9425146495850532e-44

    1. Initial program 8.7

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Using strategy rm
    3. Applied distribute-rgt-out--8.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;t \le -7.89855730043848662453832577712094659601 \cdot 10^{102} \lor \neg \left(t \le 1.942514649585053196773819820514152676405 \cdot 10^{-44}\right):\\ \;\;\;\;\mathsf{fma}\left(x, y, z \cdot \left(-y\right)\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019209 +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.2318795828867769e-80) (* (* y t) (- x z)) (if (< t 2.5430670515648771e83) (* y (* t (- x z))) (* (* y (- x z)) t)))

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