On 9/1/07, Rodrigo Tavares <[EMAIL PROTECTED]> wrote: snip > Write a number:23 > Value i is : 1081 > 23 > 11.5 > 5.75 > 2.875 > 1.4375 > > Why did script show the value ? > > The counter must be six. snip
Sounds like you want integer math rather than floating point math. In floating point math repeatedly halving the value will only reach 0 when the value becomes so small that it can't fit in your floating point representation. In real math it never reaches 0, it just becomes infinitely close to zero. You can get integer math for the current lexical scope by saying use integer; You can also use the int function judiciously to achieve the same effect (albeit without the performance gain). If you want a close approximation of real math you can say use bignum; or #my understanding is that this is both faster and harmless to try since it will use #the default if it can't find the GMP library use bignum lib => 'GMP'; Your loop will only end when your machine crashes (or kills the process) due to there not being enough memory to store the number. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/