Average Error: 6.7 → 0.5
Time: 16.6s
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 r25323175 = x;
        double r25323176 = y;
        double r25323177 = r25323175 * r25323176;
        double r25323178 = z;
        double r25323179 = r25323178 * r25323176;
        double r25323180 = r25323177 - r25323179;
        double r25323181 = t;
        double r25323182 = r25323180 * r25323181;
        return r25323182;
}

double f(double x, double y, double z, double t) {
        double r25323183 = x;
        double r25323184 = y;
        double r25323185 = r25323183 * r25323184;
        double r25323186 = z;
        double r25323187 = r25323186 * r25323184;
        double r25323188 = r25323185 - r25323187;
        double r25323189 = -3.946824240798518e+289;
        bool r25323190 = r25323188 <= r25323189;
        double r25323191 = t;
        double r25323192 = r25323183 - r25323186;
        double r25323193 = r25323191 * r25323192;
        double r25323194 = r25323193 * r25323184;
        double r25323195 = -1.038709607759051e-301;
        bool r25323196 = r25323188 <= r25323195;
        double r25323197 = r25323191 * r25323188;
        double r25323198 = 3.6231294534864586e-288;
        bool r25323199 = r25323188 <= r25323198;
        double r25323200 = 5.962207706753822e+164;
        bool r25323201 = r25323188 <= r25323200;
        double r25323202 = r25323184 * r25323191;
        double r25323203 = r25323192 * r25323202;
        double r25323204 = r25323201 ? r25323197 : r25323203;
        double r25323205 = r25323199 ? r25323194 : r25323204;
        double r25323206 = r25323196 ? r25323197 : r25323205;
        double r25323207 = r25323190 ? r25323194 : r25323206;
        return r25323207;
}

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 +o rules:numerics
(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))