[Rd] Strange behavior of C compiled program

From: Christophe Genolini <cgenolin_at_u-paris10.fr>
Date: Sun, 08 Feb 2009 23:37:24 +0100


Hi the list,

I need to include some C code in R, but the behavior of the C code is strange : Here is my code :
--- 8< ---

    Rprintf("\n XXXX mTraj=%f
mClus=%f",mTraj[i+nbId*c],mClustersCenter[j+nbClusters*c]);

    Rprintf("\nDistA=%d Tmp=%d",dist,tmp);

            tmp = mTraj[i+nbId* c] - mClustersCenter [j+nbClusters* c];

    Rprintf("\nDistB=%d Tmp=%d",dist,tmp);

            dist += (tmp * tmp);

    Rprintf("\nDistC=%d Tmp=%d",dist,tmp);
--- 8< ----

Herer are the stranges results it gives :

XXXX mTraj=1.000000 mClus=3.000000

DistA=0 Tmp=0
DistB=0 Tmp=0
DistC=0 Tmp=1074790400

I ask on a C chat, but no one can answer me. Any idea of what wrong ?

Thanks
Christophe



R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Sun 08 Feb 2009 - 22:46:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Mon 09 Feb 2009 - 04:30:22 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive