Average Error: 9.3 → 4.7
Time: 1.3s
Precision: binary64
\[{x}^{4} - {y}^{4} \]
\[\begin{array}{l} \mathbf{if}\;{y}^{4} \leq 1.7821335287406645 \cdot 10^{+308}:\\ \;\;\;\;{x}^{4} - {y}^{4}\\ \mathbf{else}:\\ \;\;\;\;-{y}^{4}\\ \end{array} \]
{x}^{4} - {y}^{4}
\begin{array}{l}
\mathbf{if}\;{y}^{4} \leq 1.7821335287406645 \cdot 10^{+308}:\\
\;\;\;\;{x}^{4} - {y}^{4}\\

\mathbf{else}:\\
\;\;\;\;-{y}^{4}\\


\end{array}
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
(FPCore (x y)
 :precision binary64
 (if (<= (pow y 4.0) 1.7821335287406645e+308)
   (- (pow x 4.0) (pow y 4.0))
   (- (pow y 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(y, 4.0) <= 1.7821335287406645e+308) {
		tmp = pow(x, 4.0) - pow(y, 4.0);
	} else {
		tmp = -pow(y, 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 y 4) < 1.78213352874066454e308

    1. Initial program 0.0

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

    if 1.78213352874066454e308 < (pow.f64 y 4)

    1. Initial program 24.5

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

      \[\leadsto \color{blue}{-1 \cdot {y}^{4}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification4.7

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

Reproduce

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