 Community Home
 >
 Servers and Operating Systems
 >
 Operating System  HPUX
 >
 General
 >
 HP floating point format (HP 1000)

 Categories
 Blogs

Quick Links
 Community
 Getting Started
 FAQ
 Ranking Overview
 Rules of Participation
 Contact
 Email us
 Tell us what you think
 Information Libraries
 Integrated Systems
 Networking
 Servers
 Storage
 Other HPE Sites
 Support Center
 Enterprise.nxt
 Marketplace
 Aruba Airheads Community

Forums

Blogs

Information

English
 Subscribe to RSS Feed
 Mark Topic as New
 Mark Topic as Read
 Float this Topic for Current User
 Bookmark
 Subscribe
 Printer Friendly Page
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 11:43 AM
05082010 11:43 AM
I need to read some old binary files with (32 bit) floats written in HP floating point format. I need to write my own routine for conversion to IEEE format (so please don't advocate using HP provided 'blackbox' routines e.g. FCHI (fortran conversion routine)
I found a "thread" which provided the general structure of the HP floating point format
http://www.hp.com/products1/rte/tech_support/files/guru98column.txt
This is great, but
1. what is the normalization bit?
2. how do I treat the exponent (for IEEE format it is dependent on the coming fraction!)
3. what about the 'Inf' and 'Nan' scenarios
Appreciate any help.
Solved! Go to Solution.
 Tags:
 HP1000
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 12:08 PM
05082010 12:08 PM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
what about : HPUX floatingpoint guide :
http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=0008a22194f02110a22194f02110275d6e10RCRD
Hope this helps,
Raj.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 12:36 PM
05082010 12:36 PM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
thanks for the quick response!
To be honest, I haven't read the weblink in detail, although I had scanned it before.
It seems to me that the weblink describes the IEEE format (which is the format that HPUX systems use today, I think. At least our HPUX system at work use IEEE format.)
Sometime between 19952010 HPUX seems to have made a switch between an old "HP floating format" and the current IEEE format.
As I said, I haven't read the weblink in detail, so I ought to do that.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 01:48 PM
05082010 01:48 PM
SolutionAsk Google? I was led to:
http://docs.hp.com/en/B390690006/go01.html
(The rest of the manual looks as if it might
be interesting, too, but IEEEcentric.)
> 2. how do I treat the exponent (for IEEE
> format it is dependent on the coming
> fraction!)
Huh? For a given value and mantissa, I'd say
that the exponent is pretty well determined.
> 3. what about the 'Inf' and 'Nan' scenarios
For that, you may need actual info on the old
HP implementation.
Tiny clues (search for '"floating point" hp
1000'):
http://bitsavers.org/pdf/hp/1000/59538761_HP_1000_ASeries_Hardware_Technical_Data_Dec84.pdf
A diligent search might find more.
Get an emulator and poke around?
http://simh.trailingedge.com/hp2100.html
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 05:59 PM
05082010 05:59 PM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
It seems it is a normal bit.
>3. what about the Inf and NaN scenarios
It seems they weren't invented yet.
>It seems to me that the weblink describes the IEEE format
Yes and more specifically only Integrity. Steven has the URL for the PA version.
>Sometime between 19952010 HPUX seems to have made a switch between an old "HP floating format" and the current IEEE format.
Perhaps you mean 1985, when PARISC came out.
>Raj: what about: HPUX floatingpoint guide
Not hardly. That's only for Integrity. And a shorter URL is:
http://www.hp.com/go/fp
>Steven: > 1. what is the normalization bit?
http://docs.hp.com/en/B390690006/go01.html
This seems bogus. They seem to be the exact opposites. I.e. there seems to be an explicit bit for the HP 1000 but IEEE has a phantom bit, for all but denormalized numbers.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05082010 11:22 PM
05082010 11:22 PM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
Steven, on the small matter of the exponent, for IEEE format
0 00000001 00000000000000000000000 = +1 * 2**(1127) * 1.0 = 2**(126)
0 00000000 10000000000000000000000 = +1 * 2**(126) * 0.1 = 2**(127)
where the 0.1 and 1.0 are binary numbers. I interpret the above as showing that the IEEE exponent is dependent on the coming fraction. I found the above example at
http://www.psc.edu/general/software/packages/ieee/ieee.php
I was concerned that a similar exception might arise for the old HP format!
Anyway thanks again for the constructive inputs.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05092010 10:12 AM
05092010 10:12 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
The latter is a denorm. I.e. the mantissa is interpreted differently depending on the exponent field, not the other way around.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05102010 10:21 AM
05102010 10:21 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
able to write a small amount of code to
convert HP format to IEEE. We have such
code in one of our products, taking about
200 lines of C (including comments).
Example header:
real32 mpe_real32_to_ieee32 (int32 *status, uint32 input);
// possible status values:
// C2I_OK (which is 0)
// C2I_EXPONENT_OVERFLOW
// C2I_EXPONENT_UNDERFLOW
// C2I_DENORMALIZED_CONVERSION
I.e., there are some special cases the
caller needs to handle.
If you're interested in discussing this
offline, email me at sieler@allegro.com
(Our product source code refers to the HP
format reals as "MPE reals", because the
focus of the product was on the HP 3000
... but they're the same reals as used
on the HP 1000.)
Stan
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05102010 11:10 AM
05102010 11:10 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
like "mpe_real_32_type" for the input
parameter (the MPE 32bit realbyvalue)?
For various reasons, our code is picking
up 32bit (or 64bit) packets), determining
their type (IEEE real, MPE real, ascii text,
32bit int, other), and then calling
an appropriate conversion routine. I.e.,
the data isn't really a 32bit integer,
but is just a packet of 32 bits.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05112010 01:59 AM
05112010 01:59 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
Tim wants HP 1000 floating point not HP 3000.
>I.e., there are some special cases the caller needs to handle.
Yes, since they don't fit.
>but they're the same reals as used on the HP 1000.)
That's not what my ACD says about HP 3000:
S  9 bit exponent bias +256  binary point  22 bit fraction
This doesn't match Tim's first URL. I would assume left hand, right hand issues would make them incompatible.
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05112010 03:26 AM
05112010 03:26 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
Using Steven's link
http://bitsavers.org/pdf/hp/1000/
I was able to find the "HP 1000 Computer Programming Reference Manual". This manual confirms the (32 bit) floating point data format that was given in my earlier link
http://www.hp.com/products1/rte/tech_support/files/guru98column.txt
Whilst the reference manual doesn't explicitly refer to a normalization bit it does state that the "Floating point numbers are considered normalized when the mantissa sign bit and adjacent bit are opposite in polarity". So the (32 bit) data structure given in these two links seems consistent.
However the manual does not explicitly state (for dummies like me) how to "treat" the bits. I had assumed something like,
decimal number
= 2**(exp*esign) * [b + (1n)]*sign
where
exp = the exponent bits converted to decimal
esign = the sign of the exponent
n = normalisation bit (0 if normalized?)
b = binary number relating to fraction/mantissa
sign = sign of fraction
But so far this has not produced the desired conversion. To assist me, I fortunately (or unfortunately ... depending on whether it is a redherring) have a 32 bit HP float binary on file for which I believe the decimal answer = 0.05
I have converted the 4 byte binary data to bits (using python and bitarray). I have used this approach (python/bitarray) before to check if I can read/decipher a standard IEEE 4 byte real, and succeeded, so I think python/bitarray is doing an adequate conversion from bytes to bits. The resulting bit pattern for the HP 1000 float which I believe should be a decimal of 0.05 is
bits = 01101000 11010110 01001110 11110101
bits = 00010110 01101011 01110010 10101111
One is big endian (the other little!). HPUX is big endian but I am reading on windows so I cannot be entirely confident which of the above to use. So I am in the process of trial and error, hoping that the above bit pattern is indeed equal to a decimal of 0.05.
Of course the above bit pattern may be a redherring (for which I apologies wholeheartedly in advance), but if someone fancies a challenge over their lunch break and manages to crack the pattern ... :)
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05112010 04:31 AM
05112010 04:31 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
Please use "HP 1000 float" and not HP. There are probably N chauvinistic HP computers that just used just "HP" so don't fall into that trap.
>The resulting bit pattern for the HP 1000 float which I believe should be a decimal of 0.05 is
bits = 01101000 11010110 01001110 11110101
bits = 00010110 01101011 01110010 10101111
>One is big endian (the other little!).
No, that's not how scummy little endian works. Only the bytes are swapped, not the bits.
>hoping that the above bit pattern is indeed equal to a decimal of 0.05.
The pattern for .05 for IEEE is: 3d4ccccd
So you need to find a pattern of 11001100...
 Tags:
 little endian
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05112010 11:54 PM
05112010 11:54 PM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
float:
3d4ccccd 0.050000
S:0 E:5 M:0x4ccccd
S:0 M:1.10011001100110011001101 E:0000101 1
double:
3fa999999999999a 0.050000
S:0 E:5 M:0x999999999999a
S:0 M:1.1001100110011001100110011001100110011001100110011010 E:0000000101 1
Note: The last bit of the M field needs to be removed as not fitting in the HP1000 format.
So .05 appears to be:
0 1.1001100110011001100110 0000101 1
The M field may be twos complement to match the comment about "opposite in polarity".
 Mark as New
 Bookmark
 Subscribe
 Subscribe to RSS Feed
 Permalink
 Email to a Friend
 Report Inappropriate Content
05122010 12:18 AM
05122010 12:18 AM
Re: HP floating point format (HP 1000)
Re: HP floating point format (HP 1000)
I agree, I think I should be certainly looking for this 1100... pattern.
It seems I first need to check the bit pattern that I am producing with this bitarray tool.
Then I need to try and confirm 0.05 is indeed the decimal number represented by the 4 bytes. There is a tool on our HPUX system called FCHI which actually does the conversion from HP 1000 float to IEEE for me. I believe FCHI is a black box routine provided by HP, but it should at least provide confirmation of the input data and final result.
If (and it's a big IF) I manage to write the conversion routine from HP 1000 float to IEEE, I will place the conversion routine (albeit in python) on the email thread in recognition of everyones' input and to save future bother for other unfortunates like me! But as I am writing these routines "after hours" it might still take a few weeks to resolve.
Hewlett Packard Enterprise International
 Communities
 HPE Blogs and Forum
© Copyright 2018 Hewlett Packard Enterprise Development LP