gdb does not print sqrt(-1.0) as NaN -


this question has answer here:

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

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -