Showing results for

- Intel Community
- Software
- Software Development Tools (Compilers, Debuggers, Profilers & Analyzers)
- Intel® C++ Compiler
- Simple Q for INFINITY and other numerical constants in C/C++/Fortran code

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

drMikeT

New Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-18-2011
09:40 AM

63 Views

Simple Q for INFINITY and other numerical constants in C/C++/Fortran code

Some code is checking for preprocessor contstat "INFINITY" and if unddefined it "sets" it as follows :

#ifdef INFINITY

const double inf = INFINITY;

#else

const double inf = 1.0 / 0.0;

#endif

However, when I compile with icc I get:

harminv-main.c(126): error: floating-point operation result is out of range

const double inf = 1.0 / 0.0;

^

Where are these numerical quantities defined or how can I go about properly producing them programmatically with Intel compilers?

thanks ....

Michael

Link Copied

2 Replies

TimP

Black Belt

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-18-2011
10:58 AM

63 Views

drMikeT

New Contributor I

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

02-18-2011
02:18 PM

63 Views

Quoting TimP (Intel)

Thanks Tim,

I couldn't see the '-std=c99' option in man page of icc. I tried and worked though.

thanks for the reply

Michael

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

For more complete information about compiler optimizations, see our Optimization Notice.