0

When unsigned/signed long int a; is possible why unsigned/signed long float/double a; is not possible ?

Why do I get too many types in declaration error for the latter and not for the former ?

supraja
  • 93
  • 2
  • 11

3 Answers3

1

There are three floating point types: float, double and long double. None of these have unsigned equivalents, so putting signed or unsigned in front of them is not valid. There is no such type as long float.

TartanLlama
  • 63,752
  • 13
  • 157
  • 193
1

You are getting that message because a long double exists, but an unsigned long double does not. unsigned can also be interpreted as an int, therefore you possess two types in the latter declaration: unsigned and long double. I do not believe there is a long float in C++.

kevr
  • 455
  • 4
  • 9
0

That is because the first (long int) is a documented variable type, while the second isn't.

The data types that the C++ language supports are:

char         
unsigned char   
signed char     
int            
unsigned int    
signed int  
short int 
unsigned short int 
signed short int
long int    
signed long int 
unsigned long int 
float   
double  
long double