C# Tutorials - Herong's Tutorial Examples
Dr. Herong Yang, Version 3.2

Floating-Point Data Types

This chapter provides tutorial examples and notes on floating-point data types. Topics include precisions and performances of 'float', 'double' and 'decimal' values; IEEE 754 standards on binary representation of 'float' and 'double'; Microsoft binary presentation of 'decimal'.

Precision of Floating-Point Data Types

Precision of Floating-Point Data Types - Test

Performance of Floating-Point Data Types

Performance of Floating-Point Data Types - Test

IEEE 754 Standards - "float" and "double"

IEEE 754 Standards - "float" and "double" - Test

Binary Representation of "decimal"

Accuracy of "decimal" Data Type


  • "decimal" is a simple type for floating-point values with a 128-bit storage size.
  • "double" operations have about the same execution time as "float" operations.
  • "decimal" operations are about 27 times slower that "double" operations.
  • "decimal" is not a natural extension of IEEE 754 standards that define "float" and "double".
  • "decimal" operations are much less accurate than "double" operations.

Table of Contents

 About This Book

 Introduction of C# (C Sharp)

 Data Type and Variables

 Logical Expressions and Conditional Statements

 Arrays and Loop Statements

 Data Type Features

Floating-Point Data Types

 Passing Parameters to Methods

 Execution Environment Class

 Visual C# 2010 Express Edition

 Class Features

 C# Compiler and Intermediate Language

 Compiling C# Source Code Files

 Memory Usages of Processes

 Multithreading in C#

 System.IO.FileInfo Class

 System.Diagnostics.FileVersionInfo Class


 PDF Printing Version

Dr. Herong Yang, updated in 2012
Floating-Point Data Types