Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

diff between a float and a double

Status
Not open for further replies.

maxpower1

Programmer
Jul 29, 2001
488
US
how can you tell a float from a double beside the ranges. For instance,

1.0 is a double
-345 is an integer(hence fits in a float var )
42e7 is a double??

2.81F is a float.
2.80f is a float.
3.14 is a double
3.14f is a float

thanks

 
All floating-point literals are assumed to be of type double, so 42e7 is a double.
Primitive assignment conversion:
1. A non-boolean may be converted to another non-boolean type, provided the conversion is a widening conversion.
2. A non-boolean may not converted to another non-boolean type, if the conversion would be a narrowing conversion.

Therefore
float i = 345; --> integer 345 is converted to a float

*** try this link for detailed explanation
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top