Oct 22, '04 10:14:00AM • Contributed by: EatingPie
% gdb
...
(gdb) p 3.141579 * 2
$1 = 6.2831580000000002
(gdb) q
The p character stands for "print," meaning print the results of the equation. Okay, so maybe the amount of precision is overkill, but it's better than no precision at all! You can also use previous results in further equations. See that rather archaic $1 in the result there? Well, in a different
equation (in the same gdb session, of course), you can type that $1, and it will substitute the calculated value. For example:
% gdb
...
(gdb) p 3.141579 * 2
$1 = 6.2831580000000002
(gdb) p $1 / 2
$2 = 3.1415790000000001
(gdb) q
You can also use $2 as result in another equation ... and so on. Note that a
similar hint was provided using Applescript.
