C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
They have no differences from the common types they are aliased to. In C# programming, we often hear about a Double, but less commonly about a Single.
Type information float -> Single double -> Double
Example. First, this program creates an instance of the Single and Double types. It then prints their types to the console window. Then it does the same thing for the float and double types.
And: This shows us that the Single type is the same as the float type, and the Double type is the same as the (lowercase) double type.
C# program that uses Single and Double using System; class Program { static void Main() { { Single a = 1; Double b = 1; Console.WriteLine(a.GetType()); Console.WriteLine(b.GetType()); } { float a = 1; double b = 1; Console.WriteLine(a.GetType()); Console.WriteLine(b.GetType()); } } } Output System.Single System.Double System.Single System.Double
Discussion. The Single and Double types are floating-point number representations. They are precisely equivalent to the float and double types. It is more conventional for C-style language programmers to use float than Single.
Tip: Code written with float is less likely to confuse other programmers who might then introduce bugs.
Summary. This article doesn't provide useful examples for Single or Double, but just demonstrates that these types are precisely equivalent to the float and double types. This is aliasing. One type is aliased to another at the language level.