Linked Questions

107 votes
10 answers
81k views

What does the f after the numbers indicate? Is this from C or Objective-C? Is there any difference in not adding this to a constant number? CGRect frame = CGRectMake(0.0f, 0.0f, 320.0f, 50.0f); Can ...
typeoneerror's user avatar
  • 57.2k
102 votes
9 answers
130k views

I don't know why f or F is placed after float values in Java or other languages? for instance, float fVariable = 12.3f; any features other than indicating that this is a float value?
ipkiss's user avatar
  • 13.7k
86 votes
9 answers
10k views

If I have the following declaration: float a = 3.0 ; is that an error? I read in a book that 3.0 is a double value and that I have to specify it as float a = 3.0f. Is it so?
TESLA____'s user avatar
  • 1,019
87 votes
7 answers
89k views

I am wondering what the difference is between these two variables in C: float price = 3.00; and float price = 3.00f; What is the use of suffix f in this case?
Alex's user avatar
  • 967
4 votes
6 answers
3k views

I ask because I am using the Box2D library, which calls for mostly float arguments. Although I see a lot of example code that uses the 0.00f format, I am not quite sure if there is an actual ...
Noi Sek's user avatar
  • 552
6 votes
5 answers
687 views

What is the difference between the 2 following code lines? #define F_SAMP 10000.0f #define F_SAMP 10000.0 Aren't both float? (By the way, in this particular case compiler is XC16 but I do not think ...
Guille's user avatar
  • 472
5 votes
3 answers
875 views

Can there be a difference in bit-representation between a direct assignment of a floating point literal float x = 3.2f; and a double implicitly converted to a float float x2 = 3.2;? I.e. is #define ...
Jan15's user avatar
  • 569
4 votes
4 answers
605 views

I understand that the floating points are represented in memory using sign, exponent and mantissa form which have limited number of bits to represent each part and hence this leads to rounding errors. ...
TestUser's user avatar
  • 977
-2 votes
3 answers
4k views

How to define a double constant in C ? For float is like so: #define powerFactor 1.00f For double i dont know: #define energy 55639.00xx Should xx be d, ld, lf, nothing or compiler specific?
baldhead's user avatar
2 votes
2 answers
2k views

I know that according to the single point standard IEEE the maximum value of a float is 1.11111111111111111111111 *2^127 which converted in decimal is exactly this huge number -> ...
user avatar
10 votes
2 answers
350 views

Look at this snippet: int main() { double v = 1.1; return v == 1.1; } On 32-bit compilations, this program returns 0, if -fexcess-precision=standard is specified. Without it, the program ...
geza's user avatar
  • 30.5k
4 votes
2 answers
628 views

I have to code C for my college exams and I have practice of declaring double variables instead of float variables. Is it a bad habit? Can they deduct marks for it? (we never exceed the float limit) I ...
Kasun's user avatar
  • 51
2 votes
2 answers
165 views

I was just beginning out with C (K.N king's C Programming) when I came across the following passage: By default, floating constants are stored as double-precision numbers. In other words, when a C ...
Shridp's user avatar
  • 35
-1 votes
2 answers
581 views

I wanted to see the difference in how many digits i get when using float and when using double but i get the same results #include <stdio.h> int main() { float x=1.2222222222222222f; ...
Foch29's user avatar
  • 15
2 votes
2 answers
452 views

So I don't really get the conversion from a float to a double e.g: float wow = 1.123562641346; float wow = 1.123562641346f; The first one is a double that gets saved in a variable that has memory ...
kenshieva's user avatar
  • 101

15 30 50 per page