Average Error: 7.2 → 0.8
Time: 10.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.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 r192061 = x;
        double r192062 = y;
        double r192063 = r192061 * r192062;
        double r192064 = z;
        double r192065 = r192064 * r192062;
        double r192066 = r192063 - r192065;
        double r192067 = t;
        double r192068 = r192066 * r192067;
        return r192068;
}

double f(double x, double y, double z, double t) {
        double r192069 = x;
        double r192070 = y;
        double r192071 = r192069 * r192070;
        double r192072 = z;
        double r192073 = r192072 * r192070;
        double r192074 = r192071 - r192073;
        double r192075 = -3.0544415809250234e+286;
        bool r192076 = r192074 <= r192075;
        double r192077 = r192069 - r192072;
        double r192078 = t;
        double r192079 = r192077 * r192078;
        double r192080 = r192070 * r192079;
        double r192081 = -3.3060018835558615e-175;
        bool r192082 = r192074 <= r192081;
        double r192083 = r192074 * r192078;
        double r192084 = 1.4821969375237e-323;
        bool r192085 = r192074 <= r192084;
        double r192086 = r192078 * r192070;
        double r192087 = r192086 * r192077;
        double r192088 = expm1(r192087);
        double r192089 = log1p(r192088);
        double r192090 = 3.1817144735460404e+282;
        bool r192091 = r192074 <= r192090;
        double r192092 = r192091 ? r192083 : r192080;
        double r192093 = r192085 ? r192089 : r192092;
        double r192094 = r192082 ? r192083 : r192093;
        double r192095 = r192076 ? r192080 : r192094;
        return r192095;
}

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