I type the string '0.1'
and i convert it to _Delta
I show both _Delta0 and _Delta and they are 0.10000000
When i Test, it jumps to label _erro, so
_Delta > _Delta0 !
If _Delta <= _Delta0 it should exit with CLC
is what i want.
What is the problem ? What's the solution ?
.DATA
_Delta dt 0
_Delta0 dt 1.0e-1
;.............................
; -----------
; Test _Delta
; -----------
fld tbyte ptr _Delta0 ;st(1)
fld tbyte ptr _Delta ;st(0)
;
fcomip st(0), st(1)
fwait
jpe short _erro1
ja short _erro
fstp st ;remove source
clc
ret
_erro1: fstp st ;remove source
mov eax, 1
stc
ret
;
; EXIT «««HERE !!!
;
_erro: fstp st ;remove source
mov eax, 0
stc
ret
I decided to use my converter and do this
and now _Delta = _Delta0
.DATA
_sDelta0 db '0.1', 0
_Delta dt 0
_Delta0 dt ?
;.............................
;
; convert _sDelta0 to _Delta0
; »»»»»»»»»»»»»»»»»»»»»»»»»»»
invoke CvRclToRel, addr _sDelta0, addr _Delta0
jc _erro1
; -----------
; Test _Delta
; -----------
fld tbyte ptr _Delta0 ;st(1)
fld tbyte ptr _Delta ;st(0)
;
fcomip st(0), st(1)
fwait
jpe short _erro1
ja short _erro
fstp st ;remove source
; »»»»»»»»»»»»»»»»»
; EXIT «««HERE !!! ««««««««««««««««««««««
; »»»»»»»»»»»»»»»»»
clc
ret
_erro1: fstp st ;remove source
mov eax, 1
stc
ret
_erro: fstp st ;remove source
mov eax, 0
stc
ret
have you tried to analyse it with OllyDbg? Also, testing for equality is not trivial.
BTW: fwait is not needed.
It is obvious that if you convert two identical strings with the same procedure, you will get identical results.
The procedure used by the assembler to convert your 0.1 string in the .data section is not necessarily identical to your own conversion procedure and could result in a small difference which could be picked up by the fcomip instruction. Using a debugger, look at the memory locations where the values are stored and compare their least significant bytes. Even if the difference is only 1, one would be considered larger than the other.
qWord,
Quote from: qWord on April 21, 2012, 08:26:31 PM
have you tried to analyse it with OllyDbg? Also, testing for equality is not trivial.
Thanks for reply
I dont like to use it !
I will go to use my converter to get _Delta0 before testing :wink
Quote
BTW: fwait is not needed.
Ok thanks :U
raymond,
Thanks for reply
Quote
The procedure used by the assembler to convert your 0.1 string in the .data section
is not necessarily identical to your own conversion procedure and
could result in a small difference which could be picked up by the
fcomip instruction.
The problem is the assembler converter, i think
I also used your converter to convert the 0.1 string
and it is not equal to that of .data section.
In any case i solved the problem.