Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ComTools - OR()
Message
General information
Forum:
Visual FoxPro
Category:
FoxPro 2.x
Title:
Miscellaneous
Thread ID:
00577283
Message ID:
00577338
Views:
39
Hi Chris,

I don't think it's a bug rather a feature. Foxpro internaly stores numbers eather as Long Integer (4 bytes) or Double Float ( 8 bytes). If it's whole number that can fit into 4 bytes foxpro most likely will store it as integer but there's no guaranty. In this case foxpro for some reason stored value from the third field in the table as double. It's also possible that it's stored as integer but passed to the OR function as a double float. That's why using INT() resolves this problem.

>Is this a bug?
>
>It errors saying that I have passed a Floating Point as the first parameter.
>Yet It is clearly not a floating point.
>Is this a problem with ComTools failing to determine the data type correctly, or is FoxPro setting is wrong?
>Wrapping it in an INT() like the error message suggests does work, but I fail to understand why it fails in the first place.
>
>Any Ideas?
>(Added Note: Also does the same under VFP 6 and 7 using CVF50.fll)
>
>
>SET LIBRARY TO CTFW
>PRIVATE a_tmp
>DIMENSION a_tmp[3]
>a_tmp[1]= 0.00
>a_tmp[2]= ""
>a_tmp[3]= 0
>
>CREATE CURSOR Temp (n1 N(5,2), c1 C(5), n2 N(1))
>INSERT INTO Temp VALUES (1.00, "Test", 3)
>
>SELECT n1, c1, n2;
> FROM Temp ;
> INTO ARRAY a_tmp
>
>?a_tmp[1]
>?a_tmp[2]
>?a_tmp[3]
>? OR(a_tmp[3], 0)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform