Average Error: 7.2 → 0.8
Time: 11.0s
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.05444158092502344 \cdot 10^{286}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.3060018835558615 \cdot 10^{-175}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.4822 \cdot 10^{-323}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.1817144735460404 \cdot 10^{282}:\\ \;\;\;\;\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 -3.05444158092502344 \cdot 10^{286}:\\
\;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\

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

\mathbf{elif}\;x \cdot y - z \cdot y \le 1.4822 \cdot 10^{-323}:\\
\;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\right)\\

\mathbf{elif}\;x \cdot y - z \cdot y \le 3.1817144735460404 \cdot 10^{282}:\\
\;\;\;\;\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 r594501 = x;
        double r594502 = y;
        double r594503 = r594501 * r594502;
        double r594504 = z;
        double r594505 = r594504 * r594502;
        double r594506 = r594503 - r594505;
        double r594507 = t;
        double r594508 = r594506 * r594507;
        return r594508;
}

double f(double x, double y, double z, double t) {
        double r594509 = x;
        double r594510 = y;
        double r594511 = r594509 * r594510;
        double r594512 = z;
        double r594513 = r594512 * r594510;
        double r594514 = r594511 - r594513;
        double r594515 = -3.0544415809250234e+286;
        bool r594516 = r594514 <= r594515;
        double r594517 = r594509 - r594512;
        double r594518 = t;
        double r594519 = r594517 * r594518;
        double r594520 = r594510 * r594519;
        double r594521 = -3.3060018835558615e-175;
        bool r594522 = r594514 <= r594521;
        double r594523 = r594514 * r594518;
        double r594524 = 1.4821969375237e-323;
        bool r594525 = r594514 <= r594524;
        double r594526 = r594518 * r594510;
        double r594527 = r594526 * r594517;
        double r594528 = expm1(r594527);
        double r594529 = log1p(r594528);
        double r594530 = 3.1817144735460404e+282;
        bool r594531 = r594514 <= r594530;
        double r594532 = r594531 ? r594523 : r594520;
        double r594533 = r594525 ? r594529 : r594532;
        double r594534 = r594522 ? r594523 : r594533;
        double r594535 = r594516 ? r594520 : r594534;
        return r594535;
}

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.2
Target3.1
Herbie0.8
\[\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)) < -3.0544415809250234e+286 or 3.1817144735460404e+282 < (- (* x y) (* z y))

    1. Initial program 53.0

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

      \[\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)}\]

    if -3.0544415809250234e+286 < (- (* x y) (* z y)) < -3.3060018835558615e-175 or 1.4821969375237e-323 < (- (* x y) (* z y)) < 3.1817144735460404e+282

    1. Initial program 0.3

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

    if -3.3060018835558615e-175 < (- (* x y) (* z y)) < 1.4821969375237e-323

    1. Initial program 9.4

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

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

      \[\leadsto \color{blue}{\left(\sqrt[3]{x \cdot y - z \cdot y} \cdot \sqrt[3]{x \cdot y - z \cdot y}\right) \cdot \left(\sqrt[3]{x \cdot y - z \cdot y} \cdot t\right)}\]
    5. Simplified9.8

      \[\leadsto \left(\sqrt[3]{x \cdot y - z \cdot y} \cdot \sqrt[3]{x \cdot y - z \cdot y}\right) \cdot \color{blue}{\left(t \cdot \sqrt[3]{y \cdot \left(x - z\right)}\right)}\]
    6. Using strategy rm
    7. Applied log1p-expm1-u13.7

      \[\leadsto \color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\left(\sqrt[3]{x \cdot y - z \cdot y} \cdot \sqrt[3]{x \cdot y - z \cdot y}\right) \cdot \left(t \cdot \sqrt[3]{y \cdot \left(x - z\right)}\right)\right)\right)}\]
    8. Simplified4.9

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \cdot y - z \cdot y \le -3.05444158092502344 \cdot 10^{286}:\\ \;\;\;\;y \cdot \left(\left(x - z\right) \cdot t\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le -3.3060018835558615 \cdot 10^{-175}:\\ \;\;\;\;\left(x \cdot y - z \cdot y\right) \cdot t\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 1.4822 \cdot 10^{-323}:\\ \;\;\;\;\mathsf{log1p}\left(\mathsf{expm1}\left(\left(t \cdot y\right) \cdot \left(x - z\right)\right)\right)\\ \mathbf{elif}\;x \cdot y - z \cdot y \le 3.1817144735460404 \cdot 10^{282}:\\ \;\;\;\;\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 2020042 +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))