Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
BUG: Deterministic function return not deterministic val
Message
From
16/10/2003 12:46:15
 
 
To
16/10/2003 12:11:45
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00838784
Message ID:
00839363
Views:
59
>Hi David,
>
>>set fixed off and your life will be happier.
>
>My life not change !
>
>
>CLEAR
>SET DECIMALS TO 18
>SET FIXED OFF
>lnDiff = {^2000-03-20 11:31:00} - {^2000-03-20 10:25:00}+0.0
>zz={^2000-03-20 11:31:00} - {^2000-03-20 10:25:00} + 0.00
>? INT(m.lnDiff)=INT(m.zz)
>* this return .F. on  VFP6/7/8
>
>
>David, give me the my bad setting and the discussion end.
>
>Fabio

Fabio,

DateTime variables are stored as double where the day number is the int part and the fpt part is # of seconds/86400
If you do the same in C, you get similar results

One can argue whether vfp should internally round( ,0) after DateTime arithmetic.

I've noticed this a long time ago and I do a round when I need the seconds as integers
&& vfp
round(th_End - th_id, 0)
main( int argc, char* argv[])
{

	double xx, yy, zz;

	xx = 100000.00 +(11.0*3600.0+31.0*60.0)/86400.0 ;
	yy = 100000.00 +(10.0*3600.0+25.0*60.0)/86400.0 ;
	zz = (xx - yy) * 86400.0 ;
	
	printf("zz=%20.18f, eq=%d  zz-3960.0=%20.18f\n", zz, (zz-3960.0)==0.00, zz-3960.0) ;

	return 0;
}
Gregory
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform