This is the mail archive of the gdb@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Quick question about "print EXPR"


I read in the docs that "print EXPR" should work with function calls.

Why is it that no matter what argument I pass to "print floor(234.567)", I always get an answer of
"1"?

...
7               yada = 2.5;
(gdb) n
8               haha = floor(yada);
(gdb) 
9               printf("%0.1f %0.1f\n",yada, haha);
(gdb) p yada
$1 = 2.5
(gdb) p haha
$2 = 2
(gdb) p floor(yada)
$3 = 1
(gdb) l
4       int main(int argc, char *argv[]) {
5               double yada;
6               double haha;
7               yada = 2.5;
8               haha = floor(yada);
9               printf("%0.1f %0.1f\n",yada, haha);
10              return 0;
11      }
...


Thanks-
-Brian.



		
__________________________________ 
Do you Yahoo!? 
Read only the mail you want - Yahoo! Mail SpamGuard. 
http://promotions.yahoo.com/new_mail 


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]