CGfloat 和 float的问题,应该是精度问题

//测试代码,测试CGfloat 和 float的区别
CGFloat aaa = 123.55512;
float bbb = 123.55512;
NSLog(@"\n %f \n %f",aaa,bbb);
NSString *str28 = @"123.55512";
float str30 =[str28 floatValue];
CGFloat str29 =[str28 floatValue];
NSLog(@"\n %f \n %f",str29,str30);

            输出:
015-11-05 20:09:13.547 Character[2242:143660] 

123.555120
123.555122
2015-11-05 20:09:13.548 Character[2242:143660]
123.555122
123.555122

查看全部
s_h_q
s_h_q
2015/11/05 12:16
  • cgfloat
  • oc
  • 精度
  • float
  • 点赞
  • 收藏
  • 回答
    私信

0个回复