I was writing some code and run in to the next error, could you
please confirm the following:
When running the next code, the program miscalculates the sequence:
-1.18935 + -039645 as .7928998 instead of .7929.
Please try the next code to confirm my outcome !
FUNCTION PBMAIN () AS LONG
LOCAL count AS SINGLE
LOCAL n AS LONG
LOCAL temp AS STRING
count=-1.982250
LOCAL scale AS LONG
DIM lstbxalc_list(20) AS LOCAL STRING
scale=8
' count=-1.5858
' count=-0.39645
PRINT STR$(-0.39645*3)
PRINT
PRINT STR$(-0.39645*3)+ " calc check 3 * -0.39645!"
PRINT
PRINT STR$(0.39645+0.39645)+ " calc 3 check 0.39645+0.39645!"
PRINT STR$(0.39645+0.39645+0.39645)+ " calc 3 check 0.39645+0.39645+0.39645!"
FOR N&=0 TO scale
count=count+0.39645
temp=STR$(count)
IF count=0 THEN temp="0"
IF count > -3 AND count < 1 THEN
PRINT temp + " calc check result" + STR$(count)
END IF
LSTBXALC_List(N&)=temp
' LISTBOX ADD hmaindialog&,%MAINDIALOG_lstbxalc,temp
NEXT N&
PRINT STR$(1.18935/3)+ " 1.18935/3"
PRINT STR$(0-0.39645-0.39645)+ " / 0-0.39645-0.39645"
PRINT STR$(0-0.39645-0.39645-0.39645)+ " / 0-0.39645-0.39645-0.39645"
END FUNCTION
When I run this code, I get the next results back:
-1.18935
-1.18935 calc check 3 * -0.39645!
.7929 calc 3 check 0.39645+0.39645!
1.18935 calc 3 check 0.39645+0.39645+0.39645!
-1.5858 calc check result-1.5858
-1.18935 calc check result-1.18935 (last good)
-.7928998 calc check result-.7928998 (Inbetween here the error occurs)
-.3964498 calc check result-.3964498
1.788139E-7 calc check result 1.788139E-7 (Here it should be zero)
.3964502 calc check result .3964502
.7929002 calc check result .7929002
.39645 1.18935/3
-.7929 / 0-0.39645-0.39645
-1.18935 / 0-0.39645-0.39645-0.39645
Do we have a another buggy Pentium, or is it something with PB, I got
this result first in pbdll, so it's the same in both compilers.
Further more, I have tested the executable on a Pentium PII-266 and
on a Pentium Celeron with the same results.
Can anyone confirm this ??!!
Herman Kieskamp
------------------
please confirm the following:
When running the next code, the program miscalculates the sequence:
-1.18935 + -039645 as .7928998 instead of .7929.
Please try the next code to confirm my outcome !
FUNCTION PBMAIN () AS LONG
LOCAL count AS SINGLE
LOCAL n AS LONG
LOCAL temp AS STRING
count=-1.982250
LOCAL scale AS LONG
DIM lstbxalc_list(20) AS LOCAL STRING
scale=8
' count=-1.5858
' count=-0.39645
PRINT STR$(-0.39645*3)
PRINT STR$(-0.39645*3)+ " calc check 3 * -0.39645!"
PRINT STR$(0.39645+0.39645)+ " calc 3 check 0.39645+0.39645!"
PRINT STR$(0.39645+0.39645+0.39645)+ " calc 3 check 0.39645+0.39645+0.39645!"
FOR N&=0 TO scale
count=count+0.39645
temp=STR$(count)
IF count=0 THEN temp="0"
IF count > -3 AND count < 1 THEN
PRINT temp + " calc check result" + STR$(count)
END IF
LSTBXALC_List(N&)=temp
' LISTBOX ADD hmaindialog&,%MAINDIALOG_lstbxalc,temp
NEXT N&
PRINT STR$(1.18935/3)+ " 1.18935/3"
PRINT STR$(0-0.39645-0.39645)+ " / 0-0.39645-0.39645"
PRINT STR$(0-0.39645-0.39645-0.39645)+ " / 0-0.39645-0.39645-0.39645"
END FUNCTION
When I run this code, I get the next results back:
-1.18935
-1.18935 calc check 3 * -0.39645!
.7929 calc 3 check 0.39645+0.39645!
1.18935 calc 3 check 0.39645+0.39645+0.39645!
-1.5858 calc check result-1.5858
-1.18935 calc check result-1.18935 (last good)
-.7928998 calc check result-.7928998 (Inbetween here the error occurs)
-.3964498 calc check result-.3964498
1.788139E-7 calc check result 1.788139E-7 (Here it should be zero)
.3964502 calc check result .3964502
.7929002 calc check result .7929002
.39645 1.18935/3
-.7929 / 0-0.39645-0.39645
-1.18935 / 0-0.39645-0.39645-0.39645
Do we have a another buggy Pentium, or is it something with PB, I got
this result first in pbdll, so it's the same in both compilers.
Further more, I have tested the executable on a Pentium PII-266 and
on a Pentium Celeron with the same results.
Can anyone confirm this ??!!
Herman Kieskamp
------------------
Comment