using conditional operator in abs value calculation