Following code (in c++) works fine for value less than 6 digit but it start to lose precision when dividing more than 6 digits. Code:
double number;
cin>>number;
double result = number / 2.0L;
cout<<result<<endl;
Above code gives 61729.5 for 123459 which is correct. But for 1234569 it outputs 617284 which is wrong.
Can anyone please explain what's happening here.
Thanks.