2.0和2.0F(显式浮动VS双面值)之间的差异 [英] Difference between 2.0 and 2.0f (explicit float vs double literals)

查看:218
本文介绍了2.0和2.0F(显式浮动VS双面值)之间的差异的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我遇到了一些问题,这会让˚F旁边的文字值。我知道它定义为一个浮动但我真的需要吗?
难道这 2.0F * 2.0F 任何更快或编译比有什么不同2.0 * 2.0 ?就像声明浮动= 2.0; 编译不同的浮动= 2.0F;

I had some questions about putting f next to literal values. I know it defines it as a float but do I really need it? Is this 2.0f * 2.0f any faster or compiled any different than 2.0 * 2.0? Is a statement like float a = 2.0; compiled differently than float a = 2.0f;?

推荐答案

我是很少左右的速度(至少直接地),但事实证明,否则编译器会发出警告转换双击浮动

I's rarely about speed (at least directly), but the fact that otherwise the compiler will warn about converting double to float.

这篇关于2.0和2.0F(显式浮动VS双面值)之间的差异的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆