How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?(如何将 IEEE-11073 16 位 SFLOAT 转换为 Java 中的简单浮点数?)
问题描述
标题不言自明:如何将 IEEE-11073 16 位 SFLOAT 转换为 Java 中的简单浮点数?
The title speaks for itself: How to convert IEEE-11073 16-bit SFLOAT to simple float in Java?
推荐答案
你可以使用位移位.提取符号、指数和尾数并将它们移位,使它们为浮点格式.您可能需要更正 Infinity 和 NaN.
You can use bit shifting. extract the sign, exponent and mantissa and shift these so they are in float format. You may need to correct for Infinity and NaN.
正如@PretiP 的回答所指出的那样,指数以 10 为底,因此您需要乘以或除以 10 的幂才能得到最终值.
As @PretiP's answer points out the exponent is base 10 so you would need to multiply or divide by a power of 10 to get the final value.
这篇关于如何将 IEEE-11073 16 位 SFLOAT 转换为 Java 中的简单浮点数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何将 IEEE-11073 16 位 SFLOAT 转换为 Java 中的简单浮
基础教程推荐
- Struts2 URL 无法访问 2022-01-01
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 存储 20 位数字的数据类型 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
