2
下記コードはhereです。しかし、出力は若干異なります。VS2015でコードを処理すると、出力が異なります。説明はありますか?
#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
this blog entryに示されている。
マイクロソフトは、MSDNの見積もりに記載されている奇妙なことを使用していました。しかし、C99は出力が示すものであるNaN値の出力を標準化しています。したがって、マイクロソフトが最終的にC標準に追いついたように見えます。 –
私の質問に答えてくれてありがとう。ありがとう。 – Mao
MS docの変更点はありますか? – rents