Latest LQ Deal: Latest LQ Deals
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 07-16-2004, 04:56 PM   #1
Registered: Aug 2002
Location: tennessee
Distribution: gentoo
Posts: 39

Rep: Reputation: 15

I have a C program which uses the math library (gcc ... -lm), and I can
run ddd on it fine, EXCEPT that inorder to debug, I would like to
evaluate expressions which contain math functions (like exp, log, etc.)
and there is the problem; gdb refuses to properly evaluate math functions:

(gdb) print exp(12.234)
$21 = 1

What magic is required in order that gdb will evaluate math expressions?

NOTE: I do not want to step through the math functions, I just want gdb
to print their correct value!!!
Old 07-17-2004, 11:08 PM   #2
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
print printf("%f\n",exp(12.234))


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
gdb sabeel Programming 2 03-26-2007 07:58 PM
normal gdb and spec gdb for kgdb Igor007 Programming 1 09-23-2005 04:15 PM
normal gdb and spec gdb for kgdb Igor007 Linux - Newbie 1 09-23-2005 01:41 PM
gdb .. looking for 32 bit gdb.. for ia64 suse.. nkshirsagar SUSE / openSUSE 0 12-09-2004 03:02 AM
How to use GDB ? indian Programming 4 09-06-2004 05:11 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:44 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration