On Tue, Dec 16, 2003 at 02:25:42PM +0800, pagoda wrote:

> now, a stupid solution is:
> 
> for (my $value = -1000; $value <= 1000; $value += 100) {
>         print $value/1000, "\n";
> }
> 
> hehe,

Not so stupid, really.  If you can keep most of your maths confined to
integers you will have fewer floating point problems.

There's no need to increment in steps of 100 though.

$ perl -le 'print $_ / 10 for -10 .. 10'

-- 
Paul Johnson - [EMAIL PROTECTED]
http://www.pjcj.net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to