C 和 C++ 中双浮点值的表示法 [英] Notation of double floating point values in C and C++

查看:87
本文介绍了C 和 C++ 中双浮点值的表示法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

C/C++ 中双精度浮点值的表示法是什么?

What's the notation for double precision floating point values in C/C++?

.5 表示双精度值还是浮点值?

.5 is representing a double or a float value?

我很确定 2.0f 被解析为浮点数,2.0 被解析为双精度数,但 .5 呢?

I'm pretty sure 2.0f is parsed as a float and 2.0 as a double but what about .5?

http://c.comsci.us/etymology/literals.html

推荐答案

这是双重的.后缀 f 以获得浮动.

It's double. Suffix it with f to get float.

这里是参考文档的链接:http://en.cppreference.com/w/cpp/language/floating_literal

And here is the link to reference document: http://en.cppreference.com/w/cpp/language/floating_literal

这篇关于C 和 C++ 中双浮点值的表示法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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