IDL out of the for loop

IDL is old. Grandfatherly, even. When it was first written, you had a really souped-up computer if you had added an additional 10 MByte hard drive to go with the standard 1 MByte of disk space. So, you can maybe understand why the default integer size in IDL is 16-bits, or two bytes. This is a short integer by any current standards. This causes problems because a 16-bit signed integer can only represent the values -32768 to 32768. Occasionally, you need an integer larger than that, and even throwing in fingers and toes doesn't do the job.

One place where it causes problems is when short integers are used as counters in FOR loops.

    FOR j=0,n DO ...

If you want your loop to go beyond 32768 (loop values will become negative it they go beyond their bounds), you will have to make your loop variable a long integer, like this.

   FOR j=0L,n DO ....
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值