Когда я спрашиваю GDB напечатать реальное в двоичной, я получаю это:Отображение представления с плавающей запятой IEEE 754 в GDB?
(gdb) p/t 5210887.5
$1 = 10011111000001100000111
Согласно this,
0 10010101 00111110000011000001111
ожидаемое значение.
выравнивая их,
1 0011111000001100000111
0 10010101 00111110000011000001111
И, похоже, GDB дает мне целое представление после округления. Дело в том, что это делалось с переменной на работе. Использование декларации в программе C -
main()
{
float f = 5210887.5;
}
и отладку -
$ gcc -g -O0 floatdec.c -o floatdec
$ gdb floatdec
GNU gdb (GDB) Red Hat Enterprise Linux (7.2-60.el6_4.1)
Copyright (C) 2010 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 "i686-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /home/ /floatdec...done.
(gdb) b main
Breakpoint 1 at 0x804839a: file floatdec.c, line 3.
(gdb) r
Starting program: /home/ /floatdec
Breakpoint 1, main() at floatdec.c:3
3 float f = 5210887.5;
(gdb) s
4 }
(gdb) p f
$1 = 5210887.5
(gdb) p/t f
$2 = 10011111000001100000111
то же самое, что показывает мне целое представление. Разве нет способа показать GDB формат с плавающей запятой?