Average Error: 6.7 → 0.5
Time: 16.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 -3.946824240798518221900802412914984631734 \cdot 10^{289}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.038709607759050920606541682950720354196 \cdot 10^{-301}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.623129453486458621372274209489816720412 \cdot 10^{-288}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.962207706753821704514306347997996992628 \cdot 10^{164}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \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 -3.946824240798518221900802412914984631734 \cdot 10^{289}:\\
\;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r25972146 = x;
        double r25972147 = y;
        double r25972148 = r25972146 * r25972147;
        double r25972149 = z;
        double r25972150 = r25972149 * r25972147;
        double r25972151 = r25972148 - r25972150;
        double r25972152 = t;
        double r25972153 = r25972151 * r25972152;
        return r25972153;
}

double f(double x, double y, double z, double t) {
        double r25972154 = x;
        double r25972155 = y;
        double r25972156 = r25972154 * r25972155;
        double r25972157 = z;
        double r25972158 = r25972157 * r25972155;
        double r25972159 = r25972156 - r25972158;
        double r25972160 = -3.946824240798518e+289;
        bool r25972161 = r25972159 <= r25972160;
        double r25972162 = t;
        double r25972163 = r25972154 - r25972157;
        double r25972164 = r25972162 * r25972163;
        double r25972165 = r25972164 * r25972155;
        double r25972166 = -1.038709607759051e-301;
        bool r25972167 = r25972159 <= r25972166;
        double r25972168 = r25972162 * r25972159;
        double r25972169 = 3.6231294534864586e-288;
        bool r25972170 = r25972159 <= r25972169;
        double r25972171 = 5.962207706753822e+164;
        bool r25972172 = r25972159 <= r25972171;
        double r25972173 = r25972155 * r25972162;
        double r25972174 = r25972163 * r25972173;
        double r25972175 = r25972172 ? r25972168 : r25972174;
        double r25972176 = r25972170 ? r25972165 : r25972175;
        double r25972177 = r25972167 ? r25972168 : r25972176;
        double r25972178 = r25972161 ? r25972165 : r25972177;
        return r25972178;
}

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.7
Target3.0
Herbie0.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 3 regimes
  2. if (- (* x y) (* z y)) < -3.946824240798518e+289 or -1.038709607759051e-301 < (- (* x y) (* z y)) < 3.6231294534864586e-288

    1. Initial program 32.1

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

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

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

    if -3.946824240798518e+289 < (- (* x y) (* z y)) < -1.038709607759051e-301 or 3.6231294534864586e-288 < (- (* x y) (* z y)) < 5.962207706753822e+164

    1. Initial program 0.2

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

    if 5.962207706753822e+164 < (- (* x y) (* z y))

    1. Initial program 22.3

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -3.946824240798518221900802412914984631734 \cdot 10^{289}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -1.038709607759050920606541682950720354196 \cdot 10^{-301}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.623129453486458621372274209489816720412 \cdot 10^{-288}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 5.962207706753821704514306347997996992628 \cdot 10^{164}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2019169 
(FPCore (x y z t)
  :name "Linear.Projection:inverseInfinitePerspective from linear-1.19.1.3"

  :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))