Few optimizations to piecewise lin. interp. algo.

Using front() and back() saves some instructions.
Avoid multiplication with m twice in return statement.