Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > INFINITY on gcc 3.3

Reply
Thread Tools

INFINITY on gcc 3.3

 
 
Amit
Guest
Posts: n/a
 
      08-18-2005
Hi,
I am trying to use INFINITY in a c++ code that I have written. I am
using gcc 3.3 on os X 10.3.9
The compiler gives a warning

warning: floating constant exceeds range of "float"

My code uses the following where this error is given:
double c = INFINITY;

I use the following to compile my code:

g++ -c -pg -O -Wno-deprecated -ansi -pedantic -DANSI_HEADERS
-D_G_HAVE_BOOL test.C -I.

How can I resolve this problem? I used this same code in an older
version of gcc(probably 3.1 on RH 9) and it worked fine there..

thanks,
--A.

 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?Stefan_N=E4we?=
Guest
Posts: n/a
 
      08-18-2005
Amit wrote:
> Hi,
> I am trying to use INFINITY in a c++ code that I have written. I am
> using gcc 3.3 on os X 10.3.9
> The compiler gives a warning
>
> warning: floating constant exceeds range of "float"
>
> My code uses the following where this error is given:
> double c = INFINITY;
>
> I use the following to compile my code:
>
> g++ -c -pg -O -Wno-deprecated -ansi -pedantic -DANSI_HEADERS
> -D_G_HAVE_BOOL test.C -I.
>
> How can I resolve this problem? I used this same code in an older
> version of gcc(probably 3.1 on RH 9) and it worked fine there..
>
> thanks,
> --A.
>


Where does INFINITY come from and how is it defined ?

You could try this:

<code>

#include <limits>
....
double c = std::numeric_limits<double>::infinity();

</code>

Stefan
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Infinity + Infinity (or NegInfinity - NegInfinity) Skybuck Flying C Programming 40 01-25-2012 12:25 AM
Infinity and -Infinity Jon A. Lambert Ruby 3 11-06-2005 04:46 AM
Template construction in old gcc 3.3.3 does not compile in gcc 3.4.4 eknecronzontas@yahoo.com C++ 5 09-17-2005 12:27 AM
gcc 2.95 and gcc 3.2 gouqizi.lvcha@gmail.com C++ 8 03-16-2005 02:34 AM
C99 structure initialization in gcc-2.95.3 vs gcc-3.3.1 Kevin P. Fleming C Programming 2 11-06-2003 05:15 AM



Advertisments