AnsweredAssumed Answered

printf from kernel misbehaves again

Question asked by Raistmer on Apr 14, 2013
Latest reply on Jun 16, 2014 by pinform



for (int j = 1; j < ndivs ; j++)



{




//perdiv *=2;




tmp0 = di & 1;




di >>= 1;




tmp0 += di;




dis_thresh = t_funct(di, num_adds, j,PulseMax,t_funct_cache_fp) * avg;




{





tmp_max = sumtop2(tmp_pot, tmp_pot, di, fft_len4, tmp0);




}

#if 1


if(ul_PoT == 1 && y == 3 && z == 7 && p == 4454){


printf("tmp_max=(%f,%f,%f,%f) dis_thresh=(%f,%f,%f,%f) j=%d\n",



tmp_max.x,tmp_max.y,tmp_max.z,tmp_max.w,



dis_thresh.x,dis_thresh.y,dis_thresh.z,dis_thresh.w,



j);

}

#endif





if (tmp_max.x>dis_thresh.x || tmp_max.y>dis_thresh.y ||





tmp_max.z>dis_thresh.z || tmp_max.w>dis_thresh.w) {





// unscale for reporting





tmp_max /= (float4)num_adds_2;





cur_thresh = (dis_thresh / (float4)num_adds_2 - avg) * rcfg_dis_thresh + avg;

 

 






float4 _snr = (tmp_max-avg)/(cur_thresh-avg);

#if 1


if(ul_PoT == 1 && y == 3 && z == 7 && p == 4454){


printf("_snr=(%f,%f,%f,%f) best_pulse_score=(%f)\n",



_snr.x,_snr.y,_snr.z,_snr.w,best_pulse_score);

}

#endif






if (_snr.x  > best_pulse_score ||






_snr.y  > best_pulse_score ||






_snr.z  > best_pulse_score ||






_snr.w  > best_pulse_score) {






result_flag[0].x = 1;printf("location 3 hit: ul_PoT=%d,y=%d,z=%d,p=%d\n",ul_PoT,y,z,p);return;





}

When it was %d instead %f for float values it worked OK.

tmp_max=(1016206848,1016042150,1014254674,1015103447) dis_thresh=(1017574742,1017521425,1017343526,1017306023) j=1

tmp_max=(1019540776,1019234484,1019323582,1019736860) dis_thresh=(1022113170,1022037738,1021786049,1021732991) j=2

tmp_max=(1025885083,1025687250,1025025298,1024181522) dis_thresh=(1026938408,1026880340,1026686587,1026645743) j=3

tmp_max=(1032427341,1033697660,1031554466,1031172886) dis_thresh=(1033265612,1033217589,1033057352,1033023573) j=4

_snr=(1052921234,1058128081,1050160947,1049360638) best_pulse_score=(1063430413)

tmp_max=(1039569588,1041180477,1038290570,1038685748) dis_thresh=(1040415552,1040373564,1040233466,1040203932) j=5

_snr=(1052941357,1060001794,1049353865,1051071391) best_pulse_score=(1063430413)

tmp_max=(1046772721,1049205382,1045513371,1045367322) dis_thresh=(1047492886,1047416412,1047161246,1047107455) j=6

_snr=(1052854581,1063899244,1046138112,1044991040) best_pulse_score=(1063430413)

location 3 hit: ul_PoT=1,y=3,z=7,p=4454

 

Now I changed %d to %f where needed but output broken to signle line with ridiculous j value.

 

What is wrong ????

Outcomes