
(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 8 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 (- 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}
Initial program 99.9%
Final simplification99.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- y x) 0.5)))
(if (<= y -9.5e+133)
(* (fabs (- y x)) 0.5)
(if (<= y -1.68e-181)
(/ (- (* t_0 t_0) (* x x)) (+ (* y -0.5) (* x -0.5)))
(* 0.5 (+ x y))))))
double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -9.5e+133) {
tmp = fabs((y - x)) * 0.5;
} else if (y <= -1.68e-181) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} 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) :: t_0
real(8) :: tmp
t_0 = (y - x) * 0.5d0
if (y <= (-9.5d+133)) then
tmp = abs((y - x)) * 0.5d0
else if (y <= (-1.68d-181)) then
tmp = ((t_0 * t_0) - (x * x)) / ((y * (-0.5d0)) + (x * (-0.5d0)))
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -9.5e+133) {
tmp = Math.abs((y - x)) * 0.5;
} else if (y <= -1.68e-181) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): t_0 = (y - x) * 0.5 tmp = 0 if y <= -9.5e+133: tmp = math.fabs((y - x)) * 0.5 elif y <= -1.68e-181: tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(y - x) * 0.5) tmp = 0.0 if (y <= -9.5e+133) tmp = Float64(abs(Float64(y - x)) * 0.5); elseif (y <= -1.68e-181) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(x * x)) / Float64(Float64(y * -0.5) + Float64(x * -0.5))); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y - x) * 0.5; tmp = 0.0; if (y <= -9.5e+133) tmp = abs((y - x)) * 0.5; elseif (y <= -1.68e-181) tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[y, -9.5e+133], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, -1.68e-181], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[(y * -0.5), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot 0.5\\
\mathbf{if}\;y \leq -9.5 \cdot 10^{+133}:\\
\;\;\;\;\left|y - x\right| \cdot 0.5\\
\mathbf{elif}\;y \leq -1.68 \cdot 10^{-181}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - x \cdot x}{y \cdot -0.5 + x \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -9.49999999999999996e133Initial program 100.0%
Taylor expanded in x around 0 97.1%
if -9.49999999999999996e133 < y < -1.68e-181Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt23.3%
fabs-sqr23.3%
add-sqr-sqrt29.2%
metadata-eval29.2%
Applied egg-rr29.2%
fma-udef29.2%
flip-+19.9%
Applied egg-rr19.9%
add-sqr-sqrt14.9%
sqrt-prod84.2%
associate-*r*84.2%
sqrt-prod83.8%
fma-neg83.8%
*-commutative83.8%
associate-*l*83.8%
pow283.8%
Applied egg-rr83.8%
Taylor expanded in y around -inf 70.6%
sub-neg70.6%
+-commutative70.6%
associate-+l+70.6%
*-commutative70.6%
*-commutative70.6%
unpow270.6%
rem-square-sqrt71.5%
associate-*l*71.5%
metadata-eval71.5%
unpow271.5%
rem-square-sqrt71.9%
neg-mul-171.9%
distribute-rgt-out71.9%
metadata-eval71.9%
Simplified71.9%
if -1.68e-181 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt73.8%
fabs-sqr73.8%
add-sqr-sqrt78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in y around 0 78.6%
+-commutative78.6%
associate-+r+78.6%
distribute-lft1-in78.6%
metadata-eval78.6%
distribute-lft-out78.6%
Simplified78.6%
Final simplification79.9%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- y x) 0.5)))
(if (<= y -3.6e+143)
(* (/ y 0.5) -0.25)
(if (<= y -1.68e-181)
(/ (- (* t_0 t_0) (* x x)) (+ (* y -0.5) (* x -0.5)))
(* 0.5 (+ x y))))))
double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -3.6e+143) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -1.68e-181) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} 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) :: t_0
real(8) :: tmp
t_0 = (y - x) * 0.5d0
if (y <= (-3.6d+143)) then
tmp = (y / 0.5d0) * (-0.25d0)
else if (y <= (-1.68d-181)) then
tmp = ((t_0 * t_0) - (x * x)) / ((y * (-0.5d0)) + (x * (-0.5d0)))
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double t_0 = (y - x) * 0.5;
double tmp;
if (y <= -3.6e+143) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -1.68e-181) {
tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5));
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): t_0 = (y - x) * 0.5 tmp = 0 if y <= -3.6e+143: tmp = (y / 0.5) * -0.25 elif y <= -1.68e-181: tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)) else: tmp = 0.5 * (x + y) return tmp
function code(x, y) t_0 = Float64(Float64(y - x) * 0.5) tmp = 0.0 if (y <= -3.6e+143) tmp = Float64(Float64(y / 0.5) * -0.25); elseif (y <= -1.68e-181) tmp = Float64(Float64(Float64(t_0 * t_0) - Float64(x * x)) / Float64(Float64(y * -0.5) + Float64(x * -0.5))); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) t_0 = (y - x) * 0.5; tmp = 0.0; if (y <= -3.6e+143) tmp = (y / 0.5) * -0.25; elseif (y <= -1.68e-181) tmp = ((t_0 * t_0) - (x * x)) / ((y * -0.5) + (x * -0.5)); else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := Block[{t$95$0 = N[(N[(y - x), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[y, -3.6e+143], N[(N[(y / 0.5), $MachinePrecision] * -0.25), $MachinePrecision], If[LessEqual[y, -1.68e-181], N[(N[(N[(t$95$0 * t$95$0), $MachinePrecision] - N[(x * x), $MachinePrecision]), $MachinePrecision] / N[(N[(y * -0.5), $MachinePrecision] + N[(x * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(y - x\right) \cdot 0.5\\
\mathbf{if}\;y \leq -3.6 \cdot 10^{+143}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{elif}\;y \leq -1.68 \cdot 10^{-181}:\\
\;\;\;\;\frac{t_0 \cdot t_0 - x \cdot x}{y \cdot -0.5 + x \cdot -0.5}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.5999999999999999e143Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt0.0%
fabs-sqr0.0%
add-sqr-sqrt0.7%
metadata-eval0.7%
Applied egg-rr0.7%
fma-udef0.7%
flip-+0.2%
Applied egg-rr0.2%
add-sqr-sqrt0.0%
sqrt-prod10.0%
associate-*r*10.0%
sqrt-prod9.9%
fma-neg9.9%
*-commutative9.9%
associate-*l*9.9%
pow29.9%
Applied egg-rr9.9%
Taylor expanded in y around -inf 94.9%
*-commutative94.9%
unpow294.9%
rem-square-sqrt96.8%
Simplified96.8%
if -3.5999999999999999e143 < y < -1.68e-181Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt23.3%
fabs-sqr23.3%
add-sqr-sqrt29.2%
metadata-eval29.2%
Applied egg-rr29.2%
fma-udef29.2%
flip-+19.9%
Applied egg-rr19.9%
add-sqr-sqrt14.9%
sqrt-prod84.2%
associate-*r*84.2%
sqrt-prod83.8%
fma-neg83.8%
*-commutative83.8%
associate-*l*83.8%
pow283.8%
Applied egg-rr83.8%
Taylor expanded in y around -inf 70.6%
sub-neg70.6%
+-commutative70.6%
associate-+l+70.6%
*-commutative70.6%
*-commutative70.6%
unpow270.6%
rem-square-sqrt71.5%
associate-*l*71.5%
metadata-eval71.5%
unpow271.5%
rem-square-sqrt71.9%
neg-mul-171.9%
distribute-rgt-out71.9%
metadata-eval71.9%
Simplified71.9%
if -1.68e-181 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt73.8%
fabs-sqr73.8%
add-sqr-sqrt78.6%
metadata-eval78.6%
Applied egg-rr78.6%
Taylor expanded in y around 0 78.6%
+-commutative78.6%
associate-+r+78.6%
distribute-lft1-in78.6%
metadata-eval78.6%
distribute-lft-out78.6%
Simplified78.6%
Final simplification79.9%
(FPCore (x y) :precision binary64 (if (<= y -3.4e-106) (* (/ y 0.5) -0.25) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= -3.4e-106) {
tmp = (y / 0.5) * -0.25;
} 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 <= (-3.4d-106)) then
tmp = (y / 0.5d0) * (-0.25d0)
else
tmp = 0.5d0 * (x + y)
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= -3.4e-106) {
tmp = (y / 0.5) * -0.25;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -3.4e-106: tmp = (y / 0.5) * -0.25 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -3.4e-106) tmp = Float64(Float64(y / 0.5) * -0.25); else tmp = Float64(0.5 * Float64(x + y)); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= -3.4e-106) tmp = (y / 0.5) * -0.25; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -3.4e-106], N[(N[(y / 0.5), $MachinePrecision] * -0.25), $MachinePrecision], N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.4 \cdot 10^{-106}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -3.39999999999999982e-106Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt10.6%
fabs-sqr10.6%
add-sqr-sqrt13.5%
metadata-eval13.5%
Applied egg-rr13.5%
fma-udef13.5%
flip-+6.7%
Applied egg-rr6.7%
add-sqr-sqrt4.7%
sqrt-prod48.1%
associate-*r*48.1%
sqrt-prod47.9%
fma-neg47.9%
*-commutative47.9%
associate-*l*47.9%
pow247.9%
Applied egg-rr47.9%
Taylor expanded in y around -inf 75.3%
*-commutative75.3%
unpow275.3%
rem-square-sqrt76.8%
Simplified76.8%
if -3.39999999999999982e-106 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt70.3%
fabs-sqr70.3%
add-sqr-sqrt75.4%
metadata-eval75.4%
Applied egg-rr75.4%
Taylor expanded in y around 0 75.4%
+-commutative75.4%
associate-+r+75.5%
distribute-lft1-in75.5%
metadata-eval75.5%
distribute-lft-out75.5%
Simplified75.5%
Final simplification75.9%
(FPCore (x y) :precision binary64 (if (<= y 2.25e-167) x (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 2.25e-167) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.25d-167) then
tmp = x
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.25e-167) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.25e-167: tmp = x else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 2.25e-167) tmp = x; else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.25e-167) tmp = x; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.25e-167], x, N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.25 \cdot 10^{-167}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 2.2500000000000001e-167Initial program 99.9%
Taylor expanded in x around inf 12.0%
if 2.2500000000000001e-167 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt83.4%
fabs-sqr83.4%
add-sqr-sqrt86.9%
metadata-eval86.9%
Applied egg-rr86.9%
Taylor expanded in y around inf 68.9%
Final simplification32.9%
(FPCore (x y) :precision binary64 (if (<= y 2.7e-164) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 2.7e-164) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8) :: tmp
if (y <= 2.7d-164) then
tmp = x * 0.5d0
else
tmp = y * 0.5d0
end if
code = tmp
end function
public static double code(double x, double y) {
double tmp;
if (y <= 2.7e-164) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 2.7e-164: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 2.7e-164) tmp = Float64(x * 0.5); else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 2.7e-164) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 2.7e-164], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 2.7 \cdot 10^{-164}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 2.7000000000000001e-164Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt31.3%
fabs-sqr31.3%
add-sqr-sqrt36.3%
metadata-eval36.3%
Applied egg-rr36.3%
Taylor expanded in y around 0 35.4%
distribute-lft1-in35.4%
metadata-eval35.4%
*-commutative35.4%
Simplified35.4%
if 2.7000000000000001e-164 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt83.4%
fabs-sqr83.4%
add-sqr-sqrt86.9%
metadata-eval86.9%
Applied egg-rr86.9%
Taylor expanded in y around inf 68.9%
Final simplification47.7%
(FPCore (x y) :precision binary64 (* 0.5 (+ x y)))
double code(double x, double y) {
return 0.5 * (x + y);
}
real(8) function code(x, y)
real(8), intent (in) :: x
real(8), intent (in) :: y
code = 0.5d0 * (x + y)
end function
public static double code(double x, double y) {
return 0.5 * (x + y);
}
def code(x, y): return 0.5 * (x + y)
function code(x, y) return Float64(0.5 * Float64(x + y)) end
function tmp = code(x, y) tmp = 0.5 * (x + y); end
code[x_, y_] := N[(0.5 * N[(x + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
0.5 \cdot \left(x + y\right)
\end{array}
Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt50.4%
fabs-sqr50.4%
add-sqr-sqrt54.9%
metadata-eval54.9%
Applied egg-rr54.9%
Taylor expanded in y around 0 54.9%
+-commutative54.9%
associate-+r+54.9%
distribute-lft1-in54.9%
metadata-eval54.9%
distribute-lft-out54.9%
Simplified54.9%
Final simplification54.9%
(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 10.6%
Final simplification10.6%
herbie shell --seed 2023224
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))