[functionals.affine] fix unsafe integer conversion