PGI User Forum
 SearchSearch   MemberlistMemberlist     RegisterRegister   ProfileProfile    Log inLog in 

Free OpenACC Webinar

long double

 
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling
View previous topic :: View next topic  
Author Message
steabert



Joined: 09 Jun 2006
Posts: 6

PostPosted: Thu Jul 06, 2006 2:04 pm    Post subject: long double Reply with quote

Hi,

If I compile (pgCC 6.1-6) and run the following code:

Code:

#include <iostream>

int main()
{
        using namespace std;
        double biggy = 1.0e307;
        cout << biggy << endl;
        return 0;
}


I get as output:
Code:
1e+307


When I change
Code:
double
to
Code:
long double

then the output is
Code:
0
(or sometimes a "-" or nothing at all)

g++ seems to do it correct both times.
Back to top
View user's profile
mkcolg



Joined: 30 Jun 2004
Posts: 6211
Location: The Portland Group Inc.

PostPosted: Thu Jul 06, 2006 8:00 pm    Post subject: Reply with quote

Hi Steabert,

Thanks for the report. It looks like a bug in the STL to me. I've submitted a technical problem report (TPR#3874) to our compiler team. Hopefully we'll have a fix in the near future.

Although not very C++ like, the C 'printf' function using the '%g' format does print the variable correctly. Also, 'long double' and 'double' are both 8 bytes so using 'long double' has no advantage over 'double'.

- Mat
Back to top
View user's profile
Display posts from previous:   
Post new topic   Reply to topic    PGI User Forum Forum Index -> Programming and Compiling All times are GMT - 7 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © phpBB Group