Average Error: 25.3 → 0.0
Time: 8.6s
Precision: 64
\[{\left(1 - x\right)}^{2} - {x}^{2}\]
\[\begin{array}{l} \mathbf{if}\;x \le 1.452860352660339650685842611672799222175 \cdot 10^{48}:\\ \;\;\;\;1 - x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} - {x}^{\left(\frac{2}{2}\right)}\right) \cdot \left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} + {x}^{\left(\frac{2}{2}\right)}\right)\\ \end{array}\]
{\left(1 - x\right)}^{2} - {x}^{2}
\begin{array}{l}
\mathbf{if}\;x \le 1.452860352660339650685842611672799222175 \cdot 10^{48}:\\
\;\;\;\;1 - x \cdot 2\\

\mathbf{else}:\\
\;\;\;\;\left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} - {x}^{\left(\frac{2}{2}\right)}\right) \cdot \left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} + {x}^{\left(\frac{2}{2}\right)}\right)\\

\end{array}
double f(double x) {
        double r26884050 = 1.0;
        double r26884051 = x;
        double r26884052 = r26884050 - r26884051;
        double r26884053 = 2.0;
        double r26884054 = pow(r26884052, r26884053);
        double r26884055 = pow(r26884051, r26884053);
        double r26884056 = r26884054 - r26884055;
        return r26884056;
}

double f(double x) {
        double r26884057 = x;
        double r26884058 = 1.4528603526603397e+48;
        bool r26884059 = r26884057 <= r26884058;
        double r26884060 = 1.0;
        double r26884061 = 2.0;
        double r26884062 = r26884057 * r26884061;
        double r26884063 = r26884060 - r26884062;
        double r26884064 = r26884060 - r26884057;
        double r26884065 = 2.0;
        double r26884066 = r26884061 / r26884065;
        double r26884067 = pow(r26884064, r26884066);
        double r26884068 = pow(r26884057, r26884066);
        double r26884069 = r26884067 - r26884068;
        double r26884070 = r26884067 + r26884068;
        double r26884071 = r26884069 * r26884070;
        double r26884072 = r26884059 ? r26884063 : r26884071;
        return r26884072;
}

Error

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if x < 1.4528603526603397e+48

    1. Initial program 22.0

      \[{\left(1 - x\right)}^{2} - {x}^{2}\]
    2. Taylor expanded around 0 0

      \[\leadsto \color{blue}{1 - 2 \cdot x}\]

    if 1.4528603526603397e+48 < x

    1. Initial program 37.6

      \[{\left(1 - x\right)}^{2} - {x}^{2}\]
    2. Using strategy rm
    3. Applied sqr-pow37.6

      \[\leadsto {\left(1 - x\right)}^{2} - \color{blue}{{x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}}\]
    4. Applied sqr-pow37.6

      \[\leadsto \color{blue}{{\left(1 - x\right)}^{\left(\frac{2}{2}\right)} \cdot {\left(1 - x\right)}^{\left(\frac{2}{2}\right)}} - {x}^{\left(\frac{2}{2}\right)} \cdot {x}^{\left(\frac{2}{2}\right)}\]
    5. Applied difference-of-squares0.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;x \le 1.452860352660339650685842611672799222175 \cdot 10^{48}:\\ \;\;\;\;1 - x \cdot 2\\ \mathbf{else}:\\ \;\;\;\;\left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} - {x}^{\left(\frac{2}{2}\right)}\right) \cdot \left({\left(1 - x\right)}^{\left(\frac{2}{2}\right)} + {x}^{\left(\frac{2}{2}\right)}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (x)
  :name "(1-x)^2 - x^2"
  (- (pow (- 1.0 x) 2.0) (pow x 2.0)))