“f” after number

后端 未结 10 756
醉酒成梦
醉酒成梦 2020-11-27 11:02

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?

CGRec         


        
10条回答
  •  孤城傲影
    2020-11-27 12:07

    The f that you are talking about is probably meant to tell the compiler that it's working with a float. When you omit the f, it is usually translated to a double.

    Both are floating point numbers, but a float uses less bits (thus smaller and less precise) than a double.

提交回复
热议问题