11-01-2006 03:32 PM
11-02-2006 01:59 AM
Hi Snood1,
I believe that your problem deals with the way the machine represents number. IEEE 754 standard does not allow all floating points to be represented exactly. Let's try 100E-9 and 0.25E-9 with the following link and you can now understand where your problem comes from.
Here is a long thread dealing with IEEE 754 and LabVIEW. Same considerations should be taken into account with CVI
Best regards,
05-01-2007 11:04 AM
03-17-2008 08:45 PM
I still have doubt after see the IEEE 754.Could you give me a favor ?thank you ! My question is :
BYTE IMEI[16]=""; //unsigned char =BYTE
int YY,MM,DD ;
GetSystemDate (&MM, &DD, &YY); //int GetSystemDate (int *Month, int *Day, int *Year);
IMEI[10] = fmod(DD,10); //double fmod (double Dividend, double Divisor);
a few days before, i found that when DD=15,the IMEI[10]=0. follow the IEEE 754 :15=1*2^3*1.875,10=1*2^3*1.25,
so 1.875 willl be divided by 1.25 and reminder equal zero,it is also can express as that :15/10=1*2^3*(1.875/1.25)=0.
is it right?
And I have another doubt that :there are about 20 PCs,only 2 of them give the IMEI[10]=0 and others give IMEI[10]=5.
wating for your attention,thanks.
03-18-2008 04:43 AM - edited 03-18-2008 04:43 AM
03-18-2008 05:17 PM
03-19-2008 04:51 AM
Thank you for your advice.when I use "int IMEI[16]="" ,the results is ok.now I use MM%10 instead fmod(MM,10).
But using the wrong dada types in the program,some PCs can run ok,othes not.
The confusing program is as follow:
------------------code-------------------------------------------
int YY,MM,DD;
BYTE IMEI[16]="";
GetSystemDate (&MM, &DD, &YY); YY=2008,MM=3,DD=19
IMEI[6] = YY-2000;
IMEI[7] = MM/10;
IMEI[8] = fmod(MM,10);
IMEI[9] = DD/10;
IMEI[10] = fmod(DD,10);
--------------------bad PCs---------------------------------------
if use BYTE IMEI[16],
one PC gives the wrong result when running " IMEI[8] = fmod(MM,10) ",
the other PC gives the wrong when running "IMEI[10] = fmod(DD,10)",
further more, the two PCs both give right result only when there first running , I confuse by them.
03-19-2008 04:52 AM
---------------- memory -------------------------------------------
first running
the memory give the right data:
00 08 01 03 00 09
IMEI[7] IMEI[6] IMEI[9] IMEI[8] IMEI[11] IMEI[10].
after first running
the memory give the right data:
00 08 01 00 00 09
IMEI[7] IMEI[6] IMEI[9] IMEI[8] IMEI[11] IMEI[10].
-----------------------Question--------------------------------------------------
I donot know why their first running is ok?
The fmod function needs using double dada type.When using the int dada type , the compiler may be confusing when the program runs on the bad PCs?
How can I validate the difference of their compilers ?
03-19-2008 10:29 AM
03-20-2008 06:12 AM