問題タブ [numeric-limits]
For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.
c++ - numeric_limits の値::max() C++ で
C ++で使用cin.ignore()
している間、区切り文字が発生するまでに消費する文字数の引数を取ります。ほとんどの場合、次のものが使用されていることを確認しましたcin.ignore(numeric_limits<streamsize>::max(), '\n');
の値を知りたいと思ったnumeric_limtis<streamsize>::max()
ので、その値を出力したところ、 9223372036854775807 という巨大な値になりました。文字数ならバイト数と考えていいし、そうだとすると私のHDDの容量を超えた非常に大きな値ではないでしょうか。
誰かがそれが実際に何であり、なぜそんなに大きな値なのか教えてもらえますか?
c++ - 浮動小数点型への参照で max_digits10 が 0 であることの利点は何ですか?
C++11 では、浮動小数点数への参照であるstd::numeric_limits<Type>::max_digits10
a に対して 0 を返す利点は何ですか?Type
例えば:
はprecisionPositive
9 をprecisionZero
返し、0 を返します。
コンパイル時にエラーが発生するのではなく、ゼロの値が役立つのはどのような状況ですか?