Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extended variant compare error

Status
Not open for further replies.

ahmet_sinav

Programmer
May 16, 2007
10
TR
hi all;
i am using firebird 2.5, fibplus and delphi xe2 (updated) on windows7 64 bit.
Code:
if dYMBP['HKS_PUANI'].AsFloat >= 0.96 then
    extHKS := 1.05
else
    extHKS := 1;
returns extHKS = 1;

At db dYMBP['HKS_PUANI'].AsFloat value is 0.96 and HKS_PUANI field is numeric(2,2). if i change the 0.96 value to 0.95 at db and code its working.

Code:
if dYMBP['HKS_PUANI'].AsFloat >= 0.95 then
    extHKS := 1.05
else
    extHKS := 1;
returns extHKS = 1.05;

after these i changed the 0.95 value 0.96 at db and code and when i try the below code its working

Code:
extDeg = 0.96
if dYMBP['HKS_PUANI'].AsFloat >= extDeg then
    extHKS := 1.05
else
    extHKS := 1;
returns extHKS = 1.05;

if i compare the value with variant its working.

that code is working too
Code:
  if math.CompareValue(dYMBP['HKS_PUANI'].AsFloat,0.96) in [0,1] then
    extHKS := 1.05

what the problem? i try above codes at another machines. is debugger error or am i making something wrong?
Best Regards;
 
thnks asCurrency solve the problem. asFloat is not working stable because i tried 0,86 value it worked like 0,96 but 0,76 is working normally and 0,66 0,56 is working normally too. Interesting [ponder]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top