in reply to Writing IBM Mainframe floating point

caden varn:

It seems that the IBM Mainframes support multiple floating point formats. The wikipedia page shows the binary formats for them, and under "Special uses" mentions that SAS 5 Transport files use an IBM format rather than the IEEE format.

It looks like a relatively simple format* so you should be able to convert between them with a little bit of bit masks, shifts, and such.

Note: Relatively simple in that there are few fields, and that the IEEE-754 page and the IBM floating point page describes them fully. However, you'll still have to decide what to do in the oddball cases: NaN, *Inf, exponents out of range, deciding how to handle the extra/missing mantissa bits, etc.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

  • Comment on Re: Writing IBM Mainframe floating point