how to limit a calculation