赞
踩


原文外网链接
IEEE754.PDF (berkeley.edu)
http://people.eecs.berkeley.edu/~wkahan/ieee754status/IEEE754.PDF
在线浮点数转换1

在线浮点数转换2

我们常用的编程语言例如C#其采用的float也是采用此标准。
stm32的keil编程也是采用此标准。
有时候我们需要判断一个数是否是无效的浮点数,
- union
-
- {
-
- uint32 uint32byte;
-
- fp32 fp32byte;
-
- }byte4;
-
- bool check(fp32 dt)
-
- {
-
-
- byte4 tmp;
-
- tmp.fp32byte = dt;
-
- return ((tmp.uint32byte & 0x7F800000) == 0x7F800000 );
-
- }

可以参考
或者参考
特此记录
anlog
2021年11月12日
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。