+ 5

What does this mean? (double) It's the same things? I know the answer to this, but what role "double"? Double-precision number?

Console. WriteLine(-b/(2*(double)a)); or Console. WriteLine(-(double)b/(2*a)); //thx☺️

15th Oct 2017, 8:39 PM
Валерия
Валерия - avatar
2 Respostas
+ 5
(dataType) is an operator that will cast (cast is a fancy word for convert) whatever is to the right of it to that type. For example, float a = 5.5; int b = (int)a; A is being casted to an int, making b equal to 5. One more example: float d = 5.5; int e = (int)(d + 2 * 2); e will cast (5.5 + 2 * 2) to an int. Making e: 5.5 + 4 = 9.5 = 9. In your example, we are casting to a double. That way the result can have decimals with high precision.
15th Oct 2017, 8:52 PM
Rrestoring faith
Rrestoring faith - avatar
+ 4
Precision is the main difference. Float - 7 digits (32 bit) Double-15-16 digits (64 bit) Decimal -28-29 significant digits (128 bit)
15th Oct 2017, 8:50 PM
Scooby
Scooby - avatar