Modified declaring r to be of type long, "r = v" will not have the loss of accuracy of data problem in this way.