Make your own free website on Tripod.com

MKoD - D Programming Language

D's Datatypes and Ranges

A list of D's Datatypes

D code to get the DataType Ranges - code-name ranges.d

Basic Newbie Stuff Run for yourself...:))

// -- ranges.d --
import std.stdio;

int main()
{
    writefln( "char.sizeof=%d  ( UTF-08 ) max=%d", char.sizeof,  0xFF );
    writefln( "wchar.sizeof=%d ( UTF-16 ) max=%d", wchar.sizeof, 0xFFFF );
    writefln( "dchar.sizeof=%d ( UTF-32 ) max=%d", dchar.sizeof, 0XFFFFFFFF );
    writefln( "\n" );
    writefln( "bit.min =%d,     bit.max =%d",     bit.min,     bit.max );
    writefln( "byte.min =%d,    byte.max =%d",    byte.min,    byte.max );
    writefln( "ubyte.min =%d,   ubyte.max =%d",   ubyte.min,   ubyte.max );
    writefln( "short.min =%d,   short.max =%d",   short.min,   short.max );
    writefln( "ushort.min =%d,  ushort.max =%d",  ushort.min,  ushort.max );
    writefln( "int.min =%d,     int.max =%d",     int.min,     int.max );
    writefln( "uint.min =%d,    uint.max =%d",    uint.min,    uint.max );
    writefln( "long.min =%d,    long.max =%d",    long.min,    long.max );
    writefln( "ulong.min =%d,   ulong.max =%d",   ulong.min,   ulong.max );
    writefln( "float.min =%E,   float.max =%E",   float.min,   float.max );
    writefln( "double.min =%E,  double.max =%E",  double.min,  double.max );
    writefln( "real.min =%E,    real.max =%E",    real.min,    real.max );
    writefln( "\n" );
    writefln( "ifloat.min =%E,  ifloat.max =%E",  ifloat.min,  ifloat.max );
    writefln( "idouble.min =%E, idouble.max =%E", idouble.min, idouble.max );
    writefln( "ireal.min =%E,   ireal.max =%E",   ireal.min,   ireal.max );
    writefln( "cfloat.min =%E,  cfloat.max =%E",  cfloat.min,  cfloat.max );
    writefln( "cdouble.min =%E, cdouble.max =%E", cdouble.min, cdouble.max );
    writefln( "creal.min =%E,   creal.max =%E",   creal.min,   creal.max );
   
    return 0;
    
} // end main()
C:\dmd\MKoD_ex>..\bin\dmd ranges.d
C:\dmd\bin\..\..\dm\bin\link.exe ranges,,,user32+kernel32/noi;

C:\dmd\MKoD_ex>ranges
char.sizeof=1  ( UTF-08 ) max=255
wchar.sizeof=2 ( UTF-16 ) max=65535
dchar.sizeof=4 ( UTF-32 ) max=4294967295

bit.min =0,     bit.max =1
byte.min =-128,    byte.max =127
ubyte.min =0,   ubyte.max =255
short.min =-32768,   short.max =32767
ushort.min =0,  ushort.max =65535
int.min =-2147483648,     int.max =2147483647
uint.min =0,    uint.max =4294967295
long.min =-9223372036854775808,    long.max =9223372036854775807
ulong.min =0,   ulong.max =18446744073709551615
float.min =1.175494E-38,   float.max =3.402823E+38
double.min =2.225074E-308,  double.max =1.797693E+308
real.min =3.362103E-4932,    real.max =1.189731E+4932

ifloat.min =1.175494E-38,  ifloat.max =3.402823E+38
idouble.min =2.225074E-308, idouble.max =1.797693E+308
ireal.min =3.362103E-4932,   ireal.max =1.189731E+4932
cfloat.min =1.175494E-38+1.175494E-38i,  cfloat.max =3.402823E+38+3.402823E+38i
cdouble.min =2.225074E-308+2.225074E-308i, cdouble.max =1.797693E+308+1.797693E+308i
creal.min =3.362103E-4932+3.362103E-4932i,   creal.max =1.189731E+4932+1.189731E+4932i

C:\dmd\MKoD_ex>
Mars: fourth Rock from the Sun.