Floating point conversion TSO -> Unix 
Author Message
 Floating point conversion TSO -> Unix

Hello again,

I'm converting a TSO - fortran program to Unix. This program reads some binary
files. These files should be read in Unix too. Now it seems that the TSO and Unix
have different formats for REAL*4 numbers.
TSO:  1 sign bit, 7 bit exponent and 24 bit fraction
Unix: 1 sign bit, 8 bit exponent and 23 bit fraction

Has anyone written a conversion program or can point me how to do this?

Thanks
Matthias



Wed, 18 Jun 1902 08:00:00 GMT  
 Floating point conversion TSO -> Unix

Quote:

> Hello again,

> I'm converting a TSO - Fortran program to Unix. This program reads some binary
> files. These files should be read in Unix too. Now it seems
> that the TSO and Unix have different formats for REAL*4 numbers.
> TSO:  1 sign bit, 7 bit exponent and 24 bit fraction
> Unix: 1 sign bit, 8 bit exponent and 23 bit fraction

> Has anyone written a conversion program or can point me
> how to do this?

> Thanks
> Matthias

There is also the difference of how the exponent and
fraction are stored...I believe that the IBM one has
a signed exponent, and a "full" fraction, where the
unix one is probably a 256-biased exponant, and the
fraction has an implied "1" in it somewhere...

Depending on how critical the data is, the easiest
and safest way to transfer the data might be to
convert it to text file, and transfer the text file
(remembering EBCDIC -> ASCII) and then read it back
in to another binary file...at least, that way you
could have some visual verification of the data as
a check...

--

Buz          (8

+---------------------------------------------------------+
| Our protection and peace ... depend on our nearness to  |
|   God, not our distance from danger.                    |
| -- Mrs. Ray Rising                                      |
+----------------------------------+----------------------+
| This is official written notice: | My real address is:  |
|   Please remove me from your     |   lnuslad dot dzvg41 |
|   mailing list.                  |    at eds dot com    |
+----------------------------------+----------------------+



Wed, 18 Jun 1902 08:00:00 GMT  
 Floating point conversion TSO -> Unix

Quote:
> the TSO and Unix have different formats for REAL*4

Yes, the IBM 360 format was base 16, so it was not possible to suppress the
high order bit of the fraction.  So, in the conversion (assuming your Unix
machine uses IEEE format), the exponent must be multiplied by 4 with an
adjustment in the bias.  The leading 0's in the fraction must be shifted out
and their count subtracted from the exponent.  Over- and under-flow cases must
be dealt with.  And, of   course, you must know what byte order your Unix
machine uses.  Maybe, if you don't have access to the original machine, you can
build the data literally as
SIGN*16**(EXPONENT-64)*FRACTION.
Tim Prince



Wed, 18 Jun 1902 08:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. vax floating pont to unix floating point

2. An alternative to floating point (was Re: Floating point non-exactness)

3. IBM 370 Floating point to IEEE floating point

4. need floating point conversion method

5. Floating point data conversion

6. floating point conversion

7. IS Floating Point Conversion

8. floating point conversion

9. Slow floating point to integer conversion in VC++ -- Pentium Pro/II

10. Floating point to string conversion

11. Conversion algorithm between IEEE floating point and old Microsoft Binary Format

12. Fast conversion of float to 32.32 fixed point

 

 
Powered by phpBB® Forum Software