Flags to determine the type of a number (int, float, double)

Hi,
I am looking for a reference that describes the employed flags to convert manual numbers in some specific type, e.g. 2.D should be the number 2 cosidered as a double?

thanks
_ Dean
Maybe you're looking for casting. Do you want to convert an unknown type to another specific type? For example, if you have an integer, int a = 5; and want to divide it by 2, but want a float, you can do:
1
2
int a = 5;
float myFloat = static_cast<float>(a) / 2;


Casting in this situation changes from int/int division to float/int division which returns a float.
Last edited on
closed account (o3hC5Di1)
Hi,

I think what you mean is mentioned here:

http://msdn.microsoft.com/en-us/library/w9bk1wcy.aspx

msdn wrote:
A floating-point constant without an f, F, l, or L suffix has type double. If the letter f or F is the suffix, the constant has type float. If suffixed by the letter l or L, it has type long double


To convert a constant float to a double manually, you could use static_cast as explained by Volatile Pulse.

Hope that helps.

All the best,
NwN
Topic archived. No new replies allowed.