
(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 -3.5e+152)
(* (fabs (- y x)) 0.5)
(if (<= y -3.15e-133)
(/ (- (* 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.5e+152) {
tmp = fabs((y - x)) * 0.5;
} else if (y <= -3.15e-133) {
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.5d+152)) then
tmp = abs((y - x)) * 0.5d0
else if (y <= (-3.15d-133)) 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.5e+152) {
tmp = Math.abs((y - x)) * 0.5;
} else if (y <= -3.15e-133) {
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.5e+152: tmp = math.fabs((y - x)) * 0.5 elif y <= -3.15e-133: 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.5e+152) tmp = Float64(abs(Float64(y - x)) * 0.5); elseif (y <= -3.15e-133) 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.5e+152) tmp = abs((y - x)) * 0.5; elseif (y <= -3.15e-133) 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.5e+152], N[(N[Abs[N[(y - x), $MachinePrecision]], $MachinePrecision] * 0.5), $MachinePrecision], If[LessEqual[y, -3.15e-133], 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.5 \cdot 10^{+152}:\\
\;\;\;\;\left|y - x\right| \cdot 0.5\\
\mathbf{elif}\;y \leq -3.15 \cdot 10^{-133}:\\
\;\;\;\;\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.49999999999999981e152Initial program 100.0%
Taylor expanded in x around 0 84.0%
if -3.49999999999999981e152 < y < -3.1500000000000001e-133Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt23.0%
fabs-sqr23.0%
add-sqr-sqrt29.2%
metadata-eval29.2%
Applied egg-rr29.2%
fma-udef29.2%
flip-+12.3%
Applied egg-rr12.3%
add-sqr-sqrt8.9%
sqrt-prod71.2%
associate-*r*71.2%
sqrt-prod70.9%
fma-neg70.9%
*-commutative70.9%
associate-*l*70.9%
pow270.9%
Applied egg-rr70.9%
Taylor expanded in y around -inf 62.8%
sub-neg62.8%
+-commutative62.8%
associate-+l+62.8%
*-commutative62.8%
*-commutative62.8%
unpow262.8%
rem-square-sqrt63.6%
associate-*l*63.6%
metadata-eval63.6%
unpow263.6%
rem-square-sqrt63.9%
neg-mul-163.9%
distribute-rgt-out63.9%
metadata-eval63.9%
Simplified63.9%
if -3.1500000000000001e-133 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt70.8%
fabs-sqr70.8%
add-sqr-sqrt76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Taylor expanded in y around 0 76.2%
+-commutative76.2%
associate-+r+76.2%
distribute-lft1-in76.2%
metadata-eval76.2%
distribute-lft-out76.2%
Simplified76.2%
Final simplification74.6%
(FPCore (x y)
:precision binary64
(let* ((t_0 (* (- y x) 0.5)))
(if (<= y -2.6e+154)
(* (/ y 0.5) -0.25)
(if (<= y -1.28e-132)
(/ (- (* 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 <= -2.6e+154) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -1.28e-132) {
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 <= (-2.6d+154)) then
tmp = (y / 0.5d0) * (-0.25d0)
else if (y <= (-1.28d-132)) 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 <= -2.6e+154) {
tmp = (y / 0.5) * -0.25;
} else if (y <= -1.28e-132) {
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 <= -2.6e+154: tmp = (y / 0.5) * -0.25 elif y <= -1.28e-132: 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 <= -2.6e+154) tmp = Float64(Float64(y / 0.5) * -0.25); elseif (y <= -1.28e-132) 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 <= -2.6e+154) tmp = (y / 0.5) * -0.25; elseif (y <= -1.28e-132) 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, -2.6e+154], N[(N[(y / 0.5), $MachinePrecision] * -0.25), $MachinePrecision], If[LessEqual[y, -1.28e-132], 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 -2.6 \cdot 10^{+154}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{elif}\;y \leq -1.28 \cdot 10^{-132}:\\
\;\;\;\;\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 < -2.59999999999999989e154Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt11.0%
fabs-sqr11.0%
add-sqr-sqrt11.9%
metadata-eval11.9%
Applied egg-rr11.9%
fma-udef11.9%
flip-+0.1%
Applied egg-rr0.1%
add-sqr-sqrt0.0%
sqrt-prod0.0%
associate-*r*0.0%
sqrt-prod0.0%
fma-neg0.0%
*-commutative0.0%
associate-*l*0.0%
pow20.0%
Applied egg-rr0.0%
Taylor expanded in y around -inf 82.1%
*-commutative82.1%
unpow282.1%
rem-square-sqrt83.8%
Simplified83.8%
if -2.59999999999999989e154 < y < -1.28000000000000005e-132Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt23.0%
fabs-sqr23.0%
add-sqr-sqrt29.2%
metadata-eval29.2%
Applied egg-rr29.2%
fma-udef29.2%
flip-+12.3%
Applied egg-rr12.3%
add-sqr-sqrt8.9%
sqrt-prod71.2%
associate-*r*71.2%
sqrt-prod70.9%
fma-neg70.9%
*-commutative70.9%
associate-*l*70.9%
pow270.9%
Applied egg-rr70.9%
Taylor expanded in y around -inf 62.8%
sub-neg62.8%
+-commutative62.8%
associate-+l+62.8%
*-commutative62.8%
*-commutative62.8%
unpow262.8%
rem-square-sqrt63.6%
associate-*l*63.6%
metadata-eval63.6%
unpow263.6%
rem-square-sqrt63.9%
neg-mul-163.9%
distribute-rgt-out63.9%
metadata-eval63.9%
Simplified63.9%
if -1.28000000000000005e-132 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt70.8%
fabs-sqr70.8%
add-sqr-sqrt76.2%
metadata-eval76.2%
Applied egg-rr76.2%
Taylor expanded in y around 0 76.2%
+-commutative76.2%
associate-+r+76.2%
distribute-lft1-in76.2%
metadata-eval76.2%
distribute-lft-out76.2%
Simplified76.2%
Final simplification74.6%
(FPCore (x y) :precision binary64 (if (<= y -1.4e-35) (* (/ y 0.5) -0.25) (* 0.5 (+ x y))))
double code(double x, double y) {
double tmp;
if (y <= -1.4e-35) {
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 <= (-1.4d-35)) 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 <= -1.4e-35) {
tmp = (y / 0.5) * -0.25;
} else {
tmp = 0.5 * (x + y);
}
return tmp;
}
def code(x, y): tmp = 0 if y <= -1.4e-35: tmp = (y / 0.5) * -0.25 else: tmp = 0.5 * (x + y) return tmp
function code(x, y) tmp = 0.0 if (y <= -1.4e-35) 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 <= -1.4e-35) tmp = (y / 0.5) * -0.25; else tmp = 0.5 * (x + y); end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, -1.4e-35], 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 -1.4 \cdot 10^{-35}:\\
\;\;\;\;\frac{y}{0.5} \cdot -0.25\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(x + y\right)\\
\end{array}
\end{array}
if y < -1.4e-35Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt11.7%
fabs-sqr11.7%
add-sqr-sqrt14.6%
metadata-eval14.6%
Applied egg-rr14.6%
fma-udef14.6%
flip-+2.3%
Applied egg-rr2.3%
add-sqr-sqrt1.4%
sqrt-prod33.7%
associate-*r*33.7%
sqrt-prod33.6%
fma-neg33.6%
*-commutative33.6%
associate-*l*33.6%
pow233.6%
Applied egg-rr33.6%
Taylor expanded in y around -inf 71.7%
*-commutative71.7%
unpow271.7%
rem-square-sqrt73.1%
Simplified73.1%
if -1.4e-35 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt66.5%
fabs-sqr66.5%
add-sqr-sqrt72.2%
metadata-eval72.2%
Applied egg-rr72.2%
Taylor expanded in y around 0 72.1%
+-commutative72.1%
associate-+r+72.2%
distribute-lft1-in72.2%
metadata-eval72.2%
distribute-lft-out72.2%
Simplified72.2%
Final simplification72.4%
(FPCore (x y) :precision binary64 (if (<= y 1.75e-172) x (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 1.75e-172) {
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 <= 1.75d-172) 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 <= 1.75e-172) {
tmp = x;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 1.75e-172: tmp = x else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 1.75e-172) tmp = x; else tmp = Float64(y * 0.5); end return tmp end
function tmp_2 = code(x, y) tmp = 0.0; if (y <= 1.75e-172) tmp = x; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 1.75e-172], x, N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.75 \cdot 10^{-172}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 1.75000000000000014e-172Initial program 99.9%
Taylor expanded in x around inf 13.0%
if 1.75000000000000014e-172 < y Initial program 100.0%
+-commutative100.0%
div-inv100.0%
fma-def100.0%
add-sqr-sqrt80.4%
fabs-sqr80.4%
add-sqr-sqrt84.4%
metadata-eval84.4%
Applied egg-rr84.4%
Taylor expanded in y around inf 62.1%
Final simplification32.2%
(FPCore (x y) :precision binary64 (if (<= y 4.5e-60) (* x 0.5) (* y 0.5)))
double code(double x, double y) {
double tmp;
if (y <= 4.5e-60) {
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 <= 4.5d-60) 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 <= 4.5e-60) {
tmp = x * 0.5;
} else {
tmp = y * 0.5;
}
return tmp;
}
def code(x, y): tmp = 0 if y <= 4.5e-60: tmp = x * 0.5 else: tmp = y * 0.5 return tmp
function code(x, y) tmp = 0.0 if (y <= 4.5e-60) 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 <= 4.5e-60) tmp = x * 0.5; else tmp = y * 0.5; end tmp_2 = tmp; end
code[x_, y_] := If[LessEqual[y, 4.5e-60], N[(x * 0.5), $MachinePrecision], N[(y * 0.5), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 4.5 \cdot 10^{-60}:\\
\;\;\;\;x \cdot 0.5\\
\mathbf{else}:\\
\;\;\;\;y \cdot 0.5\\
\end{array}
\end{array}
if y < 4.50000000000000001e-60Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt39.1%
fabs-sqr39.1%
add-sqr-sqrt44.6%
metadata-eval44.6%
Applied egg-rr44.6%
Taylor expanded in y around 0 40.2%
distribute-lft1-in40.2%
metadata-eval40.2%
*-commutative40.2%
Simplified40.2%
if 4.50000000000000001e-60 < y Initial program 99.9%
+-commutative99.9%
div-inv99.9%
fma-def99.9%
add-sqr-sqrt82.3%
fabs-sqr82.3%
add-sqr-sqrt85.9%
metadata-eval85.9%
Applied egg-rr85.9%
Taylor expanded in y around inf 70.7%
Final simplification49.2%
(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-sqrt51.9%
fabs-sqr51.9%
add-sqr-sqrt56.9%
metadata-eval56.9%
Applied egg-rr56.9%
Taylor expanded in y around 0 56.8%
+-commutative56.8%
associate-+r+56.9%
distribute-lft1-in56.9%
metadata-eval56.9%
distribute-lft-out56.9%
Simplified56.9%
Final simplification56.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 11.7%
Final simplification11.7%
herbie shell --seed 2023268
(FPCore (x y)
:name "Graphics.Rendering.Chart.Plot.AreaSpots:renderSpotLegend from Chart-1.5.3"
:precision binary64
(+ x (/ (fabs (- y x)) 2.0)))