Average Error: 8.9 → 4.9
Time: 2.0s
Precision: binary64
\[{x}^{4} - {y}^{4} \]
\[\begin{array}{l} \mathbf{if}\;{x}^{4} \leq 6.758237001948033 \cdot 10^{+258}:\\ \;\;\;\;{x}^{4} - {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;{x}^{4}\\ \end{array} \]
{x}^{4} - {y}^{4}
\begin{array}{l}
\mathbf{if}\;{x}^{4} \leq 6.758237001948033 \cdot 10^{+258}:\\
\;\;\;\;{x}^{4} - {y}^{4}\\

\mathbf{else}:\\
\;\;\;\;{x}^{4}\\


\end{array}
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
(FPCore (x y)
 :precision binary64
 (if (<= (pow x 4.0) 6.758237001948033e+258)
   (- (pow x 4.0) (pow y 4.0))
   (pow x 4.0)))
double code(double x, double y) {
	return pow(x, 4.0) - pow(y, 4.0);
}
double code(double x, double y) {
	double tmp;
	if (pow(x, 4.0) <= 6.758237001948033e+258) {
		tmp = pow(x, 4.0) - pow(y, 4.0);
	} else {
		tmp = pow(x, 4.0);
	}
	return tmp;
}

Error

Bits error versus x

Bits error versus y

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (pow.f64 x 4) < 6.75823700194803328e258

    1. Initial program 0.0

      \[{x}^{4} - {y}^{4} \]

    if 6.75823700194803328e258 < (pow.f64 x 4)

    1. Initial program 22.7

      \[{x}^{4} - {y}^{4} \]
    2. Taylor expanded in x around inf 12.5

      \[\leadsto \color{blue}{{x}^{4}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;{x}^{4} \leq 6.758237001948033 \cdot 10^{+258}:\\ \;\;\;\;{x}^{4} - {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;{x}^{4}\\ \end{array} \]

Reproduce

herbie shell --seed 2022068 
(FPCore (x y)
  :name "Radioactive exchange between two surfaces"
  :precision binary64
  (- (pow x 4.0) (pow y 4.0)))