So what actual problem are you seeing?
It should be o.k. but you don't need the brackets. oldPress = P; is more normal. But casting a double (float) into an int may or may not give you what you're expecting.
And I hate programs that are full of single character variable names making it impossible to work out or remember what on earth they're supposed to mean.
Steve