It's in the documentation. The value="" always expects an integer value, and will interpret it as an integer.
:set_integer var="prev_val" value="current_val";
To set based on the result of an expression (which can reference an integer variable) use:
:set_integer var="prev_val" {(current_val)}