当我在VS2015中处理代码时,我得到了不同的输出.有什么解释吗
I get different output when I process the code in VS2015. Is there any explanation?
下面显示的代码就是在这里获得的。但产出有些不同。
#include <iostream>
#include <limits>
using namespace std;
int main()
{
cout << "The quiet NaN for type float is: "
<< numeric_limits<float>::quiet_NaN()
<< endl;
cout << "The quiet NaN for type int is: "
<< numeric_limits<int>::quiet_NaN()
<< endl;
cout << "The quiet NaN for type long double is: "
<< numeric_limits<long double>::quiet_NaN()
<< endl;
}
这是我的VS2015:中的打印输出
The quiet Nan for type float is : nan
The quiet Nan for type int is : 0
The quiet Nan for type long double is : nan
MSDN文章中的输出应该是:
The quiet NaN for type float is: 1.#QNAN
The quiet NaN for type int is: 0
The quiet NaN for type long double is: 1.#QNAN
这与该博客条目上显示的表中的值一致。
VS为这些特殊的IEEE浮点值使用的sentinel字符串的更改列在"Visual C++更改历史2003-2015"中的"无限和NaN格式"下https://msdn.microsoft.com/en-us/library/bb531344.aspx
然而,他们似乎错过了在一些VS2015文档中更新它,例如。https://msdn.microsoft.com/library/9e817177-0e91-48e6-b680-0531c4b26625.aspx;我已经提交了一份更正,让他们知道这不太正确。
相关文章:
- 没有输出的合并排序我做错了什么?
- 什么是现实中的"endl"(或任何输出操纵器)?它是如何实现的,它如何与操作员<<一起工
- 为对象分配整数.输出将是什么?
- 以下与指针相关的代码的输出是什么?
- Omnet++中的.vec和.sca输出有什么区别?
- 流中的输入位置和输出位置有什么区别?
- 数组为此合并排序函数提供了正确的输出,但向量给出了不正确的输出.出了什么问题?
- 从 c++ 中的实例化进程获取输出的可靠方法是什么?
- 我的输出结果是 0 英寸C++.可能是什么问题
- 使输出流式处理运算符适用于 boost::variant<std::vector<int>、int、double 的正确方法是什么>
- 使用OpenMP获得完整、无损坏的输出需要什么
- 代码输出随机符号,我不确定出了什么问题
- 以下程序在 c++ 中的输出是什么?
- 堆排序,我无法弄清楚我的代码出了什么问题,输出顺序不正确
- 任何人都解释下面的代码,它的输出是什么?
- 当我打印字符串时,我不知道它是什么输出
- 为什么输出不同以及此代码中有什么错误
- 为C程序获取不同的输出?该程序应该输出什么
- 这段代码输出什么笑脸
- 在c++中,如果超出范围,将输出什么值