简体   繁体   English

在C ++中,用于引用32位浮点值的关键字是什么?

[英]In C++, what is the keyword used to refer to a 32-bit floating point value?

在C ++中,用于引用32位浮点值的关键字是什么?:

float

这几乎总是32b IEEE浮点数

float 浮动

here's an example: 这是一个例子:

float var = 0.0f;

Notice the lowercase f to indicate the literal should be interpreted as a 32-bit floating point number. 请注意小写f表示文字应解释为32位浮点数。

float - 32 bits
double - 64 bits

Currently, the IEEE-754 32-bit floating point is represented by the keyword float . 目前,IEEE-754 32位浮点由关键字float表示。

float myVar = 0.8;
myVar = 4.0f;

For 64-bit floating point values, there's double : 对于64位浮点值,有double

double myVar = 0.8;
myVar = 4.0f;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM