comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Need integer consts eq long not short
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Need integer consts eq long not short [message #3100] Wed, 02 November 1994 12:32 Go to next message
sgs is currently offline  sgs
Messages: 2
Registered: November 1994
Junior Member
I need pvwave to have long (4 byte) constant integers by default rather
than short (2 byte). Is there a way to force this behavior with a
system variable, or something?

Short integers cause problems like this:

for i=0,n do begin ... ; buggy, i is a short integer
for i=0L,n do begin ... ; correct, i is a long integer

Pvwave creates i as a short integer, because the constant 0 is, by default,
short. However, when (long) n is bigger than 32767, the loop only loops
to (n mod 32767).

(1) Unfortunately, these loops often produce reasonable, but incorrect
answers.

Many of the std/* and user/* routines provided with pvwave have this
bug. (grep for lines with "for i=0", and any lines with integer
constants). (Watch out! They work with your small test case, but fail
with your real, large dataset, see (1).)


Steve Spray sgs@lmsc.lockheed.com
Re: Need integer consts eq long not short [message #3144 is a reply to message #3100] Thu, 10 November 1994 06:33 Go to previous message
landers is currently offline  landers
Messages: 45
Registered: May 1993
Member
In article <39qs0h$g7@ovid.dra.hmg.gb>, black@signal.dra.hmg.gb (John Black) writes:
|>
|> While we're on the subject of bugs due to short integers rather than long
|> integers, I might point out another variation of bugs due to this.
|>
|> This is using the FIX function as opposed to LONG. A example of this is in the
|> PV-WAVE routine SUM. The routine works so long as the output array is not over
|> 32767 elements. I think this particular routine only exists in PV-WAVE - the
|> IDL routine that performs the equivalent operation is TOTAL (note the IDL
|> version of total not the PV-WAVE one). This particular bug is still in SUM in
|> the version of PV-WAVE that we have which is 4.20
|>
|> Note also that AVG calls SUM, so there's effectivly a bug in AVG too.
|>
|> John Black


PV-WAVE has bot TOTAL and SUM procedures. TOTAL just totals the contents of
an array, and is an 'intrinsic' function (it's compiled in - there's no
total.pro source). SUM is a User's Lib routine that will sum values from a
particular array index.

The bug you mention in SUM has been fixed for version 5.00, as well as for the
PC version, PV-WAVE Personal Edition.


--
Dave
Re: Need integer consts eq long not short [message #3146 is a reply to message #3100] Wed, 09 November 1994 08:05 Go to previous message
black is currently offline  black
Messages: 39
Registered: August 1992
Member
While we're on the subject of bugs due to short integers rather than long
integers, I might point out another variation of bugs due to this.

This is using the FIX function as opposed to LONG. A example of this is in the
PV-WAVE routine SUM. The routine works so long as the output array is not over
32767 elements. I think this particular routine only exists in PV-WAVE - the
IDL routine that performs the equivalent operation is TOTAL (note the IDL
version of total not the PV-WAVE one). This particular bug is still in SUM in
the version of PV-WAVE that we have which is 4.20

Note also that AVG calls SUM, so there's effectivly a bug in AVG too.

John Black
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: array of dynamic arrays in PV~Wave?
Next Topic: Any codes for LCD Stereo Viewing?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 16:00:33 PDT 2025

Total time taken to generate the page: 0.00751 seconds