Average Error: 7.4 → 0.4
Time: 20.2s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -9.323663551952470698278204858178795786748 \cdot 10^{273} \lor \neg \left(x \cdot y - z \cdot y \le -3.486873513766448555626414525010512525823 \cdot 10^{-187} \lor \neg \left(x \cdot y - z \cdot y \le 2.805253723888293891380057854693287178456 \cdot 10^{-171}\right) \land x \cdot y - z \cdot y \le 3.577383403782653804614020956085056771166 \cdot 10^{252}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y \le -9.323663551952470698278204858178795786748 \cdot 10^{273} \lor \neg \left(x \cdot y - z \cdot y \le -3.486873513766448555626414525010512525823 \cdot 10^{-187} \lor \neg \left(x \cdot y - z \cdot y \le 2.805253723888293891380057854693287178456 \cdot 10^{-171}\right) \land x \cdot y - z \cdot y \le 3.577383403782653804614020956085056771166 \cdot 10^{252}\right):\\
\;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\

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

\end{array}
double f(double x, double y, double z, double t) {
        double r313922 = x;
        double r313923 = y;
        double r313924 = r313922 * r313923;
        double r313925 = z;
        double r313926 = r313925 * r313923;
        double r313927 = r313924 - r313926;
        double r313928 = t;
        double r313929 = r313927 * r313928;
        return r313929;
}

double f(double x, double y, double z, double t) {
        double r313930 = x;
        double r313931 = y;
        double r313932 = r313930 * r313931;
        double r313933 = z;
        double r313934 = r313933 * r313931;
        double r313935 = r313932 - r313934;
        double r313936 = -9.32366355195247e+273;
        bool r313937 = r313935 <= r313936;
        double r313938 = -3.4868735137664486e-187;
        bool r313939 = r313935 <= r313938;
        double r313940 = 2.805253723888294e-171;
        bool r313941 = r313935 <= r313940;
        double r313942 = !r313941;
        double r313943 = 3.577383403782654e+252;
        bool r313944 = r313935 <= r313943;
        bool r313945 = r313942 && r313944;
        bool r313946 = r313939 || r313945;
        double r313947 = !r313946;
        bool r313948 = r313937 || r313947;
        double r313949 = t;
        double r313950 = r313930 - r313933;
        double r313951 = r313949 * r313950;
        double r313952 = r313931 * r313951;
        double r313953 = r313935 * r313949;
        double r313954 = r313948 ? r313952 : r313953;
        return r313954;
}

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.4
Target3.1
Herbie0.4
\[\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 (- (* x y) (* z y)) < -9.32366355195247e+273 or -3.4868735137664486e-187 < (- (* x y) (* z y)) < 2.805253723888294e-171 or 3.577383403782654e+252 < (- (* x y) (* z y))

    1. Initial program 24.0

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

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

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

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

    if -9.32366355195247e+273 < (- (* x y) (* z y)) < -3.4868735137664486e-187 or 2.805253723888294e-171 < (- (* x y) (* z y)) < 3.577383403782654e+252

    1. Initial program 0.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -9.323663551952470698278204858178795786748 \cdot 10^{273} \lor \neg \left(x \cdot y - z \cdot y \le -3.486873513766448555626414525010512525823 \cdot 10^{-187} \lor \neg \left(x \cdot y - z \cdot y \le 2.805253723888293891380057854693287178456 \cdot 10^{-171}\right) \land x \cdot y - z \cdot y \le 3.577383403782653804614020956085056771166 \cdot 10^{252}\right):\\ \;\;\;\;y \cdot \left(t \cdot \left(x - z\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \end{array}\]

Reproduce

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