http://sourceware.org/ml/gdb/2006-12/msg00172.html
«On Mon, 2006-12-18 at 21:55 -0800, Nikolay Molchanov wrote:
But if I ask "gdb" to evaluate sin(3.14) I get "1"
(which is not correct), and if I ask to evaluate
sin(4.1) or sin(5.1) I get "3" (?!).
I guess your system libraries aren't built with debuginfo. This means
that GDB won't know the sin function's prototype and it will interpret
the result as an int. There might also be other issues with passing
doubles to un-prototyped functions, but the previous point is sufficient
to explain your issue.»
«By default (without debuginfo as Frederic says) it assumes sin takes an
integer argument and returns an value (I think).
You need to cast sin explicitly:
(gdb)
-data-evaluate-expression "((double ((*) (double))) sin) (5.1)"
^done,value="-0.92581468232773245"
(gdb)
-data-evaluate-expression "((double ((*) (double))) sin) (4.1)"
^done,value="-0.81827711106441026"»