hex2fp

版本 1.0.0 (2.2 KB) 作者: Olaf Bousche
Convert IEEE hexadecimal string to single or double precision numbers
5.0 次下载
更新时间 2024/1/15

查看许可证

HEX2FP is a modified version of the Mathworks HEX2NUM.
It converts hexadecimal representations of floating point numbers:
  • 8 character IEEE hexadecimal strings are converted to single precision numbers
  • 16 character IEEE hexadecimal strings are converted to double precision numbers
It is ALMOST compatible with HEX2num:
  • hex2fp('400921fb54442d18') returns pi.
  • hex2fp('bff') returns single(-1.875) but hex2num('bff') returns -1.
  • hex2fp('40490fdb') returns single(pi)
  • hex2fp('bf8') returns single(-1).
  • hex2fp('bff ') with more than 5 spaces returns -1.
There are other versions that handle single precision numbers but I needed maximum compatibility with hex2num and automatic switching between singles and doubles.

引用格式

Olaf Bousche (2024). hex2fp (https://www.mathworks.com/matlabcentral/fileexchange/157701-hex2fp), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2023b
兼容任何版本
平台兼容性
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0