Average Error: 17.5 → 0.9
Time: 17.1s
Precision: 64
\[\left(\left(y - 1\right) \cdot y\right) \cdot {x}^{\left(y - 2\right)}\]
\[\begin{array}{l} \mathbf{if}\;y \le -2.76537328933368 \cdot 10^{-142}:\\ \;\;\;\;\left(\left(y - 1\right) \cdot \left({x}^{\left(\frac{y + -2}{2}\right)} \cdot {x}^{\left(\frac{y + -2}{2}\right)}\right)\right) \cdot y\\ \mathbf{elif}\;y \le 7.78563079656421 \cdot 10^{-72}:\\ \;\;\;\;\left({x}^{\left(\frac{y + -2}{2}\right)} \cdot \left(y \cdot y - y\right)\right) \cdot {x}^{\left(\frac{y + -2}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - 1\right) \cdot {x}^{\left(y + -2\right)}\right) \cdot y\\ \end{array}\]
\left(\left(y - 1\right) \cdot y\right) \cdot {x}^{\left(y - 2\right)}
\begin{array}{l}
\mathbf{if}\;y \le -2.76537328933368 \cdot 10^{-142}:\\
\;\;\;\;\left(\left(y - 1\right) \cdot \left({x}^{\left(\frac{y + -2}{2}\right)} \cdot {x}^{\left(\frac{y + -2}{2}\right)}\right)\right) \cdot y\\

\mathbf{elif}\;y \le 7.78563079656421 \cdot 10^{-72}:\\
\;\;\;\;\left({x}^{\left(\frac{y + -2}{2}\right)} \cdot \left(y \cdot y - y\right)\right) \cdot {x}^{\left(\frac{y + -2}{2}\right)}\\

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

\end{array}
double f(double y, double x) {
        double r19114514 = y;
        double r19114515 = 1.0;
        double r19114516 = r19114514 - r19114515;
        double r19114517 = r19114516 * r19114514;
        double r19114518 = x;
        double r19114519 = 2.0;
        double r19114520 = r19114514 - r19114519;
        double r19114521 = pow(r19114518, r19114520);
        double r19114522 = r19114517 * r19114521;
        return r19114522;
}

double f(double y, double x) {
        double r19114523 = y;
        double r19114524 = -2.76537328933368e-142;
        bool r19114525 = r19114523 <= r19114524;
        double r19114526 = 1.0;
        double r19114527 = r19114523 - r19114526;
        double r19114528 = x;
        double r19114529 = -2.0;
        double r19114530 = r19114523 + r19114529;
        double r19114531 = 2.0;
        double r19114532 = r19114530 / r19114531;
        double r19114533 = pow(r19114528, r19114532);
        double r19114534 = r19114533 * r19114533;
        double r19114535 = r19114527 * r19114534;
        double r19114536 = r19114535 * r19114523;
        double r19114537 = 7.78563079656421e-72;
        bool r19114538 = r19114523 <= r19114537;
        double r19114539 = r19114523 * r19114523;
        double r19114540 = r19114539 - r19114523;
        double r19114541 = r19114533 * r19114540;
        double r19114542 = r19114541 * r19114533;
        double r19114543 = pow(r19114528, r19114530);
        double r19114544 = r19114527 * r19114543;
        double r19114545 = r19114544 * r19114523;
        double r19114546 = r19114538 ? r19114542 : r19114545;
        double r19114547 = r19114525 ? r19114536 : r19114546;
        return r19114547;
}

Error

Bits error versus y

Bits error versus x

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if y < -2.76537328933368e-142

    1. Initial program 21.3

      \[\left(\left(y - 1\right) \cdot y\right) \cdot {x}^{\left(y - 2\right)}\]
    2. Simplified21.3

      \[\leadsto \color{blue}{\left(y \cdot y - y\right) \cdot {x}^{\left(-2 + y\right)}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity21.3

      \[\leadsto \left(y \cdot y - \color{blue}{1 \cdot y}\right) \cdot {x}^{\left(-2 + y\right)}\]
    5. Applied distribute-rgt-out--21.3

      \[\leadsto \color{blue}{\left(y \cdot \left(y - 1\right)\right)} \cdot {x}^{\left(-2 + y\right)}\]
    6. Applied associate-*l*1.9

      \[\leadsto \color{blue}{y \cdot \left(\left(y - 1\right) \cdot {x}^{\left(-2 + y\right)}\right)}\]
    7. Using strategy rm
    8. Applied sqr-pow2.0

      \[\leadsto y \cdot \left(\left(y - 1\right) \cdot \color{blue}{\left({x}^{\left(\frac{-2 + y}{2}\right)} \cdot {x}^{\left(\frac{-2 + y}{2}\right)}\right)}\right)\]

    if -2.76537328933368e-142 < y < 7.78563079656421e-72

    1. Initial program 11.0

      \[\left(\left(y - 1\right) \cdot y\right) \cdot {x}^{\left(y - 2\right)}\]
    2. Simplified11.0

      \[\leadsto \color{blue}{\left(y \cdot y - y\right) \cdot {x}^{\left(-2 + y\right)}}\]
    3. Using strategy rm
    4. Applied sqr-pow11.1

      \[\leadsto \left(y \cdot y - y\right) \cdot \color{blue}{\left({x}^{\left(\frac{-2 + y}{2}\right)} \cdot {x}^{\left(\frac{-2 + y}{2}\right)}\right)}\]
    5. Applied associate-*r*0.3

      \[\leadsto \color{blue}{\left(\left(y \cdot y - y\right) \cdot {x}^{\left(\frac{-2 + y}{2}\right)}\right) \cdot {x}^{\left(\frac{-2 + y}{2}\right)}}\]

    if 7.78563079656421e-72 < y

    1. Initial program 24.8

      \[\left(\left(y - 1\right) \cdot y\right) \cdot {x}^{\left(y - 2\right)}\]
    2. Simplified24.8

      \[\leadsto \color{blue}{\left(y \cdot y - y\right) \cdot {x}^{\left(-2 + y\right)}}\]
    3. Using strategy rm
    4. Applied *-un-lft-identity24.8

      \[\leadsto \left(y \cdot y - \color{blue}{1 \cdot y}\right) \cdot {x}^{\left(-2 + y\right)}\]
    5. Applied distribute-rgt-out--24.8

      \[\leadsto \color{blue}{\left(y \cdot \left(y - 1\right)\right)} \cdot {x}^{\left(-2 + y\right)}\]
    6. Applied associate-*l*0.4

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;y \le -2.76537328933368 \cdot 10^{-142}:\\ \;\;\;\;\left(\left(y - 1\right) \cdot \left({x}^{\left(\frac{y + -2}{2}\right)} \cdot {x}^{\left(\frac{y + -2}{2}\right)}\right)\right) \cdot y\\ \mathbf{elif}\;y \le 7.78563079656421 \cdot 10^{-72}:\\ \;\;\;\;\left({x}^{\left(\frac{y + -2}{2}\right)} \cdot \left(y \cdot y - y\right)\right) \cdot {x}^{\left(\frac{y + -2}{2}\right)}\\ \mathbf{else}:\\ \;\;\;\;\left(\left(y - 1\right) \cdot {x}^{\left(y + -2\right)}\right) \cdot y\\ \end{array}\]

Reproduce

herbie shell --seed 1 
(FPCore (y x)
  :name "(y-1)*y*(x^(y-2))"
  (* (* (- y 1) y) (pow x (- y 2))))