Floating point ranges : float Point Number « Data Type « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;
using System.Security.Cryptography;

public class MainClass
{
    public static void Main()
    {
        Console.WriteLine("{0}: bytes: {1}, range: [{2},{3}]",
            typeof(float).ToString(), sizeof(float), float.MinValue, float.MaxValue);
        Console.WriteLine("{0}: bytes: {1}, range: [{2},{3}]",
            typeof(double).ToString(), sizeof(double), double.MinValue, double.MaxValue);
        Console.WriteLine("{0}: bytes: {1}, range: [{2},{3}]",
            typeof(decimal).ToString(), sizeof(decimal), decimal.MinValue, decimal.MaxValue);
    }

}
System.Single: bytes: 4, range: [-3.402823E+38,3.402823E+38]
System.Double: bytes: 8, range: [-1.79769313486232E+308,1.79769313486232E+308]
System.Decimal: bytes: 16, range: [-79228162514264337593543950335,79228162514264337593543950335]








2.22.float Point Number
2.22.1.Floating-Point Types
2.22.2.The Methods and Fields Supported by Single
2.22.3.The Methods and Fields Supported by Double
2.22.4.float point value literal: 3.281f and 5E-02
2.22.5.Floating point ranges
2.22.6.Unexpected Inequality Due to Floating-Point Inaccuracies