You're evaluating num twice here.