Skip to content

Latest commit

 

History

History
18 lines (12 loc) · 2.04 KB

File metadata and controls

18 lines (12 loc) · 2.04 KB

There are three floating-point types in C#: float, double and decimal. The most commonly used type is double, whereas decimal is normally used when working with monetary data.

Each floating-point type has its own precision, approximate range and size.

Some conversions between floating point types are automatic (implicit), but others are manual (explicit).

Always be careful when checking the values of floating-point types for equality, as values that can appear to represent the same value could actually be different. See this article for more information.

You can find a short introduction to floating-point numbers at 0.30000000000000004.com. The Float Toy page has a nice, graphical explanation how a floating-point numbers' bits are converted to an actual floating-point value.

To repeatedly execute logic, one can use loops. One of the most common loop types in C# is the while loop, which keeps on looping until a boolean condition evaluates to true.