Handle correctly the odd range when slider moves symmetrically. Fixes #432

Replace C style cast with C++