- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between a float, double and a decimal in C#?
Float , double and a decimal are all Value Types in C#.
Value type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data.
Float Value Type
Float is a 32-bit single-precision floating point type with range 3.4 x 1038 to + 3.4 x 1038
Memory Size is 4 bytes.
float a = 3.5f;
Double Value Type
Double is a 64-bit double-precision floating point type with range (+/-)5.0 x 10-324 to (+/-)1.7 x 10308
Memory Size is 8 bytes.
double d = 5.78788
Decimal Value Type
Decimal is a 128-bit precise decimal values with 28-29 significant digits with range (-7.9 x 1028 to 7.9 x 1028) / 100 to 28
Memory Size is 16 bytes.
decimal d = 1.0M;
- Difference Between Float and Double
- Difference between float and double in C/C++
- Difference between float and double in Arduino
- Float and Double in C
- What is the difference between single and double quotes in python?
- What is the most effective way for float and double comparison in C/C++?
- Checking if a double (or float) is NaN in C++
- What is the difference between a definition and a declaration in C++?
- What is the difference Between C and C++?
- How to compare float and double in C++?
- What is the difference between a destructor and a free function in C++?
- What is the difference between a method and a function?
- What is the difference between a simile and a metaphor?