Mistakes:

  1. Normal person who does day to day programming is habitual of assigning the index an data type of integer, as the index never exceed such a large number an integer data type can store. It was the same mistake I described before.
  2. The second mistake is to assigning the float data type to each elements (\(a_{i}\)), but it is not that hard to see that once we multiply the largest possible number by 4.2, it won't be stored with just 31 bits (1 bit reserved for negative numbers).
  3. Third mistake is similar to second one, In the function defined to find the magnitude of the vector, we have declared the variable 'sum' as of type 'float', which can only store real numbers with 4 bytes. Inside the loop we are finding square of very large numbers, after squaring the numbers become too large to be stored in 'float' data type. One has to use 'double' data type for variable 'sum'.