Skip to main content
gamedev.net
🔒 Locked

Max float

Started by Soul Jan 10, 2003 at 12:24 PM 3 replies 550+ views
Original Post
Soul
Soul
I''ve just been wondering what the max value for a float in VC is? Anybody know? thanks in advance
luxitan
luxitan
Data Type Ranges
C/C++ recognizes the types shown in the table below.

Type Name Bytes Other Names Range of Values
int * signed,
signed int System dependent
unsigned int * unsigned System dependent
__int8 1 char,
signed char –128 to 127
__int16 2 short,
short int,
signed short int –32,768 to 32,767
__int32 4 signed,
signed int –2,147,483,648 to 2,147,483,647
__int64 8 none –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
char 1 signed char –128 to 127
unsigned char 1 none 0 to 255
short 2 short int,
signed short int –32,768 to 32,767
unsigned short 2 unsigned short int 0 to 65,535
long 4 long int,
signed long int –2,147,483,648 to 2,147,483,647
unsigned long 4 unsigned long int 0 to 4,294,967,295
enum * none Same as int
float 4 none 3.4E +/- 38 (7 digits)
double 8 none 1.7E +/- 308 (15 digits)
long double 10 none 1.2E +/- 4932 (19 digits)



luxitan
To be considered a genius you just have to say what everybody knows in a way very few understand
Qw3r7yU10p!
Qw3r7yU10p!
do you have access to the internet?

you can use


  
#include <limits>
int iMax = numeric_limits<int>::max();
double dMax = numeric_limits<double>::max();
float fMax = numeric_limits<float>::max();


to get the maximum value. As you can see from the link there are all kinds of other useful information you can get about types.
Miserable
Miserable
quote:
Original post by luxitan
Data Type Ranges
C/C++ recognizes the types shown in the table below.

[...]
double 8 none 1.7E +/- 308 (15 digits)
long double 10 none 1.2E +/- 4932 (19 digits)



quote:
From the MSDN docs provided with MSVC++ 6.0
Previous 16-bit versions of Microsoft C/C++ and Microsoft Visual C++ supported the long double, 80-bit precision data type. In Win32 programming, however, the long double data type maps to the double, 64-bit precision data type. The Microsoft run-time library provides long double versions of the math functions only for backward compatibility. The long double function prototypes are identical to the prototypes for their double counterparts, except that the long double data type replaces the double data type. The long double versions of these functions should not be used in new code.


Incidentally, this same documentation provides information on constants such as FLT_MAX which will give you all the information you need, for all the built-in data types ...
Soul
Soul
Thanks, that''s all I need

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.