Image.cpp
static double
ML_VaxFloat(unsigned nVaxFloat)
{
    union {
        unsigned        nVax;
        float           fIEEE;
        unsigned char   rgnBytes[4];
    } u;
    unsigned char nTmp;

    u.nVax = nVaxFloat;
    nTmp = u.rgnBytes[0];
    u.rgnBytes[0] = u.rgnBytes[2];
    u.rgnBytes[2] = nTmp;
    nTmp = u.rgnBytes[3];
    u.rgnBytes[3] = u.rgnBytes[1];
    u.rgnBytes[1] = nTmp;
    return double(u.fIEEE)/4.0;     // avoid underflow by going to double
}
//
//  Convert NASA IBM tapes written with VAX floating point binary data
//  Note this entails byte ordering of VAX and also that imposed by IBM 9-track tape
//

Convert NASA IBM tapes written with VAX floating point binary data
Note this entails byte ordering of VAX and also that imposed by IBM 9-track tape
Convert NASA IBM tapes written with VAX floating point binary data Note this entails byte ordering of VAX and also that imposed by IBM 9 - track tape
static double
ML_VaxFloat(unsigned nVaxFloat)
{
    union {
        unsigned        nVax;
        float           fIEEE;
        unsigned char   rgnBytes[4];
    } u;
    unsigned char nTmp;
    u.nVax = nVaxFloat;
    nTmp = u.rgnBytes[0];
    u.rgnBytes[0] = u.rgnBytes[2];
    u.rgnBytes[2] = nTmp;
    nTmp = u.rgnBytes[3];
    u.rgnBytes[3] = u.rgnBytes[1];
    u.rgnBytes[1] = nTmp;
    return double(u.fIEEE)/4.0;     
}
static double ML_VaxFloat ( unsigned nVaxFloat ) { union { unsigned nVax ; float fIEEE ; unsigned char rgnBytes [ 4 ] ; } u ; unsigned char nTmp ; u . nVax = nVaxFloat ; nTmp = u . rgnBytes [ 0 ] ; u . rgnBytes [ 0 ] = u . rgnBytes [ 2 ] ; u . rgnBytes [ 2 ] = nTmp ; nTmp = u . rgnBytes [ 3 ] ; u . rgnBytes [ 3 ] = u . rgnBytes [ 1 ] ; u . rgnBytes [ 1 ] = nTmp ; return double ( u . fIEEE ) / 4.0 ; }
Convert NASA IBM tapes written with VAX floating point binary data
Note this entails byte ordering of VAX and also that imposed by IBM 9-track tape
Convert NASA IBM tapes written with VAX floating point binary data Note this entails byte ordering of VAX and also that imposed by IBM 9 - track tape
// avoid underflow by going to double
