Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: BINTOC double and real wrong conversion
Message
From
28/09/2005 17:55:42
 
 
To
28/09/2005 17:25:27
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro Beta
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01052819
Message ID:
01054253
Views:
26
>I am not sure what you mean here. These two do show as equal (tho with differing data widths). Can you describe what you are seeing, and what the difference is?
>
>Thanks.


well,
BINTOC convert the internal binary to a char variable,
CLEAR
* put 0 with different literals
* because zero is zero,
* conversion to binary must return 
* the same value

X=-0E0
? X,0H+BINTOC(X,'F') AT 20,0H+BINTOC(X,'B') AT 40 && here the bug go away because VFP convert the number to a Integer
X=-0.0E0
? X,0H+BINTOC(X,'F') AT 20,0H+BINTOC(X,'B') AT 40 && BUG 80 is the sign bit
X=-0.0E1
? X,0H+BINTOC(X,'F') AT 20,0H+BINTOC(X,'B') AT 40 && here the bug go away because VFP convert the number to a Integer
X=-0.00E1
? X,0H+BINTOC(X,'F') AT 20,0H+BINTOC(X,'B') AT 40 && BUG 80 is the sign bit

* another way
* this must return .T. because the conversion of the same value must return the same value
? (-0.0E1 = -0.0E0) = (BINTOC(-0.0E1,"B")==BINTOC(-0.0E0,"B"))

* ANOTHER EXAMPLE, INCORRECT INDEX WITH REAL VALUES

CREATE CURSOR BBB (AA B,RN I)
APPEND BLANK
REPLACE AA WITH -0.0E0,RN WITH 1
APPEND BLANK
REPLACE AA WITH  0.0E0,RN WITH 2
INDEX ON BINTOC(AA,"F") TAG T1
* EXPECTED : 1,2 OBSERVED : 2,1
BROWSE NORMAL
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform