Optimizing code on arduino due

Related to Q1: Noticed that when I get "inf" actually timed2 /times2 is 0 ....don t know why it becomes 0