cplusplus
.com
TUTORIALS
REFERENCE
ARTICLES
FORUM
C++
Tutorials
Reference
Articles
Forum
Forum
Beginners
Windows Programming
UNIX/Linux Programming
General C++ Programming
Lounge
Jobs
Forum
General C++ Programming
float, double
float, double
Oct 7, 2015 at 12:36am UTC
technologist
(607)
for the number "3"
are floats always denoted by 3.0 (plus) f .... = 3.0f
are doubles always denoted by a single zero to the right of the decimal? 3.0
Without looking at the type can I assume from how its written (3.0 vs 3.0f) which is double and which is float -- is the added f always the case?
Oct 7, 2015 at 1:25am UTC
JLBorges
(13770)
The type of a floating literal is
double
unless explicitly specified by a suffix.
The suffixes
f
and
F
specify
float
, the suffixes
l
and
L
specify
long double
. - IS
Topic archived. No new replies allowed.