🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #2116

Re: numeric_limits<float>::max

#2116
From: Jim Blandy
Date: Fri, 10 May 2002 16:55
55 lines
3058 bytes
This sounds like a real bug.  However, we really can't work on
something without a way to reproduce the behavior ourselves.  So if
you do come up with a small test program, at the very least we'll
included it in our test suite, to remind us that the bug is there.

Gabriel Zachmann <zach@cs.uni-bonn.de> writes:

> I have a funny problem with gdb (GNU gdb Red Hat Linux (5.1-1)):
> 
> In a C++ program I have the following two lines:
> 
>     float v = -numeric_limits<float>::max();
>     fprintf(stderr,"v=%f\n", v );
> 
> When I run the program I always get the output
> 
>     v=-340282346638528859811704183484516925440.000000
> 
> However, when I run the program in gdb I sometimes get this
> 
>     375     float v = -numeric_limits<float>::max();
>     (gdb) 
>     376     fprintf(stderr,"v=%f\n", v );
>     (gdb) 
>     v=nan
> 
>       ^^^
> 
> Unfortunately, I seem to be unable to produce a small example program
> exhibiting this behavior.
> 
> I compile the program with g++ 3.0.4 using these options:
> 
>     -march=i686 -ansi -fno-default-inline -ffor-scope
>     -g3 -ggdb3 -Wall -W -Wpointer-arith
>     -Wcast-qual -Wcast-align -Wconversion -Woverloaded-virtual -Wsign-compare
>     -Wnon-virtual-dtor -Woverloaded-virtual -Wfloat-equal -Wmissing-prototypes
>     -Wunreachable-code -Wno-reorder -D_GNU_SOURCE 
> 
> Does anybody have any idea what might cause this differing behavior?
> 
> Thanks a lot in advance,
> Gabriel.
> 
> 
> -- 
> /---------------------------------------------------------------------\
> | The mind -- what is it?                                             |
> | It is the sound of the breeze                                       |
> | Blowing through the pines in the picture.        (Ikkyu)            |
> |                                                                     |
> | zach@cs.uni-bonn.de                 __@/'  Gabriel.Zachmann@gmx.net |
> | web.informatik.uni-bonn.de/~zach    __@/'   www.gabrielzachmann.org |
> \---------------------------------------------------------------------/
Technical Details
Message-ID: <np3cx06iy3.fsf@zwingli.cygnus.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
References: <slrnadnki9.6qe.zach@fuji.informatik.uni-bonn.de>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f5053,928e9af52e3d56e8
X-Google-Attributes: gidf5053,public
X-Google-ArrivalTime: 2002-05-10 09:55:59 PST
x-uunet-gateway: mr1.ash.ops.us.uu.net from bug-gdb to gnu.gdb.bug; Fri, 10 May 2002 16:55:57 GMT
Sender: jimb@zwingli.cygnus.com
Subject: Re: numeric_limits<float>::max
References: <slrnadnki9.6qe.zach@fuji.informatik.uni-bonn.de>
From: jimb@redhat.com (Jim Blandy)
Date: 10 May 2002 11:55:48 -0500
Message-ID: <np3cx06iy3.fsf@zwingli.cygnus.com>
User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Approved: bug-gdb-request@mail.gnu.org
Newsgroups: gnu.gdb.bug
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!cpk-news-hub1.bbnplanet.com!news.gtei.net!nntp.abs.net!uunet!dca.uu.net!ash.uu.net!spool0901.news.uu.net!wendy-fate.uu.net!bug-gdb
Lines: 55