Re: IBM integer and double formats

2008-11-11 Thread Mark Dickinson
On Nov 11, 12:07 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > "All character data are stored in ASCII, regardless of the > operating system." But character data is not the same thing as numeric data. Okay--- you win again, John. > Sheesh. [...] Apologies for annoying you. Mark -- http://ma

Re: IBM integer and double formats

2008-11-11 Thread Mark Dickinson
On Nov 11, 11:36 am, John Machin <[EMAIL PROTECTED]> wrote: > > wants to write the converted float out to an ASCII file, in hex. > > Sheesh. It's an *IBM mainframe* file. It would need to be in EBCDIC, > not ASCII. But why guess? He said he wanted to write it out in SAS > XPORT format. Which is st

Re: IBM integer and double formats

2008-11-11 Thread John Machin
On Nov 11, 8:15 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Nov 10, 11:49 pm, John Machin <[EMAIL PROTECTED]> wrote: > > > Call me crazy if you like, but I'd name that function IEEEtoIBM. > > But it's topsy-turvy day!  Didn't you get the memo? > > Oh, all right.  IEEEtoIBM it is. > > > That'

Re: IBM integer and double formats

2008-11-11 Thread Mark Dickinson
On Nov 10, 11:49 pm, John Machin <[EMAIL PROTECTED]> wrote: > Call me crazy if you like, but I'd name that function IEEEtoIBM. But it's topsy-turvy day! Didn't you get the memo? Oh, all right. IEEEtoIBM it is. > That's a hexadecimal representation in lowercase with no leading > zeroes ... vari

Re: IBM integer and double formats

2008-11-10 Thread John Machin
On Nov 11, 9:00 am, Mark Dickinson <[EMAIL PROTECTED]> wrote: > On Nov 10, 7:20 pm, "john.goodleaf" <[EMAIL PROTECTED]> wrote: > > > my own routines, does anyone know of an already-done means of writing > > integers and floats out to their IBM mainframe equivalents? > > Here's a quick attempt at co

Re: IBM integer and double formats

2008-11-10 Thread Mark Dickinson
On Nov 10, 7:20 pm, "john.goodleaf" <[EMAIL PROTECTED]> wrote: > my own routines, does anyone know of an already-done means of writing > integers and floats out to their IBM mainframe equivalents? Here's a quick attempt at converting doubles using Python. It uses the isnan and isinf functions that

Re: IBM integer and double formats

2008-11-10 Thread Mark Dickinson
On Nov 10, 8:16 pm, Mark Dickinson <[EMAIL PROTECTED]> wrote: > and how to handle out-of-range floats coming back (if I recall > correctly, the IBM format allows a wider range of exponents > than IEEE). > Whoops---wrong way around. It looks like it's IEEE that has the larger exponent range. DBL

Re: IBM integer and double formats

2008-11-10 Thread Mark Dickinson
On Nov 10, 7:20 pm, "john.goodleaf" <[EMAIL PROTECTED]> wrote: > does anyone know of an already-done means of writing > integers and floats out to their IBM mainframe equivalents? > I don't know of anything in Python that does this. There was a thread a while ago that may be relevant: http://mai

IBM integer and double formats

2008-11-10 Thread john.goodleaf
I'm poking at writing data out to a SAS XPORT file (transport file). Each record must be 80 bytes long, ASCII. Integers should be "IBM- style integers" and floats should be "IBM-style doubles." Now I have some idea what that means from reading a C source file documented by the SAS institute, but be