Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Weird
Message
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
Re: Weird
Miscellaneous
Thread ID:
00952239
Message ID:
00952276
Views:
9
I create a prg :
LOCAL i,y,z

CLEAR  
STRTOFILE("","c:\test.txt",0)

FOR i = 1 TO 10000
	y = i + .225000000000000
	z = i + .23
	IF ROUND(y,2)<>z THEN 
		STRTOFILE(STR(i)+CHR(13)+CHR(10),"c:\test.txt",1)
	ENDIF
NEXT
If you execute the code you'll see the following result:

4
64 to 81
1024 to 1310

Notice that if you do 4 * 16 you have 64 and 64 * 16 = 1024 and so on.
In binary you'll have the following

4 -> 100

64 -> 100 0000
...
81 -> 101 0001

1024 -> 100 0000 0000
1310 -> 101 0001 1110

I didn't test it but the next value should be 16384 to ?.

>You're right
>
>I wonder what's significant about this value band, except that 64 is, of course that magic binary, hex number. But what about 81?
>
>>Hi guys,
>>
>>I got a good one for you. I've tried this in fox 7, 8 and also 9 beta. Simple way to reproduce the problem:
>>
>>?ROUND(64.225000000000000000000000000000000000,2)
>>?ROUND(63.225000000000000000000000000000000000,2)
>>
>>Why do I get 64,22 for the first one and 63.23 for the second one ? The round value doesn't seem to be right between 64 and 81. I tried this :
>>
>>?ROUND(64.225000000000000000000000000000000000,2)
>>to
>>?ROUND(81.225000000000000000000000000000000000,2)
>>
>>and the round isn't right !!
>>
>>Somebody and notice this problem ?
>>
>>Note : ?ROUND(ROUND(64.225000000000000000000000000000000000,10),2)is working well, strange isn't it :)
Previous
Reply
Map
View

Click here to load this message in the networking platform