I've read about the difference between double precision and single precision The term double precision is something of a misnomer because the precision is not really double However, in most cases, float and double seem to be interchangeable, i.e
Using one or the other does not seem to affec. Has some similar and more in depth answers From what i have read, a value of data type double has an approximate precision of 15 decimal places
494 a double is not an integer, so the cast won't work Note the difference between the double class and the double primitive Also note that a double is a number, so it has the method intvalue, which you can use to get the value as a primitive int. Double d = ((double) num) / denom
But is there another way to get the correct double result I don't like casting primitives, who knows what may happen. Using long double i get 18/19 = 0.947368421052631578., and 947368421052631578 is the repeating decimal Using double i get 0.947368421052631526.however, the former is correct
When should i use double instead of decimal