Average Error: 6.9 → 0.5
Time: 16.5s
Precision: 64
\[\left(x \cdot y - z \cdot y\right) \cdot t\]
\[\begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.3051966934809397 \cdot 10^{-153}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.7178429536978092 \cdot 10^{-196}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 9.555835303684123 \cdot 10^{+230}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \end{array}\]
\left(x \cdot y - z \cdot y\right) \cdot t
\begin{array}{l}
\mathbf{if}\;x \cdot y - z \cdot y = -\infty:\\
\;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\

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

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

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

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

\end{array}
double f(double x, double y, double z, double t) {
        double r28302476 = x;
        double r28302477 = y;
        double r28302478 = r28302476 * r28302477;
        double r28302479 = z;
        double r28302480 = r28302479 * r28302477;
        double r28302481 = r28302478 - r28302480;
        double r28302482 = t;
        double r28302483 = r28302481 * r28302482;
        return r28302483;
}

double f(double x, double y, double z, double t) {
        double r28302484 = x;
        double r28302485 = y;
        double r28302486 = r28302484 * r28302485;
        double r28302487 = z;
        double r28302488 = r28302487 * r28302485;
        double r28302489 = r28302486 - r28302488;
        double r28302490 = -inf.0;
        bool r28302491 = r28302489 <= r28302490;
        double r28302492 = r28302484 - r28302487;
        double r28302493 = t;
        double r28302494 = r28302485 * r28302493;
        double r28302495 = r28302492 * r28302494;
        double r28302496 = -3.3051966934809397e-153;
        bool r28302497 = r28302489 <= r28302496;
        double r28302498 = r28302493 * r28302489;
        double r28302499 = 1.7178429536978092e-196;
        bool r28302500 = r28302489 <= r28302499;
        double r28302501 = 9.555835303684123e+230;
        bool r28302502 = r28302489 <= r28302501;
        double r28302503 = r28302493 * r28302492;
        double r28302504 = r28302503 * r28302485;
        double r28302505 = r28302502 ? r28302498 : r28302504;
        double r28302506 = r28302500 ? r28302495 : r28302505;
        double r28302507 = r28302497 ? r28302498 : r28302506;
        double r28302508 = r28302491 ? r28302495 : r28302507;
        return r28302508;
}

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.0
Herbie0.5
\[\begin{array}{l} \mathbf{if}\;t \lt -9.231879582886777 \cdot 10^{-80}:\\ \;\;\;\;\left(y \cdot t\right) \cdot \left(x - z\right)\\ \mathbf{elif}\;t \lt 2.543067051564877 \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)) < -inf.0 or -3.3051966934809397e-153 < (- (* x y) (* z y)) < 1.7178429536978092e-196

    1. Initial program 18.6

      \[\left(x \cdot y - z \cdot y\right) \cdot t\]
    2. Simplified1.0

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

    if -inf.0 < (- (* x y) (* z y)) < -3.3051966934809397e-153 or 1.7178429536978092e-196 < (- (* x y) (* z y)) < 9.555835303684123e+230

    1. Initial program 0.3

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

    if 9.555835303684123e+230 < (- (* x y) (* z y))

    1. Initial program 34.0

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

      \[\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)}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification0.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y = -\infty:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.3051966934809397 \cdot 10^{-153}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.7178429536978092 \cdot 10^{-196}:\\ \;\;\;\;\left(x - z\right) \cdot \left(y \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 9.555835303684123 \cdot 10^{+230}:\\ \;\;\;\;t \cdot \left(x \cdot y - z \cdot y\right)\\ \mathbf{else}:\\ \;\;\;\;\left(t \cdot \left(x - z\right)\right) \cdot y\\ \end{array}\]

Reproduce

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