gdb does not print sqrt(-1.0) as NaN -
this question has answer here:
- why gdb evaluate sqrt(3) 0? 6 answers
i checked if sqrt(-1.0) returns nan (http://en.cppreference.com/w/c/numeric/math/sqrt). in gdb, not return nan
(gdb) p/x sqrt(-1.0) $10 = 0xe53a86a0 (gdb) p sqrt(-1.0) $11 = -449149280
does gdb call different sqrt? use gdb 7.6
it looks gdb not have access suitable debugging information. result, assumes sqrt
function returns int
:
(gdb) ptype sqrt type = int ()
you can use cast tell gdb correct type:
(gdb) print ((double (*)(double))sqrt)(2) $1 = 1.4142135623730951
or load suitable debugging information.
Comments
Post a Comment