Average Error: 6.9 → 0.3
Time: 3.9s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.2464801089300593 \cdot 10^{269}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.13568086354090478 \cdot 10^{-295}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.9498152 \cdot 10^{-318}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\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}\;x \cdot y - z \cdot y \le -1.2464801089300593 \cdot 10^{269}:\\
\;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\

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

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

\mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\
\;\;\;\;\left(x \cdot y - z \cdot y\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 r474909 = x;
        double r474910 = y;
        double r474911 = r474909 * r474910;
        double r474912 = z;
        double r474913 = r474912 * r474910;
        double r474914 = r474911 - r474913;
        double r474915 = t;
        double r474916 = r474914 * r474915;
        return r474916;
}

double f(double x, double y, double z, double t) {
        double r474917 = x;
        double r474918 = y;
        double r474919 = r474917 * r474918;
        double r474920 = z;
        double r474921 = r474920 * r474918;
        double r474922 = r474919 - r474921;
        double r474923 = -1.2464801089300593e+269;
        bool r474924 = r474922 <= r474923;
        double r474925 = t;
        double r474926 = r474925 * r474918;
        double r474927 = r474917 - r474920;
        double r474928 = r474926 * r474927;
        double r474929 = 1.0;
        double r474930 = pow(r474928, r474929);
        double r474931 = -2.1356808635409048e-295;
        bool r474932 = r474922 <= r474931;
        double r474933 = r474922 * r474925;
        double r474934 = 1.9498152493431e-318;
        bool r474935 = r474922 <= r474934;
        double r474936 = 5.413160013915973e+273;
        bool r474937 = r474922 <= r474936;
        double r474938 = r474927 * r474925;
        double r474939 = r474918 * r474938;
        double r474940 = r474937 ? r474933 : r474939;
        double r474941 = r474935 ? r474930 : r474940;
        double r474942 = r474932 ? r474933 : r474941;
        double r474943 = r474924 ? r474930 : r474942;
        return r474943;
}

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.9
Target3.1
Herbie0.3
\[\begin{array}{l} \mathbf{if}\;t \lt -9.2318795828867769 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.5430670515648771 \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 (- (* x y) (* z y)) < -1.2464801089300593e+269 or -2.1356808635409048e-295 < (- (* x y) (* z y)) < 1.9498152493431e-318

    1. Initial program 31.3

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

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

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

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

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

    if -1.2464801089300593e+269 < (- (* x y) (* z y)) < -2.1356808635409048e-295 or 1.9498152493431e-318 < (- (* x y) (* z y)) < 5.413160013915973e+273

    1. Initial program 0.3

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]

    if 5.413160013915973e+273 < (- (* x y) (* z y))

    1. Initial program 48.9

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -1.2464801089300593 \cdot 10^{269}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -2.13568086354090478 \cdot 10^{-295}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.9498152 \cdot 10^{-318}:\\ \;\;\;\;{\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)}^{1}\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.41316001391597297 \cdot 10^{273}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{else}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \end{array}\]

Reproduce

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