Average Error: 7.7 → 0.3
Time: 8.5s
Precision: 64
\[\frac{m + t}{1 - t \cdot m}\]
\[\begin{array}{l} \mathbf{if}\;\frac{m + t}{1 - t \cdot m} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268}:\\ \;\;\;\;\frac{m + t}{1 - t \cdot m}\\ \mathbf{elif}\;\frac{m + t}{1 - t \cdot m} \le 0.0:\\ \;\;\;\;\left(\frac{-1}{t} + \frac{-1}{m}\right) + \frac{\frac{-1}{m \cdot m}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{m + t}{1 - t \cdot m}\\ \end{array}\]
\frac{m + t}{1 - t \cdot m}
\begin{array}{l}
\mathbf{if}\;\frac{m + t}{1 - t \cdot m} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268}:\\
\;\;\;\;\frac{m + t}{1 - t \cdot m}\\

\mathbf{elif}\;\frac{m + t}{1 - t \cdot m} \le 0.0:\\
\;\;\;\;\left(\frac{-1}{t} + \frac{-1}{m}\right) + \frac{\frac{-1}{m \cdot m}}{t}\\

\mathbf{else}:\\
\;\;\;\;\frac{m + t}{1 - t \cdot m}\\

\end{array}
double f(double m, double t) {
        double r19783570 = m;
        double r19783571 = t;
        double r19783572 = r19783570 + r19783571;
        double r19783573 = 1.0;
        double r19783574 = r19783571 * r19783570;
        double r19783575 = r19783573 - r19783574;
        double r19783576 = r19783572 / r19783575;
        return r19783576;
}

double f(double m, double t) {
        double r19783577 = m;
        double r19783578 = t;
        double r19783579 = r19783577 + r19783578;
        double r19783580 = 1.0;
        double r19783581 = r19783578 * r19783577;
        double r19783582 = r19783580 - r19783581;
        double r19783583 = r19783579 / r19783582;
        double r19783584 = -1.091058094353956e-268;
        bool r19783585 = r19783583 <= r19783584;
        double r19783586 = 0.0;
        bool r19783587 = r19783583 <= r19783586;
        double r19783588 = -1.0;
        double r19783589 = r19783588 / r19783578;
        double r19783590 = r19783588 / r19783577;
        double r19783591 = r19783589 + r19783590;
        double r19783592 = -r19783580;
        double r19783593 = r19783577 * r19783577;
        double r19783594 = r19783592 / r19783593;
        double r19783595 = r19783594 / r19783578;
        double r19783596 = r19783591 + r19783595;
        double r19783597 = r19783587 ? r19783596 : r19783583;
        double r19783598 = r19783585 ? r19783583 : r19783597;
        return r19783598;
}

Error

Bits error versus m

Bits error versus t

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (+ m t) (- 1.0 (* t m))) < -1.091058094353956e-268 or 0.0 < (/ (+ m t) (- 1.0 (* t m)))

    1. Initial program 0.1

      \[\frac{m + t}{1 - t \cdot m}\]

    if -1.091058094353956e-268 < (/ (+ m t) (- 1.0 (* t m))) < 0.0

    1. Initial program 59.3

      \[\frac{m + t}{1 - t \cdot m}\]
    2. Taylor expanded around inf 1.6

      \[\leadsto \color{blue}{-\left(1 \cdot \frac{1}{t \cdot {m}^{2}} + \left(\frac{1}{t} + \frac{1}{m}\right)\right)}\]
    3. Simplified1.6

      \[\leadsto \color{blue}{-\left(\left(\frac{1}{t} + \frac{1}{m}\right) + \frac{\frac{1}{m \cdot m}}{t}\right)}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification0.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{m + t}{1 - t \cdot m} \le -1.091058094353956008944687425051336272544 \cdot 10^{-268}:\\ \;\;\;\;\frac{m + t}{1 - t \cdot m}\\ \mathbf{elif}\;\frac{m + t}{1 - t \cdot m} \le 0.0:\\ \;\;\;\;\left(\frac{-1}{t} + \frac{-1}{m}\right) + \frac{\frac{-1}{m \cdot m}}{t}\\ \mathbf{else}:\\ \;\;\;\;\frac{m + t}{1 - t \cdot m}\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (m t)
  :name "(m+t)/(1-t*m)"
  (/ (+ m t) (- 1.0 (* t m))))