0

why p%10 is 9.0000000001 while it should be 9 only????? Can someone please help....

since % give remainder p%10 should be 9 but it is not.. https://code.sololearn.com/cAL64z3n6twb/?ref=app

10th Mar 2020, 5:12 AM
Addy
Addy - avatar
2 Antworten
+ 1
because long binary decimal numbers are cut to 64 bit numbers and it causes small difference
10th Mar 2020, 5:30 AM
zemiak
+ 1
Use integral type rather than floating point type if you don't want the fractional part of the number. Note that type casting may be necessary.
10th Mar 2020, 5:58 AM
Ipang