Bounded continuous witness with neither extremum attained (source code)

= Bounded continuous witness with neither extremum attained
{title2=$-1<g<1,\quad\inf g=-1,\quad\sup g=1$}

Suppose a <topological space> admits an unbounded <continuous function> $f$ to $\mathbb R$. Set $u=|f|$ and choose $x_n$ so that $t_n=u(x_n)$ increases to infinity. There is a continuous function $h:[0,\infty)\to\mathbb R$ with $h(t_n)=(-1)^nn$: interpolate linearly between successive prescribed values and extend constantly below $t_1$. Then
$$
g=\frac{h\circ u}{\sqrt{1+(h\circ u)^2}}
$$
is continuous and takes values strictly between $-1$ and $1$, while its values on the even and odd chosen sequences tend to $1$ and $-1$. Thus neither bound is attained. In particular, <unbounded continuous witnesses to noncompactness of a real subspace> give this stronger failure of the <extreme value theorem> for every noncompact real subspace.