Average Error: 6.1 → 1.4
Time: 24.3s
Precision: 64
\[\left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \left(r \cdot h + R\right)\right)\]
\[\begin{array}{l} \mathbf{if}\;r \le -1.03809386075916 \cdot 10^{+174}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\ \mathbf{elif}\;r \le 1.930819054628316 \cdot 10^{-52}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(\left(r \cdot T\right) \cdot R + h \cdot \left(T + r \cdot \left(r \cdot T\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\ \end{array}\]
\left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \left(r \cdot h + R\right)\right)
\begin{array}{l}
\mathbf{if}\;r \le -1.03809386075916 \cdot 10^{+174}:\\
\;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\

\mathbf{elif}\;r \le 1.930819054628316 \cdot 10^{-52}:\\
\;\;\;\;\left(w \cdot t + S\right) - \left(\left(r \cdot T\right) \cdot R + h \cdot \left(T + r \cdot \left(r \cdot T\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\

\end{array}
double f(double w, double t, double S, double T, double h, double r, double R) {
        double r19905030 = w;
        double r19905031 = t;
        double r19905032 = r19905030 * r19905031;
        double r19905033 = S;
        double r19905034 = r19905032 + r19905033;
        double r19905035 = T;
        double r19905036 = h;
        double r19905037 = r;
        double r19905038 = r19905037 * r19905036;
        double r19905039 = R;
        double r19905040 = r19905038 + r19905039;
        double r19905041 = r19905037 * r19905040;
        double r19905042 = r19905036 + r19905041;
        double r19905043 = r19905035 * r19905042;
        double r19905044 = r19905034 - r19905043;
        return r19905044;
}

double f(double w, double t, double S, double T, double h, double r, double R) {
        double r19905045 = r;
        double r19905046 = -1.03809386075916e+174;
        bool r19905047 = r19905045 <= r19905046;
        double r19905048 = w;
        double r19905049 = t;
        double r19905050 = r19905048 * r19905049;
        double r19905051 = S;
        double r19905052 = r19905050 + r19905051;
        double r19905053 = R;
        double r19905054 = h;
        double r19905055 = r19905045 * r19905054;
        double r19905056 = r19905053 + r19905055;
        double r19905057 = T;
        double r19905058 = r19905056 * r19905057;
        double r19905059 = r19905045 * r19905058;
        double r19905060 = r19905057 * r19905054;
        double r19905061 = r19905059 + r19905060;
        double r19905062 = r19905052 - r19905061;
        double r19905063 = 1.930819054628316e-52;
        bool r19905064 = r19905045 <= r19905063;
        double r19905065 = r19905045 * r19905057;
        double r19905066 = r19905065 * r19905053;
        double r19905067 = r19905045 * r19905065;
        double r19905068 = r19905057 + r19905067;
        double r19905069 = r19905054 * r19905068;
        double r19905070 = r19905066 + r19905069;
        double r19905071 = r19905052 - r19905070;
        double r19905072 = r19905064 ? r19905071 : r19905062;
        double r19905073 = r19905047 ? r19905062 : r19905072;
        return r19905073;
}

Error

Bits error versus w

Bits error versus t

Bits error versus S

Bits error versus T

Bits error versus h

Bits error versus r

Bits error versus R

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if r < -1.03809386075916e+174 or 1.930819054628316e-52 < r

    1. Initial program 17.0

      \[\left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \left(r \cdot h + R\right)\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt17.3

      \[\leadsto \left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \color{blue}{\left(\left(\sqrt[3]{r \cdot h + R} \cdot \sqrt[3]{r \cdot h + R}\right) \cdot \sqrt[3]{r \cdot h + R}\right)}\right)\]
    4. Using strategy rm
    5. Applied distribute-rgt-in17.3

      \[\leadsto \left(w \cdot t + S\right) - \color{blue}{\left(h \cdot T + \left(r \cdot \left(\left(\sqrt[3]{r \cdot h + R} \cdot \sqrt[3]{r \cdot h + R}\right) \cdot \sqrt[3]{r \cdot h + R}\right)\right) \cdot T\right)}\]
    6. Simplified2.6

      \[\leadsto \left(w \cdot t + S\right) - \left(h \cdot T + \color{blue}{r \cdot \left(T \cdot \left(r \cdot h + R\right)\right)}\right)\]

    if -1.03809386075916e+174 < r < 1.930819054628316e-52

    1. Initial program 2.3

      \[\left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \left(r \cdot h + R\right)\right)\]
    2. Using strategy rm
    3. Applied add-cube-cbrt2.4

      \[\leadsto \left(w \cdot t + S\right) - T \cdot \left(h + r \cdot \color{blue}{\left(\left(\sqrt[3]{r \cdot h + R} \cdot \sqrt[3]{r \cdot h + R}\right) \cdot \sqrt[3]{r \cdot h + R}\right)}\right)\]
    4. Taylor expanded around -inf 4.6

      \[\leadsto \left(w \cdot t + S\right) - \color{blue}{\left({r}^{2} \cdot \left(T \cdot h\right) + \left(T \cdot h + r \cdot \left(T \cdot R\right)\right)\right)}\]
    5. Simplified1.0

      \[\leadsto \left(w \cdot t + S\right) - \color{blue}{\left(h \cdot \left(\left(T \cdot r\right) \cdot r + T\right) + \left(T \cdot r\right) \cdot R\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification1.4

    \[\leadsto \begin{array}{l} \mathbf{if}\;r \le -1.03809386075916 \cdot 10^{+174}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\ \mathbf{elif}\;r \le 1.930819054628316 \cdot 10^{-52}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(\left(r \cdot T\right) \cdot R + h \cdot \left(T + r \cdot \left(r \cdot T\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\left(w \cdot t + S\right) - \left(r \cdot \left(\left(R + r \cdot h\right) \cdot T\right) + T \cdot h\right)\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (w t S T h r R)
  :name "(w * t + S - T * ( h + r * ( r * h + R) ) ) "
  (- (+ (* w t) S) (* T (+ h (* r (+ (* r h) R))))))