
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- y x)) 2.0)))
double code(double x, double y) {
return x + (fabs((y - x)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((y - x)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((y - x)) / 2.0);
}
def code(x, y): return x + (math.fabs((y - x)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(y - x)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((y - x)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|y - x\right|}{2}
\end{array}
(FPCore (x y) :precision binary64 (+ x (/ (fabs (- x y)) 2.0)))
double code(double x, double y) {
return x + (fabs((x - y)) / 2.0);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x + (abs((x - y)) / 2.0d0)
end function
public static double code(double x, double y) {
return x + (Math.abs((x - y)) / 2.0);
}
def code(x, y): return x + (math.fabs((x - y)) / 2.0)
function code(x, y) return Float64(x + Float64(abs(Float64(x - y)) / 2.0)) end
function tmp = code(x, y) tmp = x + (abs((x - y)) / 2.0); end
code[x_, y_] := N[(x + N[(N[Abs[N[(x - y), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{\left|x - y\right|}{2}
\end{array}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y) :precision binary64 (if (<= y -2.8e-22) (+ x (/ (fabs y) 2.0)) (if (<= y 5.5e-30) (+ x (/ (fabs x) 2.0)) (* 0.5 (+ x y)))))
double code(double x, double y) {
double tmp;
if (y <= -2.8e-22) {
tmp = x + (fabs(y) / 2.0);
} else if (y <= 5.5e-30) {
tmp = x + (fabs(x) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= (-2.8d-22)) then
tmp = x + (abs(y) / 2.0d0)
else if (y <= 5.5d-30) then
tmp = x + (abs(x) / 2.0d0)
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -2.8e-22) {
tmp = x + (Math.abs(y) / 2.0);
} else if (y <= 5.5e-30) {
tmp = x + (Math.abs(x) / 2.0);
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -2.8e-22: tmp = x + (math.fabs(y) / 2.0) elif y <= 5.5e-30: tmp = x + (math.fabs(x) / 2.0) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -2.8e-22) tmp = Float64(x + Float64(abs(y) / 2.0)); elseif (y <= 5.5e-30) tmp = Float64(x + Float64(abs(x) / 2.0)); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -2.8e-22) tmp = x + (abs(y) / 2.0); elseif (y <= 5.5e-30) tmp = x + (abs(x) / 2.0); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -2.8e-22], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.5e-30], N[(x + N[(N[Abs[x], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-22}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{elif}\;y \leq 5.5 \cdot 10^{-30}:\\
\;\;\;\;x + \frac{\left|x\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -2.79999999999999995e-22Initial program 99.9%
Taylor expanded in y around inf 77.4%
if -2.79999999999999995e-22 < y < 5.49999999999999976e-30Initial program 99.9%
Taylor expanded in y around 0 87.7%
neg-mul-187.7%
Simplified87.7%
if 5.49999999999999976e-30 < y Initial program 99.9%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt87.9%
fabs-sqr87.9%
rem-square-sqrt90.5%
Simplified90.5%
Taylor expanded in x around 0 90.6%
distribute-lft-out90.6%
Simplified90.6%
Final simplification86.0%
(FPCore (x y)
:precision binary64
(if (<= x -3e-21)
(* 0.5 (+ x y))
(if (<= x 1.18e-120)
(+ x (/ (fabs y) 2.0))
(+ x (/ (* (+ x y) (* (+ x y) (/ 1.0 (+ x y)))) 2.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3e-21) {
tmp = 0.5 * (x + y);
} else if (x <= 1.18e-120) {
tmp = x + (fabs(y) / 2.0);
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3d-21)) then
tmp = 0.5d0 * (x + y)
else if (x <= 1.18d-120) then
tmp = x + (abs(y) / 2.0d0)
else
tmp = x + (((x + y) * ((x + y) * (1.0d0 / (x + y)))) / 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3e-21) {
tmp = 0.5 * (x + y);
} else if (x <= 1.18e-120) {
tmp = x + (Math.abs(y) / 2.0);
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3e-21: tmp = 0.5 * (x + y) elif x <= 1.18e-120: tmp = x + (math.fabs(y) / 2.0) else: tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -3e-21) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 1.18e-120) tmp = Float64(x + Float64(abs(y) / 2.0)); else tmp = Float64(x + Float64(Float64(Float64(x + y) * Float64(Float64(x + y) * Float64(1.0 / Float64(x + y)))) / 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3e-21) tmp = 0.5 * (x + y); elseif (x <= 1.18e-120) tmp = x + (abs(y) / 2.0); else tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3e-21], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.18e-120], N[(x + N[(N[Abs[y], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(x + y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3 \cdot 10^{-21}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{-120}:\\
\;\;\;\;x + \frac{\left|y\right|}{2}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \frac{1}{x + y}\right)}{2}\\
\end{array}
\end{array}
if x < -2.99999999999999991e-21Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt82.9%
fabs-sqr82.9%
rem-square-sqrt83.6%
Simplified83.6%
Taylor expanded in x around 0 83.6%
distribute-lft-out83.6%
Simplified83.6%
if -2.99999999999999991e-21 < x < 1.17999999999999999e-120Initial program 100.0%
Taylor expanded in y around inf 81.1%
if 1.17999999999999999e-120 < x Initial program 99.8%
add-cube-cbrt98.7%
fabs-mul98.7%
pow298.7%
Applied egg-rr98.7%
mul-fabs98.7%
unpow298.7%
add-cube-cbrt99.8%
add-sqr-sqrt20.8%
fabs-sqr20.8%
add-sqr-sqrt33.7%
flip--14.7%
difference-of-squares14.9%
add-sqr-sqrt14.9%
sqrt-unprod15.0%
sqr-neg15.0%
sqrt-unprod0.0%
add-sqr-sqrt49.1%
sub-neg49.1%
pow249.1%
sub-neg49.1%
add-sqr-sqrt0.0%
sqrt-unprod49.1%
sqr-neg49.1%
sqrt-unprod48.9%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
div-inv49.1%
inv-pow49.1%
metadata-eval49.1%
pow-div45.9%
pow145.9%
unpow245.9%
associate-*l*53.3%
+-commutative53.3%
+-commutative53.3%
pow153.3%
pow-div92.1%
metadata-eval92.1%
inv-pow92.1%
+-commutative92.1%
Applied egg-rr92.1%
(FPCore (x y)
:precision binary64
(if (<= x -3.3e-190)
(* 0.5 (+ x y))
(if (<= x 6e-114)
(* (fabs y) 0.5)
(+ x (/ (* (+ x y) (* (+ x y) (/ 1.0 (+ x y)))) 2.0)))))
double code(double x, double y) {
double tmp;
if (x <= -3.3e-190) {
tmp = 0.5 * (x + y);
} else if (x <= 6e-114) {
tmp = fabs(y) * 0.5;
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-3.3d-190)) then
tmp = 0.5d0 * (x + y)
else if (x <= 6d-114) then
tmp = abs(y) * 0.5d0
else
tmp = x + (((x + y) * ((x + y) * (1.0d0 / (x + y)))) / 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -3.3e-190) {
tmp = 0.5 * (x + y);
} else if (x <= 6e-114) {
tmp = Math.abs(y) * 0.5;
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -3.3e-190: tmp = 0.5 * (x + y) elif x <= 6e-114: tmp = math.fabs(y) * 0.5 else: tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -3.3e-190) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 6e-114) tmp = Float64(abs(y) * 0.5); else tmp = Float64(x + Float64(Float64(Float64(x + y) * Float64(Float64(x + y) * Float64(1.0 / Float64(x + y)))) / 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -3.3e-190) tmp = 0.5 * (x + y); elseif (x <= 6e-114) tmp = abs(y) * 0.5; else tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -3.3e-190], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 6e-114], N[(N[Abs[y], $MachinePrecision] * 0.5), $MachinePrecision], N[(x + N[(N[(N[(x + y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -3.3 \cdot 10^{-190}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 6 \cdot 10^{-114}:\\
\;\;\;\;\left|y\right| \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \frac{1}{x + y}\right)}{2}\\
\end{array}
\end{array}
if x < -3.30000000000000019e-190Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt77.4%
fabs-sqr77.4%
rem-square-sqrt78.2%
Simplified78.2%
Taylor expanded in x around 0 78.2%
distribute-lft-out78.2%
Simplified78.2%
if -3.30000000000000019e-190 < x < 6.0000000000000003e-114Initial program 99.9%
Taylor expanded in y around inf 88.1%
Taylor expanded in x around 0 86.3%
if 6.0000000000000003e-114 < x Initial program 99.8%
add-cube-cbrt98.7%
fabs-mul98.7%
pow298.7%
Applied egg-rr98.7%
mul-fabs98.7%
unpow298.7%
add-cube-cbrt99.8%
add-sqr-sqrt20.8%
fabs-sqr20.8%
add-sqr-sqrt33.7%
flip--14.7%
difference-of-squares14.9%
add-sqr-sqrt14.9%
sqrt-unprod15.0%
sqr-neg15.0%
sqrt-unprod0.0%
add-sqr-sqrt49.1%
sub-neg49.1%
pow249.1%
sub-neg49.1%
add-sqr-sqrt0.0%
sqrt-unprod49.1%
sqr-neg49.1%
sqrt-unprod48.9%
add-sqr-sqrt49.1%
Applied egg-rr49.1%
div-inv49.1%
inv-pow49.1%
metadata-eval49.1%
pow-div45.9%
pow145.9%
unpow245.9%
associate-*l*53.3%
+-commutative53.3%
+-commutative53.3%
pow153.3%
pow-div92.1%
metadata-eval92.1%
inv-pow92.1%
+-commutative92.1%
Applied egg-rr92.1%
Final simplification84.7%
(FPCore (x y)
:precision binary64
(if (<= x -4.4e-279)
(* 0.5 (+ x y))
(if (<= x 9.5e+137)
(+ x (/ -1.0 (/ (/ 2.0 y) (- -1.0 (/ x y)))))
(* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -4.4e-279) {
tmp = 0.5 * (x + y);
} else if (x <= 9.5e+137) {
tmp = x + (-1.0 / ((2.0 / y) / (-1.0 - (x / y))));
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.4d-279)) then
tmp = 0.5d0 * (x + y)
else if (x <= 9.5d+137) then
tmp = x + ((-1.0d0) / ((2.0d0 / y) / ((-1.0d0) - (x / y))))
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.4e-279) {
tmp = 0.5 * (x + y);
} else if (x <= 9.5e+137) {
tmp = x + (-1.0 / ((2.0 / y) / (-1.0 - (x / y))));
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.4e-279: tmp = 0.5 * (x + y) elif x <= 9.5e+137: tmp = x + (-1.0 / ((2.0 / y) / (-1.0 - (x / y)))) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -4.4e-279) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 9.5e+137) tmp = Float64(x + Float64(-1.0 / Float64(Float64(2.0 / y) / Float64(-1.0 - Float64(x / y))))); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.4e-279) tmp = 0.5 * (x + y); elseif (x <= 9.5e+137) tmp = x + (-1.0 / ((2.0 / y) / (-1.0 - (x / y)))); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.4e-279], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+137], N[(x + N[(-1.0 / N[(N[(2.0 / y), $MachinePrecision] / N[(-1.0 - N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{-279}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+137}:\\
\;\;\;\;x + \frac{-1}{\frac{\frac{2}{y}}{-1 - \frac{x}{y}}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -4.40000000000000001e-279Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt74.6%
fabs-sqr74.6%
rem-square-sqrt75.4%
Simplified75.4%
Taylor expanded in x around 0 75.5%
distribute-lft-out75.5%
Simplified75.5%
if -4.40000000000000001e-279 < x < 9.50000000000000031e137Initial program 99.9%
Taylor expanded in y around inf 97.6%
mul-1-neg97.6%
unsub-neg97.6%
Simplified97.6%
clear-num97.5%
inv-pow97.5%
add-sqr-sqrt33.9%
fabs-sqr33.9%
add-sqr-sqrt40.8%
associate-/r*40.8%
div-inv40.8%
cancel-sign-sub-inv40.8%
add-sqr-sqrt3.6%
sqrt-unprod66.4%
sqr-neg66.4%
sqrt-unprod65.6%
add-sqr-sqrt69.2%
div-inv69.2%
Applied egg-rr69.2%
unpow-169.2%
Simplified69.2%
if 9.50000000000000031e137 < x Initial program 99.7%
Taylor expanded in y around 0 92.2%
neg-mul-192.2%
Simplified92.2%
clear-num92.1%
inv-pow92.1%
fabs-neg92.1%
add-sqr-sqrt92.0%
fabs-sqr92.0%
add-sqr-sqrt92.1%
Applied egg-rr92.1%
unpow-192.1%
Simplified92.1%
Taylor expanded in x around 0 92.2%
*-commutative92.2%
Simplified92.2%
Final simplification75.9%
(FPCore (x y) :precision binary64 (if (<= x -1e-296) (* 0.5 (+ x y)) (+ x (/ (* (+ x y) (* (+ x y) (/ 1.0 (+ x y)))) 2.0))))
double code(double x, double y) {
double tmp;
if (x <= -1e-296) {
tmp = 0.5 * (x + y);
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-1d-296)) then
tmp = 0.5d0 * (x + y)
else
tmp = x + (((x + y) * ((x + y) * (1.0d0 / (x + y)))) / 2.0d0)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -1e-296) {
tmp = 0.5 * (x + y);
} else {
tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0);
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -1e-296: tmp = 0.5 * (x + y) else: tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0) return tmp
function code(x, y) tmp = 0.0 if (x <= -1e-296) tmp = Float64(0.5 * Float64(x + y)); else tmp = Float64(x + Float64(Float64(Float64(x + y) * Float64(Float64(x + y) * Float64(1.0 / Float64(x + y)))) / 2.0)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -1e-296) tmp = 0.5 * (x + y); else tmp = x + (((x + y) * ((x + y) * (1.0 / (x + y)))) / 2.0); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -1e-296], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(x + y), $MachinePrecision] * N[(N[(x + y), $MachinePrecision] * N[(1.0 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{-296}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\left(x + y\right) \cdot \left(\left(x + y\right) \cdot \frac{1}{x + y}\right)}{2}\\
\end{array}
\end{array}
if x < -1e-296Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt74.4%
fabs-sqr74.4%
rem-square-sqrt75.3%
Simplified75.3%
Taylor expanded in x around 0 75.3%
distribute-lft-out75.3%
Simplified75.3%
if -1e-296 < x Initial program 99.8%
add-cube-cbrt98.4%
fabs-mul98.4%
pow298.4%
Applied egg-rr98.4%
mul-fabs98.4%
unpow298.4%
add-cube-cbrt99.8%
add-sqr-sqrt24.0%
fabs-sqr24.0%
add-sqr-sqrt34.3%
flip--16.9%
difference-of-squares17.0%
add-sqr-sqrt16.2%
sqrt-unprod17.1%
sqr-neg17.1%
sqrt-unprod0.8%
add-sqr-sqrt42.9%
sub-neg42.9%
pow242.9%
sub-neg42.9%
add-sqr-sqrt0.8%
sqrt-unprod42.9%
sqr-neg42.9%
sqrt-unprod41.9%
add-sqr-sqrt42.9%
Applied egg-rr42.9%
div-inv42.9%
inv-pow42.9%
metadata-eval42.9%
pow-div39.7%
pow139.7%
unpow239.7%
associate-*l*45.3%
+-commutative45.3%
+-commutative45.3%
pow145.3%
pow-div79.6%
metadata-eval79.6%
inv-pow79.6%
+-commutative79.6%
Applied egg-rr79.6%
(FPCore (x y) :precision binary64 (if (<= x -4.5e-279) (* 0.5 (+ x y)) (if (<= x 9.5e+137) (* y (+ 0.5 (* (/ x y) 1.5))) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -4.5e-279) {
tmp = 0.5 * (x + y);
} else if (x <= 9.5e+137) {
tmp = y * (0.5 + ((x / y) * 1.5));
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-4.5d-279)) then
tmp = 0.5d0 * (x + y)
else if (x <= 9.5d+137) then
tmp = y * (0.5d0 + ((x / y) * 1.5d0))
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -4.5e-279) {
tmp = 0.5 * (x + y);
} else if (x <= 9.5e+137) {
tmp = y * (0.5 + ((x / y) * 1.5));
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -4.5e-279: tmp = 0.5 * (x + y) elif x <= 9.5e+137: tmp = y * (0.5 + ((x / y) * 1.5)) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -4.5e-279) tmp = Float64(0.5 * Float64(x + y)); elseif (x <= 9.5e+137) tmp = Float64(y * Float64(0.5 + Float64(Float64(x / y) * 1.5))); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -4.5e-279) tmp = 0.5 * (x + y); elseif (x <= 9.5e+137) tmp = y * (0.5 + ((x / y) * 1.5)); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -4.5e-279], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 9.5e+137], N[(y * N[(0.5 + N[(N[(x / y), $MachinePrecision] * 1.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.5 \cdot 10^{-279}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+137}:\\
\;\;\;\;y \cdot \left(0.5 + \frac{x}{y} \cdot 1.5\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -4.49999999999999995e-279Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt74.6%
fabs-sqr74.6%
rem-square-sqrt75.4%
Simplified75.4%
Taylor expanded in x around 0 75.5%
distribute-lft-out75.5%
Simplified75.5%
if -4.49999999999999995e-279 < x < 9.50000000000000031e137Initial program 99.9%
add-cube-cbrt98.1%
fabs-mul98.1%
pow298.1%
Applied egg-rr98.1%
mul-fabs98.1%
unpow298.1%
add-cube-cbrt99.9%
add-sqr-sqrt33.9%
fabs-sqr33.9%
add-sqr-sqrt41.2%
flip--24.7%
difference-of-squares24.7%
add-sqr-sqrt21.1%
sqrt-unprod24.7%
sqr-neg24.7%
sqrt-unprod3.5%
add-sqr-sqrt52.1%
sub-neg52.1%
pow252.1%
sub-neg52.1%
add-sqr-sqrt3.5%
sqrt-unprod52.1%
sqr-neg52.1%
sqrt-unprod48.4%
add-sqr-sqrt52.1%
Applied egg-rr52.1%
Taylor expanded in y around inf 69.2%
distribute-lft1-in69.2%
metadata-eval69.2%
Simplified69.2%
if 9.50000000000000031e137 < x Initial program 99.7%
Taylor expanded in y around 0 92.2%
neg-mul-192.2%
Simplified92.2%
clear-num92.1%
inv-pow92.1%
fabs-neg92.1%
add-sqr-sqrt92.0%
fabs-sqr92.0%
add-sqr-sqrt92.1%
Applied egg-rr92.1%
unpow-192.1%
Simplified92.1%
Taylor expanded in x around 0 92.2%
*-commutative92.2%
Simplified92.2%
Final simplification75.8%
(FPCore (x y) :precision binary64 (if (<= x -2.7e-191) (* x 0.5) (if (<= x 9.6e-132) (* y 0.5) (* x 1.5))))
double code(double x, double y) {
double tmp;
if (x <= -2.7e-191) {
tmp = x * 0.5;
} else if (x <= 9.6e-132) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-2.7d-191)) then
tmp = x * 0.5d0
else if (x <= 9.6d-132) then
tmp = y * 0.5d0
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -2.7e-191) {
tmp = x * 0.5;
} else if (x <= 9.6e-132) {
tmp = y * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -2.7e-191: tmp = x * 0.5 elif x <= 9.6e-132: tmp = y * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -2.7e-191) tmp = Float64(x * 0.5); elseif (x <= 9.6e-132) tmp = Float64(y * 0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -2.7e-191) tmp = x * 0.5; elseif (x <= 9.6e-132) tmp = y * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -2.7e-191], N[(x * 0.5), $MachinePrecision], If[LessEqual[x, 9.6e-132], N[(y * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.7 \cdot 10^{-191}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{elif}\;x \leq 9.6 \cdot 10^{-132}:\\
\;\;\;\;y \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -2.69999999999999999e-191Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt76.8%
fabs-sqr76.8%
rem-square-sqrt77.6%
Simplified77.6%
Taylor expanded in x around inf 61.5%
*-commutative61.5%
Simplified61.5%
if -2.69999999999999999e-191 < x < 9.60000000000000062e-132Initial program 99.9%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt45.7%
fabs-sqr45.7%
rem-square-sqrt48.7%
Simplified48.7%
Taylor expanded in x around 0 41.8%
*-commutative41.8%
Simplified41.8%
if 9.60000000000000062e-132 < x Initial program 99.8%
Taylor expanded in y around 0 71.1%
neg-mul-171.1%
Simplified71.1%
clear-num71.1%
inv-pow71.1%
fabs-neg71.1%
add-sqr-sqrt71.0%
fabs-sqr71.0%
add-sqr-sqrt71.1%
Applied egg-rr71.1%
unpow-171.1%
Simplified71.1%
Taylor expanded in x around 0 71.1%
*-commutative71.1%
Simplified71.1%
(FPCore (x y) :precision binary64 (if (<= x 6e-126) (* 0.5 (+ x y)) (* x 1.5)))
double code(double x, double y) {
double tmp;
if (x <= 6e-126) {
tmp = 0.5 * (x + y);
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= 6d-126) then
tmp = 0.5d0 * (x + y)
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= 6e-126) {
tmp = 0.5 * (x + y);
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= 6e-126: tmp = 0.5 * (x + y) else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= 6e-126) tmp = Float64(0.5 * Float64(x + y)); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= 6e-126) tmp = 0.5 * (x + y); else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, 6e-126], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq 6 \cdot 10^{-126}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < 6.0000000000000003e-126Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt67.1%
fabs-sqr67.1%
rem-square-sqrt68.6%
Simplified68.6%
Taylor expanded in x around 0 68.6%
distribute-lft-out68.6%
Simplified68.6%
if 6.0000000000000003e-126 < x Initial program 99.8%
Taylor expanded in y around 0 71.1%
neg-mul-171.1%
Simplified71.1%
clear-num71.1%
inv-pow71.1%
fabs-neg71.1%
add-sqr-sqrt71.0%
fabs-sqr71.0%
add-sqr-sqrt71.1%
Applied egg-rr71.1%
unpow-171.1%
Simplified71.1%
Taylor expanded in x around 0 71.1%
*-commutative71.1%
Simplified71.1%
(FPCore (x y) :precision binary64 (if (<= x -5e-310) (* x 0.5) (* x 1.5)))
double code(double x, double y) {
double tmp;
if (x <= -5e-310) {
tmp = x * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (x <= (-5d-310)) then
tmp = x * 0.5d0
else
tmp = x * 1.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (x <= -5e-310) {
tmp = x * 0.5;
} else {
tmp = x * 1.5;
}
return tmp;
}
def code(x, y): tmp = 0 if x <= -5e-310: tmp = x * 0.5 else: tmp = x * 1.5 return tmp
function code(x, y) tmp = 0.0 if (x <= -5e-310) tmp = Float64(x * 0.5); else tmp = Float64(x * 1.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (x <= -5e-310) tmp = x * 0.5; else tmp = x * 1.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[x, -5e-310], N[(x * 0.5), $MachinePrecision], N[(x * 1.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{-310}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;x \cdot 1.5\\
\end{array}
\end{array}
if x < -4.999999999999985e-310Initial program 100.0%
Taylor expanded in y around -inf 100.0%
fabs-neg100.0%
mul-1-neg100.0%
sub-neg100.0%
fabs-sub100.0%
rem-square-sqrt74.0%
fabs-sqr74.0%
rem-square-sqrt74.9%
Simplified74.9%
Taylor expanded in x around inf 53.8%
*-commutative53.8%
Simplified53.8%
if -4.999999999999985e-310 < x Initial program 99.8%
Taylor expanded in y around 0 58.7%
neg-mul-158.7%
Simplified58.7%
clear-num58.6%
inv-pow58.6%
fabs-neg58.6%
add-sqr-sqrt58.6%
fabs-sqr58.6%
add-sqr-sqrt58.6%
Applied egg-rr58.6%
unpow-158.6%
Simplified58.6%
Taylor expanded in x around 0 58.7%
*-commutative58.7%
Simplified58.7%
(FPCore (x y) :precision binary64 (* x 0.5))
double code(double x, double y) {
return x * 0.5;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x * 0.5d0
end function
public static double code(double x, double y) {
return x * 0.5;
}
def code(x, y): return x * 0.5
function code(x, y) return Float64(x * 0.5) end
function tmp = code(x, y) tmp = x * 0.5; end
code[x_, y_] := N[(x * 0.5), $MachinePrecision]
\begin{array}{l}
\\
x \cdot 0.5
\end{array}
Initial program 99.9%
Taylor expanded in y around -inf 99.9%
fabs-neg99.9%
mul-1-neg99.9%
sub-neg99.9%
fabs-sub99.9%
rem-square-sqrt50.8%
fabs-sqr50.8%
rem-square-sqrt56.1%
Simplified56.1%
Taylor expanded in x around inf 34.6%
*-commutative34.6%
Simplified34.6%
(FPCore (x y) :precision binary64 x)
double code(double x, double y) {
return x;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = x
end function
public static double code(double x, double y) {
return x;
}
def code(x, y): return x
function code(x, y) return x end
function tmp = code(x, y) tmp = x; end
code[x_, y_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 99.9%
Taylor expanded in x around inf 12.0%
herbie shell --seed 2024137
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))