Is there any performance difference using CGFloat with or without postfix.f in Objective-C

Should I write CGFloat values ​​with postfix for not?

CGFloat fValue = 1.2;

against.

CGFloat fValue = 1.2f;

I know this postfix defines a float value. But is it necessary, does it make sense, are there differences in performance between the two, or is it just a visual representation so that you can quickly determine the type of value (for example, float in this case)?

+5
source share
2 answers

1.2 is double; i.e. a 64-bit double-precision floating-point number.

1.2f is a float; i.e. a 32-bit single-precision floating-point number.

, float double double float . , , , .

+6

:

1,0 1.

1.0f -

​​ (123.0) .

, () . f , , .

0

All Articles