Float is a 32 bit floating binary point data type, it represent a number like 10001.10010110011
Double is a 64 bit floating binary point data type, it represent a number like 10001.10010110011
Decimal is a 128-bit floating decimal point data type, it represents a number like 12345.65789
These are used mostly in graphic libraries because very high demands for processing powers.
These are most normally used for real values, except handling money.
It can be used for financial applications due to high level of accuracy and easy to avoid rounding errors.
It cannot accurately represent all numbers.
It can also not accurately represent all numbers.
It can 100% accurately represent any number within the precision of the decimal format.
It is better to use where the values are more artifacts of nature which can't really be measured exactly.
It is better to use where the values are more artifacts of nature which can't really be measured exactly.
It is better to use where the values are "naturally exact decimals".
It has lowest precision i.e 7 digits but is fast in performance.
It has precision of 15-16 digits, but is slower in performance as compared to Float.
It has highest precision i.e. 28-29 significant digits therefore it is used at the places where accuracy is more important but performance wise it is slower as compared to Float and Double.
0 Comment(s)