When we are finding distance b/w P and Q (x2x1)^2 + (y2y1)^2 whole underoot.(for 2d case). Now according to constraint of coordinates (this value (x2x1)^2 + (y2y1)^2) can exceed max value possible to store)? asked 12 Jun '18, 00:00

As specified in the constraints that the absolute value of the coordinates can be at max 2 10^9 . Now if we take x2=2 10^9, x1=2 10^9, y2=2 10^9, y1=2 *10^9, so it's pretty clear the value
answered 12 Jun '18, 15:50
Use long double.
(12 Jun '18, 15:52)
@vijju123 What about JAVA , it can support at max 64 bits
(12 Jun '18, 15:55)
Will double not suffice? Did you try that?
(12 Jun '18, 18:47)
@vijju123 no need to use long double, even for C++ double would suffice.
(12 Jun '18, 18:53)
yeah @vijju123 and @souradeep1999 you are right
(12 Jun '18, 19:04)
Thats true, but long double afaik is more precise than double. I never trust floating points so thought better safe than sorry xD
(12 Jun '18, 19:46)
How can long double store more than 64 bits i.e >10^18
(13 Jun '18, 10:12)
showing 5 of 7
show all

As that is 64 bit then i think it can also store same as c++ upto 2^641,thats nearly 18*10^18. answered 12 Jun '18, 18:32

long double or even double can be used. They have a huge range (around $1.7e^{308}$) (check here) even though they are 64 bits since they use floating point representation, i.e. have some bits reserved for exponent and some bits for mantissa. answered 13 Jun '18, 16:45

Its guaranteed that coordinates of Q never exceed $2*{10}^{9}$ during entire time.