[comp.sys.hp] Converting Reals

steve@wayback.unm.edu (Steve Jorgensen-S) (07/07/89)

I am working on a program, where I read data files created on a HP 1000 
computer, and I am trying to use the data on a HP 9000/300.  In the data
files, I have some floating point numbers to read, and, since they were written
out in HP 1000 format, the HP 9000 does not interpret them correctly.  So,
May question is:  How do you convert a 4 byte HP 1000 floating point number
to a HP 9000 floating point number?  Any help will be appreciated!  Thanks!

					Steven Jorgensen
					steve@chimayo.unm.edu
					Electrical & Computer Engineering Dept
					University of New Mexico
					Albuquerque, NM

howard@wasatch.utah.edu (Walt Howard) (07/07/89)

The HP1000 has library routines for converting its internal floating point
format to IEEE format such as is used by the 9000/3x0 machines.  Chapter 11
of the 1000 Library manual shows that routine FCHI does the conversion you
want.  So I'd recommend that you get the 1000 to do the conversion before
you move the data over, rather than doing it on the 9000 afterwards.

BTW, the 1000 has routines for converting both to and from its internal
form, in both single and double precision, and you even get an error flag
to tell you if the conversion cannot be done correctly.

As soon as the Internet-compatible network software on the 1000 catches
up with HP's other machines, I'll probably even get to use this more often :-).

phil@hpsmdca.HP.COM (Philip Walden) (07/07/89)

> / hpsmdca:comp.sys.hp / steve@wayback.unm.edu (Steve Jorgensen-S) / 12:39 pm  Jul  6, 1989 /
> 
> I am working on a program, where I read data files created on a HP 1000 
> computer, and I am trying to use the data on a HP 9000/300.  In the data
> files, I have some floating point numbers to read, and, since they were written
> out in HP 1000 format, the HP 9000 does not interpret them correctly.  So,
> May question is:  How do you convert a 4 byte HP 1000 floating point number
> to a HP 9000 floating point number?  Any help will be appreciated!  Thanks!
> 
I's been a while, but I recall that the HP1000 folks had a library
routine to convert HP1000 FPP to IEEE, which is used by HP9000's.
This routine was originally intended for the HP9000/500s but works
for the 300/800 series.

Digging out my RTE Relocatable Library Reference Manual (cough, cough, whew ..
the dust!), these routines are called DFCHI, FCHI, DFCIH and FCIH.

	status = DFCHI(hpfp, i3efp) - HP1000 dble prec to IEEE dble prec
	status = FCHI(hpfp, i3efp)  - HP1000 sngl prec to IEEE sngl prec
	status = DFCIH(hpfp, i3efp) - IEEE dble prec to HP1000 dble prec
	status = FCIH(hpfp, i3efp)  - IEEE sngl prec to HP1000 sngl prec

Status = 0 if it worked. Hope this helps.

--------------------------------------------------------------------------
Philip Walden
Hewlett Packard
Surface Mount Development Center
3500 Deer Creek Road
Palo Alto, CA 94304
(408) 857-3899
--------------------------------------------------------------------------

bill@hpuorfa.HP.COM (Bill Chidester) (07/10/89)

> 
> The HP1000 has library routines for converting its internal floating point
> format to IEEE format such as is used by the 9000/3x0 machines.  Chapter 11
> of the 1000 Library manual shows that routine FCHI does the conversion you
> want.  So I'd recommend that you get the 1000 to do the conversion before
> you move the data over, rather than doing it on the 9000 afterwards.
> 
> BTW, the 1000 has routines for converting both to and from its internal
> form, in both single and double precision, and you even get an error flag
> to tell you if the conversion cannot be done correctly.

   Sorry, I didn't get the original basenote, but there's a slight
   problem with FCHI on the 1000.  It won't do numbers between 0.0 and .5:
   The software maintenance request has been filed and the module is
   fixed (I believe in the 5.1 release), and besides; out of the billions
   and billions of numbers, who's gonna notice when a few of them don't
   work? 

   Well, I did.  Not having time to wait for the fix, I wrote a version
   of FCHI (1000 Macro) that the poster of the base note (steve@wayback.
   unm.edu -- but I don't know his path) is welcome to; please email a
   request to me and I'll send you a copy.

      ...!hplabs!hpfcse!hpuorfa!bill
      -------------------------------

      Bill Chidester
      HP Orlando     (407) 826-9228