|
From: ConradL on 18 Jan 2008 00:25 Hi all, I have written a function that scales a 1-D array of data with a given double precision value: a^[i] = a^[i]*dblScaleValue I have written the code in Delphi assembler as follows: asm mov ecx, intNumberOfElements; mov esi, pArray finit fld dblValue // load scalevalue st(1) @next: fld qword ptr [esi] // load pArray st(0) fmul st(0), st(1) // multiply by scale value fstp qword ptr [esi] add esi,8 loop @next fwait end; where intNumberOfElements is an even number of elements pArray is a pointer to the data When the code is executed the first time, it works correctly but if i execute the code two consecutive times the data is filled with NANs. Could some1 explain what i am doing wrong? Regards Conrad
From: Dirk Wolfgang Glomp on 18 Jan 2008 04:55 Am Thu, 17 Jan 2008 21:25:03 -0800 (PST) schrieb ConradL: > Hi all, > > I have written a function that scales a 1-D array of data with a given > double precision value: > > a^[i] = a^[i]*dblScaleValue > > I have written the code in Delphi assembler as follows: > > asm > mov ecx, intNumberOfElements; > mov esi, pArray > finit > fld dblValue // load scalevalue st(1) > @next: > fld qword ptr [esi] // load pArray st(0) > fmul st(0), st(1) // multiply by scale value > fstp qword ptr [esi] > add esi,8 > loop @next > fwait > end; > > where intNumberOfElements is an even number of elements > pArray is a pointer to the data > > When the code is executed the first time, it works correctly but if i > execute the code two consecutive times the data is filled with NANs. > Could some1 explain what i am doing wrong? The last pop is missing to clear the stack? Dirk
From: Wolfgang Kern on 19 Jan 2008 06:49 Conrad asked: > Hi all, > > I have written a function that scales a 1-D array of data with a given > double precision value: > > a^[i] = a^[i]*dblScaleValue > > I have written the code in Delphi assembler as follows: > > asm > mov ecx, intNumberOfElements; > mov esi, pArray > finit > fld dblValue // load scalevalue st(1) > @next: > fld qword ptr [esi] // load pArray st(0) > fmul st(0), st(1) // multiply by scale value > fstp qword ptr [esi] > add esi,8 > loop @next > fwait > end; > > where intNumberOfElements is an even number of elements > pArray is a pointer to the data > > When the code is executed the first time, it works correctly but if i > execute the code two consecutive times the data is filled with NANs. > Could some1 explain what i am doing wrong? perhaps because source and destination are identical, so the FMUL's (always a 'tword' action) exponent result can't fit the DBL in fstp ? I'd check on possible ranges and limits. __ wolfgang
|
Pages: 1 Prev: exception Next: OT: How's your bandwidth today? You been throttled? |