Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Peter Jay Salzman <p@dirac.org>
To: Gdb Mailing List <gdb@sources.redhat.com>
Subject: another conditional breakpoint question
Date: Fri, 20 Sep 2002 13:13:00 -0000	[thread overview]
Message-ID: <20020920201304.GA29419@dirac.org> (raw)

in the program:

   #include <math.h>
   int main(void)
   {
        double i = 0.0;
        double j = cos(i);
        return 0;
   }

i set a breakpoint which should never be reached:

p@satan% gdb mymath
(gdb) break main if cos(0.0) > 1000.0
Breakpoint 1 at 0x8048426: file mymath.c, line 5.

(gdb) run
Breakpoint 1, main () at mymath.c:5
5               double i = 0.0;

considering that cosine should be greater than 1 for a real variable,
this is quite strange!


i don't know if this is related, but i notice that cos(0) doesn't have a
value of 1.0.  not even close:

   (gdb) p cos(0)
   $3 = 14368

but just in case gdb doesn't know that cos() returns a double, i also
tried:

   (gdb) p/f cos(0.0)
   $1 = 2.00890148e-41

neither of these are even close to being right.


can someone tell me why gdb is reaching that breakpoint which should
never be reaced?  and is there any way of getting gdb to tell me that
cos(0) is supposed to be equal to 1?   :*)

thanks!
pete

-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D


             reply	other threads:[~2002-09-20 20:13 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-20 13:13 Peter Jay Salzman [this message]
2002-09-20 15:04 ` Daniel Jacobowitz
2002-09-20 15:36   ` Peter Jay Salzman
2002-09-20 16:16     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20020920201304.GA29419@dirac.org \
    --to=p@dirac.org \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox