Project Home
Project Home
Source Code
Source Code
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - double precision problem: (2 Items)
   
double precision problem  
I have a small program, which exposes different behaviors between QNX GCC and Linux GCC. 

#include <stdio.h> 

double xx; 

main() 
{ 
xx = 8.386248e-02; 
printf("%.2e = %e\n", xx, xx); 
} 

I got the following result on Neutrino with the compilation of QNX gcc 3.3.5, 

8.38e-02 = 8.386248e-02 

But I got different result as below on Linux with gcc, 

8.39e-02 = 8.386248e-02 

I checked the binaries generated by different compilers and found the double precision rawdata are the same like below, 


.long -252304933 
.long 1068857346 

So it looks like a QNX glibc problem. Can anybody have answer on this? 

Thanks, 
-Jiangning
Re: double precision problem  
> I have a small program, which exposes different behaviors between QNX GCC and 
> Linux GCC. 
> 
> #include <stdio.h> 
> 
> double xx; 
> 
> main() 
> { 
> xx = 8.386248e-02; 
> printf("%.2e = %e\n", xx, xx); 
> } 
> 
> I got the following result on Neutrino with the compilation of QNX gcc 3.3.5, 
> 
> 
> 8.38e-02 = 8.386248e-02 
> 
> But I got different result as below on Linux with gcc, 
> 
> 8.39e-02 = 8.386248e-02 
> 
> I checked the binaries generated by different compilers and found the double 
> precision rawdata are the same like below, 
> 
> .long -252304933 
> .long 1068857346 
> 
> So it looks like a QNX glibc problem. Can anybody have answer on this? 

Yep, it is a problem with QNX 6.3.x libc. glibc means GNU libc. This bug has been fixed in our 6.4 libc and is available
 for download as part of the Trinity 2 packages in the OS project.

http://community.qnx.com/sf/wiki/do/viewPage/projects.core_os/wiki/Trinity2M6Build

Regards,

Ryan Mansfield