
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
double code(double x, double y) {
return pow(x, 4.0) - pow(y, 4.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x ** 4.0d0) - (y ** 4.0d0)
end function
public static double code(double x, double y) {
return Math.pow(x, 4.0) - Math.pow(y, 4.0);
}
def code(x, y): return math.pow(x, 4.0) - math.pow(y, 4.0)
function code(x, y) return Float64((x ^ 4.0) - (y ^ 4.0)) end
function tmp = code(x, y) tmp = (x ^ 4.0) - (y ^ 4.0); end
code[x_, y_] := N[(N[Power[x, 4.0], $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{4} - {y}^{4}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (- (pow x 4.0) (pow y 4.0)))
double code(double x, double y) {
return pow(x, 4.0) - pow(y, 4.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = (x ** 4.0d0) - (y ** 4.0d0)
end function
public static double code(double x, double y) {
return Math.pow(x, 4.0) - Math.pow(y, 4.0);
}
def code(x, y): return math.pow(x, 4.0) - math.pow(y, 4.0)
function code(x, y) return Float64((x ^ 4.0) - (y ^ 4.0)) end
function tmp = code(x, y) tmp = (x ^ 4.0) - (y ^ 4.0); end
code[x_, y_] := N[(N[Power[x, 4.0], $MachinePrecision] - N[Power[y, 4.0], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{x}^{4} - {y}^{4}
\end{array}
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
(if (<= x -1.75e+78)
t_0
(if (<= x 5e+63) (- (* x (* x (* x x))) (* y (* y (* y y)))) t_0))))
double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -1.75e+78) {
tmp = t_0;
} else if (x <= 5e+63) {
tmp = (x * (x * (x * x))) - (y * (y * (y * y)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
if (x <= (-1.75d+78)) then
tmp = t_0
else if (x <= 5d+63) then
tmp = (x * (x * (x * x))) - (y * (y * (y * y)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -1.75e+78) {
tmp = t_0;
} else if (x <= 5e+63) {
tmp = (x * (x * (x * x))) - (y * (y * (y * y)));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)) tmp = 0 if x <= -1.75e+78: tmp = t_0 elif x <= 5e+63: tmp = (x * (x * (x * x))) - (y * (y * (y * y))) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y))) tmp = 0.0 if (x <= -1.75e+78) tmp = t_0; elseif (x <= 5e+63) tmp = Float64(Float64(x * Float64(x * Float64(x * x))) - Float64(y * Float64(y * Float64(y * y)))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)); tmp = 0.0; if (x <= -1.75e+78) tmp = t_0; elseif (x <= 5e+63) tmp = (x * (x * (x * x))) - (y * (y * (y * y))); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.75e+78], t$95$0, If[LessEqual[x, 5e+63], N[(N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(y * N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -1.75 \cdot 10^{+78}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5 \cdot 10^{+63}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right) - y \cdot \left(y \cdot \left(y \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -1.7500000000000001e78 or 5.00000000000000011e63 < x Initial program 70.7%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6482.5%
Applied egg-rr82.5%
flip3--N/A
clear-numN/A
/-lowering-/.f64N/A
cube-unmultN/A
swap-sqrN/A
cube-unmultN/A
swap-sqrN/A
clear-numN/A
Applied egg-rr82.5%
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f64100.0%
Simplified100.0%
if -1.7500000000000001e78 < x < 5.00000000000000011e63Initial program 100.0%
--lowering--.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-unmultN/A
*-lowering-*.f64N/A
cube-unmultN/A
unpow2N/A
metadata-evalN/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
sqr-powN/A
metadata-evalN/A
unpow2N/A
associate-*l*N/A
metadata-evalN/A
unpow2N/A
cube-unmultN/A
*-lowering-*.f64N/A
cube-unmultN/A
unpow2N/A
metadata-evalN/A
Applied egg-rr99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
(if (<= x -1e+158)
t_0
(if (<= x 5.6e+63) (* (- (* x x) (* y y)) (+ (* x x) (* y y))) t_0))))
double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -1e+158) {
tmp = t_0;
} else if (x <= 5.6e+63) {
tmp = ((x * x) - (y * y)) * ((x * x) + (y * y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
if (x <= (-1d+158)) then
tmp = t_0
else if (x <= 5.6d+63) then
tmp = ((x * x) - (y * y)) * ((x * x) + (y * y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -1e+158) {
tmp = t_0;
} else if (x <= 5.6e+63) {
tmp = ((x * x) - (y * y)) * ((x * x) + (y * y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)) tmp = 0 if x <= -1e+158: tmp = t_0 elif x <= 5.6e+63: tmp = ((x * x) - (y * y)) * ((x * x) + (y * y)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y))) tmp = 0.0 if (x <= -1e+158) tmp = t_0; elseif (x <= 5.6e+63) tmp = Float64(Float64(Float64(x * x) - Float64(y * y)) * Float64(Float64(x * x) + Float64(y * y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)); tmp = 0.0; if (x <= -1e+158) tmp = t_0; elseif (x <= 5.6e+63) tmp = ((x * x) - (y * y)) * ((x * x) + (y * y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+158], t$95$0, If[LessEqual[x, 5.6e+63], N[(N[(N[(x * x), $MachinePrecision] - N[(y * y), $MachinePrecision]), $MachinePrecision] * N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -1 \cdot 10^{+158}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 5.6 \cdot 10^{+63}:\\
\;\;\;\;\left(x \cdot x - y \cdot y\right) \cdot \left(x \cdot x + y \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -9.99999999999999953e157 or 5.59999999999999974e63 < x Initial program 69.2%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6479.4%
Applied egg-rr79.4%
flip3--N/A
clear-numN/A
/-lowering-/.f64N/A
cube-unmultN/A
swap-sqrN/A
cube-unmultN/A
swap-sqrN/A
clear-numN/A
Applied egg-rr79.4%
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f64100.0%
Applied egg-rr100.0%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f64100.0%
Simplified100.0%
if -9.99999999999999953e157 < x < 5.59999999999999974e63Initial program 98.3%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
Final simplification99.8%
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* x x) (/ (/ 1.0 (+ x y)) (- x y)))))
(if (<= x -6.4e-15)
t_0
(if (<= x 9.5e-66) (* y (* (* y y) (- 0.0 y))) t_0))))
double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -6.4e-15) {
tmp = t_0;
} else if (x <= 9.5e-66) {
tmp = y * ((y * y) * (0.0 - y));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = (x * x) / ((1.0d0 / (x + y)) / (x - y))
if (x <= (-6.4d-15)) then
tmp = t_0
else if (x <= 9.5d-66) then
tmp = y * ((y * y) * (0.0d0 - y))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (x * x) / ((1.0 / (x + y)) / (x - y));
double tmp;
if (x <= -6.4e-15) {
tmp = t_0;
} else if (x <= 9.5e-66) {
tmp = y * ((y * y) * (0.0 - y));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)) tmp = 0 if x <= -6.4e-15: tmp = t_0 elif x <= 9.5e-66: tmp = y * ((y * y) * (0.0 - y)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(Float64(x * x) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y))) tmp = 0.0 if (x <= -6.4e-15) tmp = t_0; elseif (x <= 9.5e-66) tmp = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = (x * x) / ((1.0 / (x + y)) / (x - y)); tmp = 0.0; if (x <= -6.4e-15) tmp = t_0; elseif (x <= 9.5e-66) tmp = y * ((y * y) * (0.0 - y)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(x * x), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -6.4e-15], t$95$0, If[LessEqual[x, 9.5e-66], N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \frac{x \cdot x}{\frac{\frac{1}{x + y}}{x - y}}\\
\mathbf{if}\;x \leq -6.4 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{-66}:\\
\;\;\;\;y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if x < -6.3999999999999999e-15 or 9.5000000000000004e-66 < x Initial program 81.6%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6488.9%
Applied egg-rr88.9%
flip3--N/A
clear-numN/A
/-lowering-/.f64N/A
cube-unmultN/A
swap-sqrN/A
cube-unmultN/A
swap-sqrN/A
clear-numN/A
Applied egg-rr88.9%
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f6499.9%
Applied egg-rr99.9%
Taylor expanded in x around inf
unpow2N/A
*-lowering-*.f6495.5%
Simplified95.5%
if -6.3999999999999999e-15 < x < 9.5000000000000004e-66Initial program 100.0%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
pow-lowering-pow.f6498.9%
Simplified98.9%
sub0-negN/A
neg-lowering-neg.f64N/A
metadata-evalN/A
pow-plusN/A
cube-unmultN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6498.9%
Applied egg-rr98.9%
Final simplification96.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* y (* (* y y) (- 0.0 y)))))
(if (<= y -4e-18)
t_0
(if (<= y 1.36e+19) (/ (* x x) (/ 1.0 (* x x))) t_0))))
double code(double x, double y) {
double t_0 = y * ((y * y) * (0.0 - y));
double tmp;
if (y <= -4e-18) {
tmp = t_0;
} else if (y <= 1.36e+19) {
tmp = (x * x) / (1.0 / (x * x));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y * ((y * y) * (0.0d0 - y))
if (y <= (-4d-18)) then
tmp = t_0
else if (y <= 1.36d+19) then
tmp = (x * x) / (1.0d0 / (x * x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * ((y * y) * (0.0 - y));
double tmp;
if (y <= -4e-18) {
tmp = t_0;
} else if (y <= 1.36e+19) {
tmp = (x * x) / (1.0 / (x * x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y * ((y * y) * (0.0 - y)) tmp = 0 if y <= -4e-18: tmp = t_0 elif y <= 1.36e+19: tmp = (x * x) / (1.0 / (x * x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y))) tmp = 0.0 if (y <= -4e-18) tmp = t_0; elseif (y <= 1.36e+19) tmp = Float64(Float64(x * x) / Float64(1.0 / Float64(x * x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y * ((y * y) * (0.0 - y)); tmp = 0.0; if (y <= -4e-18) tmp = t_0; elseif (y <= 1.36e+19) tmp = (x * x) / (1.0 / (x * x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -4e-18], t$95$0, If[LessEqual[y, 1.36e+19], N[(N[(x * x), $MachinePrecision] / N[(1.0 / N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\
\mathbf{if}\;y \leq -4 \cdot 10^{-18}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 1.36 \cdot 10^{+19}:\\
\;\;\;\;\frac{x \cdot x}{\frac{1}{x \cdot x}}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -4.0000000000000003e-18 or 1.36e19 < y Initial program 78.9%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
pow-lowering-pow.f6482.8%
Simplified82.8%
sub0-negN/A
neg-lowering-neg.f64N/A
metadata-evalN/A
pow-plusN/A
cube-unmultN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6482.7%
Applied egg-rr82.7%
if -4.0000000000000003e-18 < y < 1.36e19Initial program 100.0%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6493.1%
Simplified93.1%
associate-*r*N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6493.1%
Applied egg-rr93.1%
remove-double-divN/A
un-div-invN/A
/-lowering-/.f64N/A
*-lowering-*.f64N/A
/-lowering-/.f64N/A
*-lowering-*.f6493.1%
Applied egg-rr93.1%
Final simplification87.9%
(FPCore (x y) :precision binary64 (let* ((t_0 (* y (* (* y y) (- 0.0 y))))) (if (<= y -8.8e-16) t_0 (if (<= y 5.6e+19) (* x (* x (* x x))) t_0))))
double code(double x, double y) {
double t_0 = y * ((y * y) * (0.0 - y));
double tmp;
if (y <= -8.8e-16) {
tmp = t_0;
} else if (y <= 5.6e+19) {
tmp = x * (x * (x * x));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: t_0
real(8) :: tmp
t_0 = y * ((y * y) * (0.0d0 - y))
if (y <= (-8.8d-16)) then
tmp = t_0
else if (y <= 5.6d+19) then
tmp = x * (x * (x * x))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = y * ((y * y) * (0.0 - y));
double tmp;
if (y <= -8.8e-16) {
tmp = t_0;
} else if (y <= 5.6e+19) {
tmp = x * (x * (x * x));
} else {
tmp = t_0;
}
return tmp;
}
def code(x, y): t_0 = y * ((y * y) * (0.0 - y)) tmp = 0 if y <= -8.8e-16: tmp = t_0 elif y <= 5.6e+19: tmp = x * (x * (x * x)) else: tmp = t_0 return tmp
function code(x, y) t_0 = Float64(y * Float64(Float64(y * y) * Float64(0.0 - y))) tmp = 0.0 if (y <= -8.8e-16) tmp = t_0; elseif (y <= 5.6e+19) tmp = Float64(x * Float64(x * Float64(x * x))); else tmp = t_0; end return tmp end
function tmp_2 = code(x, y) t_0 = y * ((y * y) * (0.0 - y)); tmp = 0.0; if (y <= -8.8e-16) tmp = t_0; elseif (y <= 5.6e+19) tmp = x * (x * (x * x)); else tmp = t_0; end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(y * N[(N[(y * y), $MachinePrecision] * N[(0.0 - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -8.8e-16], t$95$0, If[LessEqual[y, 5.6e+19], N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := y \cdot \left(\left(y \cdot y\right) \cdot \left(0 - y\right)\right)\\
\mathbf{if}\;y \leq -8.8 \cdot 10^{-16}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+19}:\\
\;\;\;\;x \cdot \left(x \cdot \left(x \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if y < -8.80000000000000001e-16 or 5.6e19 < y Initial program 78.9%
Taylor expanded in x around 0
mul-1-negN/A
neg-sub0N/A
--lowering--.f64N/A
pow-lowering-pow.f6482.8%
Simplified82.8%
sub0-negN/A
neg-lowering-neg.f64N/A
metadata-evalN/A
pow-plusN/A
cube-unmultN/A
*-commutativeN/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f6482.7%
Applied egg-rr82.7%
if -8.80000000000000001e-16 < y < 5.6e19Initial program 100.0%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6499.7%
Applied egg-rr99.7%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6493.1%
Simplified93.1%
Final simplification87.9%
(FPCore (x y) :precision binary64 (/ (+ (* x x) (* y y)) (/ (/ 1.0 (+ x y)) (- x y))))
double code(double x, double y) {
return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = ((x * x) + (y * y)) / ((1.0d0 / (x + y)) / (x - y))
end function
public static double code(double x, double y) {
return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y));
}
def code(x, y): return ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y))
function code(x, y) return Float64(Float64(Float64(x * x) + Float64(y * y)) / Float64(Float64(1.0 / Float64(x + y)) / Float64(x - y))) end
function tmp = code(x, y) tmp = ((x * x) + (y * y)) / ((1.0 / (x + y)) / (x - y)); end
code[x_, y_] := N[(N[(N[(x * x), $MachinePrecision] + N[(y * y), $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x - y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{x \cdot x + y \cdot y}{\frac{\frac{1}{x + y}}{x - y}}
\end{array}
Initial program 89.5%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6493.5%
Applied egg-rr93.5%
flip3--N/A
clear-numN/A
/-lowering-/.f64N/A
cube-unmultN/A
swap-sqrN/A
cube-unmultN/A
swap-sqrN/A
clear-numN/A
Applied egg-rr93.5%
associate-*l/N/A
*-lft-identityN/A
/-lowering-/.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
*-lowering-*.f64N/A
*-lowering-*.f64N/A
difference-of-squaresN/A
associate-/r*N/A
/-lowering-/.f64N/A
/-lowering-/.f64N/A
+-lowering-+.f64N/A
--lowering--.f6499.8%
Applied egg-rr99.8%
(FPCore (x y) :precision binary64 (* x (* x (* x x))))
double code(double x, double y) {
return x * (x * (x * x));
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * (x * (x * x))
end function
public static double code(double x, double y) {
return x * (x * (x * x));
}
def code(x, y): return x * (x * (x * x))
function code(x, y) return Float64(x * Float64(x * Float64(x * x))) end
function tmp = code(x, y) tmp = x * (x * (x * x)); end
code[x_, y_] := N[(x * N[(x * N[(x * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x \cdot \left(x \cdot \left(x \cdot x\right)\right)
\end{array}
Initial program 89.5%
sqr-powN/A
sqr-powN/A
difference-of-squaresN/A
*-commutativeN/A
*-lowering-*.f64N/A
--lowering--.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
+-commutativeN/A
+-lowering-+.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f64N/A
metadata-evalN/A
unpow2N/A
*-lowering-*.f6493.5%
Applied egg-rr93.5%
Taylor expanded in x around inf
metadata-evalN/A
pow-sqrN/A
unpow2N/A
associate-*r*N/A
unpow2N/A
cube-multN/A
*-lowering-*.f64N/A
cube-multN/A
unpow2N/A
*-lowering-*.f64N/A
unpow2N/A
*-lowering-*.f6455.7%
Simplified55.7%
herbie shell --seed 2024192
(FPCore (x y)
:name "Radioactive exchange between two surfaces"
:precision binary64
(- (pow x 4.0) (pow y 4.0)))