Problem

What are the maximum and minimum values of native numeric types?

Solution

A: Those actually depend on the architecure.

The maxMin.cpp is a small program which prints the max and min values of every relevant C++ and CORBA numeric type. You'll need the maxMin.pro Qt-Project file, too.

Compile it using this command line (make sure /alma/ACS-current points to the currently used ACS-X.Y version or check the .pro file and change it accordingly!):

     qmake
     make

and attach the output here below if it is for an architecture not already listed.

RHEL 4.4 on Intel Pentium M, x86 architecture, GCC 3.4.6

bool: min = 0, max = 1.
unsigned char: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
char: min = �, max = . (I cannot explain why no value is printed here. I am investigating this.)
unsigned short: min = 0, max = 65535.
short: min = -32768, max = 32767.
unsigned int: min = 0, max = 4294967295.
int: min = -2147483648, max = 2147483647.
unsigned long: min = 0, max = 4294967295.
long: min = -2147483648, max = 2147483647.
unsigned long long: min = 0, max = 18446744073709551615.
long long: min = -9223372036854775808, max = 9223372036854775807.
float: min = 1.17549e-38, max = 3.40282e+38.
double: min = 2.22507e-308, max = 1.79769e+308.
long double: min = 3.3621e-4932, max = 1.18973e+4932.
CORBA::Boolean: min = 0, max = 1.
CORBA::Octet: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
CORBA::Char: min = �, max = . (I cannot explain why no value is printed here. I am investigating this.)
CORBA::WChar: min = -2147483648, max = 2147483647.
CORBA::UShort: min = 0, max = 65535.
CORBA::Short: min = -32768, max = 32767.
CORBA::ULong: min = 0, max = 4294967295.
CORBA::Long: min = -2147483648, max = 2147483647.
CORBA::ULongLong: min = 0, max = 18446744073709551615.
CORBA::LongLong: min = -9223372036854775808, max = 9223372036854775807.
CORBA::Float: min = 1.17549e-38, max = 3.40282e+38.
CORBA::Double: min = 2.22507e-308, max = 1.79769e+308.

Gentoo 2007.0 on Freescale 7447A (G4), PowerPC architecture, GCC 4.1.2

bool: min = 0, max = 1.
unsigned char: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
char: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
unsigned short: min = 0, max = 65535.
short: min = -32768, max = 32767.
unsigned int: min = 0, max = 4294967295.
int: min = -2147483648, max = 2147483647.
unsigned long: min = 0, max = 4294967295.
long: min = -2147483648, max = 2147483647.
unsigned long long: min = 0, max = 18446744073709551615.
long long: min = -9223372036854775808, max = 9223372036854775807.
float: min = 1.17549e-38, max = 3.40282e+38.
double: min = 2.22507e-308, max = 1.79769e+308.
long double: min = 2.22507e-308, max = 1.79769e+308.
CORBA::Boolean: min = 0, max = 1.
CORBA::Octet: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
CORBA::Char: min = , max = �. (I cannot explain why no value is printed here. I am investigating this.)
CORBA::WChar: min = -2147483648, max = 2147483647.
CORBA::UShort: min = 0, max = 65535.
CORBA::Short: min = -32768, max = 32767.
CORBA::ULong: min = 0, max = 4294967295.
CORBA::Long: min = -2147483648, max = 2147483647.
CORBA::ULongLong: min = 0, max = 18446744073709551615.
CORBA::LongLong: min = -9223372036854775808, max = 9223372036854775807.
CORBA::Float: min = 1.17549e-38, max = 3.40282e+38.
CORBA::Double: min = 2.22507e-308, max = 1.79769e+308.

-- ThomasJuerges - 18 Aug 2008