GDB 能否正确解析 C 风格的十六进制浮点数?

Can GDB correctly parse C-style hexadecimal floating-point numbers?

我无法使 GDB 正确打印一些 C 风格的十六进制浮点数,请参阅:

GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb) p 0xa.0p-4
 = 6

这里 </code> 应该是 <code>0.625 但我的 GDB 似乎将 0xa.0p 视为十进制 10 并随后用 -4 进行加法。 我要求 GDB 打印的内容有什么问题? 我找不到任何关于 GDB 如何处理十六进制浮点数的相关文档。

What is wrong with what I ask GDB to print?

显然这是 gdb 的一个错误。

带负指数的十六进制浮点常量在 gdb 中给出了错误的结果。

我在 Linux 上尝试使用最新的源代码版本 gdb 7.9(2015 年 2 月 20 日),并且支持具有正指数的十六进制浮点常量:

(gdb) p/f 0x00.1p0
 = 0.0625
(gdb) p/f 0x00.1p1
 = 0.125

但是如果指数是负数,那么结果是错误的:

(gdb) p/f 0x00.1p-1
 = -0.9375

正确的预期结果是 0.031250