sambomb wrote:Change the name of the var, nTest_Decimals := 3Code: Select all | Expand
#include "fivewin.ch"
procedure start()
Local nTest_Decimals := 3
oSQLite := TSQLiteServer():New( "test.sql" )
If oSQLite:lError
msgStop( "error" )
RETURN
EndIf
cQuery:="SELECT * from t_tables;"
oQry:=oSQLite:Query(cQuery)
nTest_Decimals :=oQry:aData[1,7]
oQry:End()
oSQLite:End()
msginfo(nTest_Decimals ) && return 3
msginfo(valtype(nTest_Decimals )) && return N
msginfo(str(88.456,10,3)) && return 88.456
msginfo(str(88.456,10,nTest_Decimals )) && RETURN 88 !!!
return
function gettemppath()
return("")
Strange problems on decimals - dangerous bug !!
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Strange problems on decimals - dangerous bug !!
Tried your code but I always got error.
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
Re: Strange problems on decimals - dangerous bug !!
I have an off topic question. Where did/does the TSQLiteServer() class come from? I've searched high and low and have not yet come across this.
Thanks in advance.
Robb
Thanks in advance.
Robb
Re: Strange problems on decimals - dangerous bug !!
Marco Turco wrote:Tried your code but I always got error.sambomb wrote:Change the name of the var, nTest_Decimals := 3Code: Select all | Expand
#include "fivewin.ch"
procedure start()
Local nTest_Decimals := 3
oSQLite := TSQLiteServer():New( "test.sql" )
If oSQLite:lError
msgStop( "error" )
RETURN
EndIf
cQuery:="SELECT * from t_tables;"
oQry:=oSQLite:Query(cQuery)
nTest_Decimals :=oQry:aData[1,7]
oQry:End()
oSQLite:End()
msginfo(nTest_Decimals ) && return 3
msginfo(valtype(nTest_Decimals )) && return N
msginfo(str(88.456,10,3)) && return 88.456
msginfo(str(88.456,10,nTest_Decimals )) && RETURN 88 !!!
return
function gettemppath()
return("")
What error?
All I did is replace nDecimals by nTest_Decimals
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
xHarbour 1.2.3 + Fwhh 20.2
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Strange problems on decimals - dangerous bug !!
For error I mean that msginfo(str(88.456,10,nTest_Decimals )) Always return 88
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
Re: Strange problems on decimals - dangerous bug !!
Try this now...
I included Set Decimals 20, Set Exact On, extra debugs to trace the value of nTest_Decimals
I included Set Decimals 20, Set Exact On, extra debugs to trace the value of nTest_Decimals
Code: Select all | Expand
#include "fivewin.ch"
procedure start()
Local nTest_Decimals := 3, nBkpDecimals := -999
Set Decimals to 20
Set Exact on
oSQLite := TSQLiteServer():New( "test.sql" )
If oSQLite:lError
msgStop( "error" )
RETURN
EndIf
cQuery:="SELECT * from t_tables;"
oQry:=oSQLite:Query(cQuery)
nBkpDecimals := nTest_Decimals
nTest_Decimals :=oQry:aData[1,7]
If nTest_Decimals == nBkpDecimals
MsgInfo("Identical values")
else
MsgInfo("Compare decimals values")
If AllTrim(Str(nTest_Decimals,25,20)) != AllTrim(Str(nBkpDecimals,25,20))
MsgInfo(AllTrim(Str(nTest_Decimals,25,20)),"nTest")
MsgInfo(AllTrim(Str(nBkpDecimals,25,20)),"nBkp")
else
MsgInfo("Equal strings")
end
End
oQry:End()
oSQLite:End()
msginfo(nTest_Decimals )
msginfo(valtype(nTest_Decimals ))
msginfo(str(88.456,10,3)) && return 88.456
msginfo(str(88.456,10,nTest_Decimals )) && RETURN 88 !!!
return
function gettemppath()
return("")
Email: SamirSSabreu@gmail.com
xHarbour 1.2.3 + Fwhh 20.2
xHarbour 1.2.3 + Fwhh 20.2
- Marco Turco
- Posts: 858
- Joined: Fri Oct 07, 2005 12:00 pm
- Location: London
- Contact:
Re: Strange problems on decimals - dangerous bug !!
Hi sambomb,
i did your test. Identical value but it return always 88.
You can download source and executable from http://109.228.12.120/softwaredistribut ... /test3.zip
i did your test. Identical value but it return always 88.
You can download source and executable from http://109.228.12.120/softwaredistribut ... /test3.zip
Best Regards,
Marco Turco
SOFTWARE XP LLP
Marco Turco
SOFTWARE XP LLP
Re: Strange problems on decimals - dangerous bug !!
Marco,
Please try so:
Regards
Please try so:
Code: Select all | Expand
...
nTest_Decimals :=oQry:aData[1,7]
nTest_Decimals := Val( Str(nTest_Decimals, 10)) // <---- New
...
Regards
- James Bott
- Posts: 4840
- Joined: Fri Nov 18, 2005 4:52 pm
- Location: San Diego, California, USA
- Contact:
Re: Strange problems on decimals - dangerous bug !!
Marco,
Did you ever find a solution?
It looks like hmpaquito's idea might work. Did you try it?
Did you ever find a solution?
It looks like hmpaquito's idea might work. Did you try it?