make valmin/valmax/maxinit/allbits/signmask return exactly the requested types. Part of issue #422