Conversion from a decimal
Target data type | Behavior | Examples |
---|---|---|
String | Returns the value as a string. | 3.1415 is converted to "3.1415". |
Boolean | Returns false if the value is 0 and true otherwise. This conversion can cause a loss of data. | 3.1415 is converted to true. |
Integer | Returns the integer part of the decimal number. This conversion can cause a loss of data. |
|
Double | Returns the decimal value as a double. This conversion can cause a loss of data.
Information noteNote: If the decimal is too large to be represented as a double, it is converted to a
negative infinity or positive infinity.
|
3.1415 is converted to 3.1415D. |
Float | Returns the decimal value as a float. This conversion can cause a loss of data.
Information noteNote: If the decimal is too large to be represented as a float, it is converted to a
negative infinity or positive infinity.
|
3.1415 is converted to 3.1415F. |
Long | Returns the integer part of the decimal number as a long. This conversion can cause a loss of data. |
|