En double se pueden almacenar números más grandes y también más decimales Con los números que has probado no se ve diferencia porque cout << redondea la representación interna para mostrar pocos decimales, y lo que ves en ambos casos es lo mismo, pero internamente no son iguales. double** 是指向 double* 类型的指针类型。 区别不是很显然的吗? double [5] 类型能隐式转换成 double* 类型,但它们不是同一类型。 可以考虑一下 short 和 long 这两种类型是能相互隐式转换的,但它们显然没有因此变成同一类型。 The long double function prototypes are identical to the prototypes for their double counterparts, except that the longdouble data type replaces the double data type The long double versions of these functions should not be used in new code. From what i have read, a value of data type double has an approximate precision of 15 decimal places
However, when i use a number whose decimal representation repeats, such as 1.0/7.0, i find tha. 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
A double which is usually implemented with ieee 754 will be accurate to between 15 and 17 decimal digits Anything past that can't be trusted, even if you can make the compiler display it. Long double vs double i am new to programming and i am unable to understand the difference between between long double and double in c and c++ I tried to google it but was unab.
OPEN