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

Home » Public Forums » archive » Re: Unix to Vax floating point conversion
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Unix to Vax floating point conversion [message #4873] Wed, 16 August 1995 00:00 Go to previous message
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
"R. David Baker" <rbaker> writes:

> We are using PVWave Version 5.0 on a VMS Vax, and need to read in IEEE
> binary from a Sun Sparc2. We tried to use the CONV_UNIX_VAX procedure
> from the IDL Astronomy User's Library
> (http://idlastro.gsfc.nasa.gov/contents.html), but didn't get it to
> work correctly. Here's what we did:

> get_lun,unit
> openr,unit,filename
> readu,unit,i,t ; i is an integer to read the Sun Fortran
> ; header and t is a floating point array
> free_lun,unit
> print,t ---> show unconverted numbers <-- THIS IS THE PROBLEM
> CONV_UNIX_VAX,t,source_arch='sparc'
> print,t ---> show converted numbers

The problem was probably generated when you tried to print out the numbers
before converting them. As Wayne Landsman (landsman@sorbet.gsfc.nasa.gov)
points out from the IDL documentation

> "VAX Warning: Do not attempt to interpret an XDR (=Sparc) format
> floating-point number as a native floating number on a VAX. VAXen generate
> an illegal instruction trap when the CPU encounters illegal floating point
> values. Under VAX/VMS the illegal value is automatically replaced with
> zero and execution continues."

When you tried to print it out, you caused the computer to try to interpret it,
thus generating the problem. Since it's a VAX/VMS problem, and not an IDL one,
the same behavior should be seen in PVWave. The proper sequence should be

get_lun,unit
openr,unit,filename
readu,unit,i,t
free_lun,unit
CONV_UNIX_VAX,t,source_arch='sparc'
print,t

Wayne goes on to say,

> So the trick to doing the number conversions is to alway deal with bytes and
> never interpret an XDR number on a VAX.

I'm not sure what is meant here about always dealing with bytes. As long as
one converts the numbers into the host representation immediately after reading
them, you should be okay.

He also says,

> ... In IDL Vax V4.0 there was a bug in
> the /FTOXDR keyword, and another bug prevented one from even subscripting an
> XDR number on a Vax. (Note: these bugs will be fixed in the next release of
> IDL Vax VMS V4.0.1.).

This makes me mad. This is not the first time that bugs have been introduced
into IDL's BYTEORDER routine on DEC computers. It is absolutely vital for us
that data is written out to files in a host independent format. We use NFS to
distribute this data to a variety of computer platforms. THE BYTEORDER ROUTINE
IN IDL MUST WORK!

Wayne ends with,

> Note that none of the above problems apply to Alpha VMS machines, which
> are considerably less finicky.

Well, thank god for that. That explains why we haven't run into this bug. (We
haven't been so lucky in the past.)

Bill Thompson
[Message index]
 
Read Message
Read Message
Previous Topic: Re: PVWAVE - widgets
Next Topic: IDL-X Window problem: changing mouse actions

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

Current Time: Fri Oct 10 14:27:22 PDT 2025

Total time taken to generate the page: 0.80220 seconds