MVSFORUMS.com Forum Index MVSFORUMS.com
A Community of and for MVS Professionals
 
 FAQFAQ   SearchSearch   Quick Manuals   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Problem in SAS\C Double

 
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming
View previous topic :: View next topic  
Author Message
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Mon Dec 01, 2008 7:31 am    Post subject: Problem in SAS\C Double Reply with quote

Hi All,

I m getting very weird problem and the description is as follows:

Code:
double a;
double b;
double b1;
double b2;
double c;

b=b1+b2;
c=a-b;

if(c < 0.00)
{

do something;
}


Now when i provide a=155.08,b1=127.07,b2=31.01 then c becomes
-0.000000 whereas if a=155.08,b1=127.06,b2=31.02 then c becomes 0.00 . I have never faced this type of issue and it would be of great help if somebody let me know the fix to problem. Thanks in advance.
Back to top
View user's profile Send private message
mrinalsolanki
Beginner


Joined: 02 May 2006
Posts: 56
Topics: 16

PostPosted: Tue Dec 02, 2008 7:14 am    Post subject: Reply with quote

Hi All,

After lots of investigation it seems to be a problem of Parity Bit.
here are the values which i found in debugger for the above code

Code:
a=4799452345891532308(0x429b147ae147ae14),2FCFCFC(Hex),155.080000(Dec)

b=4799452345891532309(0x429b147ae147ae15),2FCFCFC(Hex),155.080000(Dec)

c=13046928120492326912(0xb510000000000000),2FCFCFC(Hex),-0.000000(Dec)
.

It seems due to difference of -1 in the first value of a and b the whole data is corrupted but how would i check this in my code because i m not been able to understand what is the form of these first values ? Are they representing EBCDIC format or Hex values or something else?

Please send your thoughts.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic   printer-friendly view    MVSFORUMS.com Forum Index -> Application Programming All times are GMT - 5 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


MVSFORUMS
Powered by phpBB © 2001, 2005 phpBB Group