If we multiply k numbers (say k=3). First stored in double t1 = 5/4 second in double t2 = 4/3 and third in double t3 = 3/2.
Now t4=1.0 *t1 * t2 * t3 (i.e in this case 5/2 = 2.5)
Will this always be same as val = 5/2 despite of the fact that i have solved each of them separately i.e will it always have the actual value or there may be some loss in precision while multiplying.
I am taking product in such a way that corresponding terms always cancels.
So will t4 be same as 5/2(in this case) always.
I have tried some random cases like 22/7 * 7/2 and some more. It always gives the correct answer but idk the reason. Can someone please help !!
This question came out of a question asked by my friend related to floor addition. If required i can share that problem statement too.
I assure you it has nothing to do with any of the live contest.
Thanks in advance