社区
C++ 语言
帖子详情
菜鸟看程序,请问定义std::numeric_limits
::quiet_NaN()这个做什么?
xinyao06
2010-09-01 09:18:38
std::numeric_limits<float>::quiet_NaN()
这个的值输出来是 -1.#IND??这有什么意义啊?
...全文
1586
2
打赏
收藏
菜鸟看程序,请问定义std::numeric_limits<float>::quiet_NaN()这个做什么?
std::numeric_limits::quiet_NaN() 这个的值输出来是 -1.#IND??这有什么意义啊?
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
thehunters
2010-09-01
打赏
举报
回复
not a number,
就是判断这个类型是否有小数点,1有,0无,所以std::numeric_limits<int>::quiet_NaN()是0
其实float
是这样表示的
struct float
{
float f;
unsigned int negative:1;
unsigned int exponent:8;
unsigned int quiet_nan:1;
unsigned int mantissa:22;
}
Kinglin_sky
2010-09-01
打赏
举报
回复
这是一个函数。 作用:Returns the representation of a quiet not a number (NAN) for the type
Go语言官方文档学习笔记(第三季)
Go富有表现力,简洁,整洁且高效。它的并发机制使编写
程序
可以轻松地从多核和联网机器中获得最大收益,而其新颖的类型系统则可以实现灵活的模块化
程序
构造。Go可以快速编译为机器代码,但具有垃圾回收的便利性和运行时反射的功能。它是一种快速的,静态类型的编译语言,感觉就像是一种动态类型的解释语言。Go语言官方文档学习笔记是基于官方文档及个人学习Go的笔记,整理完成的Go语言快速入门课程。 第三季内容包括以下十个部分:1-Short variable declarations2-Basic types3-Zero values4-Type conversions5-Type inference6-Constants7-
Numeric
Constants8-For9-For continued10-For is Go's while
C++
std
::
numeric
_
limit
s<T>::max(),min()及lowest()
@[TOC](C++
std
::
numeric
_
limit
s::max(),min()及lowest())
std
::
numeric
_
limit
s<T>::max(),min()及lowest() 根據
std
::
numeric
_
limit
s,如果T屬於浮點數,則:
std
::
numeric
_
limit
s<T>::max()回傳該型別的最大值
std
::
numeric
_li...
C++:
numeric
_
limit
s<T>::max() (用法举例)
概念: 基本格式:
std
::
numeric
_
limit
s<T>::max()——其中max()可替换为min()及lowest();T表示数据类型;
std
::
numeric
_
limit
s<T>::max()——返回数据类型T的最大值;
std
::
numeric
_
limit
s<T>::min()——返回数据类型T的"最小正数";
std
::
numeric
_
limit
s<T>::lowest()——返回数据类型T的最小值(为负数或0); 用法举例:
C++/C++11中
std
::
numeric
_
limit
s的使用
C++/C++11中
std
::
numeric
_
limit
s的使用
【C++】
std
::
numeric
_
limit
s 类型对应最值查询
1.
std
::
numeric
_
limit
s 类型对应最值查询 C++ 工具库 类型支持
std
::
numeric
_
limit
s
定义
于头文件 template< class T > class
numeric
_
limit
s;
numeric
_
limit
s 类模板提供查询各种算术类型属性的标准化方式(例如 int 类型的最大可能值是
std
::
numeric
_
limit
s::max() )。 通过
numeric
_
limit
s 模板的特化提供此信息。标准库为所有算术类型制定可用的特化:
定义
于
C++ 语言
64,636
社区成员
250,540
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章