473,237 Members | 1,131 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,237 software developers and data experts.

std::numeric_limits<double>::infinity() returns 0.0 on Intel/Linux g++ 3.2.3

Does anyone know why this is? Is there a compile flag to have this
return 'inf' as opposed to zero? Any help would be much appreciated.
I have included a sample program with sample output:
#include <limits>
#include <iostream>

using namespace std;
int main()
{
double x = -std::numeric_limits<double>::max();
double y = std::numeric_limits<double>::max();
double xNegInf = x*10;
double yInf = y*10.0;
double dInf = std::numeric_limits<double>::infinity();
cout << "Min: " << x << endl;
cout << "Max: " << y << endl;
cout << "Neg Inf: " << xNegInf << endl;
cout << "Inf: " << yInf << endl;
cout << "dInf: " << dInf << endl;
return 0;
}
-=-=-=-=-=-=-==-= Output -=-=-==-==-==-=-=-=-=-=

Min: -1.79769e+308
Max: 1.79769e+308
Neg Inf: -inf
Inf: inf
dInf: 0

-=-=-=-=-=-=-==-= End Output -=-=-==-==-==-=-=-=-=-=

Thanks,
Liam

Aug 1 '06 #1
1 2597
liam_herron wrote:
Does anyone know why this is? Is there a compile flag to have this
return 'inf' as opposed to zero? Any help would be much appreciated.
[..]
The makers of the library should know. Ask them. Try gnu.g++.help or
their online (web) forums. You could also try a third-party library
(like STLport), or just update your compiler (aren't they already at v4?)

V
--
Please remove capital 'A's when replying by e-mail
I do not respond to top-posted replies, please don't ask
Aug 1 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: john | last post by:
The code: #include <iostream> #include <limits> int main() { using namespace std;
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.