r10 procedures by tejon
Posted: Fri Oct 24, 2003 5:21 pm
Is anybody else using these procedures and have they found the same bug that I have found?
To simplify using these marvelous procedures for getting double precision accuracy, I wrote my own procedures which basically are along the lines of answer$=MyMul(a$,b$) which then calls the r10 procedures to convert the two strings, mutiply them, convert back and return the answer as a string. I have similar procedures for all the functions so that by including his and mine in a program I call them as required.
But - I discovered that although the results seem to be always numerically correct I never got a negative answer. So that -7+2=5 for example.
I have corrected this by adding this bit to the end of the original Procedure.s r10ftoa(*x.r10,format.l)
If s=-1 ; added by me
If Left(f$,1)<>"-" ; since there are if s=-1 bits in the prog I don't want two minus signs if one does get added
f$="-"+f$ ; added by me
EndIf ; added by me
EndIf ; added by me
ProcedureReturn f$
EndProcedure
Which seems to have worked and I now get correct answers displayed, but I don't know why it is needed since there are several If s=-1 : f$="-"+f$ : EndIf bits in the original procedure. My problem being that the ASM bits are a bit of a foreign language to me, I used to understand the 68000 series code, but stick to PB since changing to Windows!
MikeB
To simplify using these marvelous procedures for getting double precision accuracy, I wrote my own procedures which basically are along the lines of answer$=MyMul(a$,b$) which then calls the r10 procedures to convert the two strings, mutiply them, convert back and return the answer as a string. I have similar procedures for all the functions so that by including his and mine in a program I call them as required.
But - I discovered that although the results seem to be always numerically correct I never got a negative answer. So that -7+2=5 for example.
I have corrected this by adding this bit to the end of the original Procedure.s r10ftoa(*x.r10,format.l)
If s=-1 ; added by me
If Left(f$,1)<>"-" ; since there are if s=-1 bits in the prog I don't want two minus signs if one does get added
f$="-"+f$ ; added by me
EndIf ; added by me
EndIf ; added by me
ProcedureReturn f$
EndProcedure
Which seems to have worked and I now get correct answers displayed, but I don't know why it is needed since there are several If s=-1 : f$="-"+f$ : EndIf bits in the original procedure. My problem being that the ASM bits are a bit of a foreign language to me, I used to understand the 68000 series code, but stick to PB since changing to Windows!
MikeB