Double precision float - Incorrect Format!

cc9P9215 double precision floating point number problem.
So that those of you out there don’t spend a week tearing your hair out over this problem here you go. The digi double precision floating point representation does NOT follow IEEE 754 recommendations. Therefore when communicationg doubles outside of the system it is necessary to do additional byte swapping (in addition to the normal hton or ntoh swap) The Digi representation is in the following order;
Byte Number from IEEE754 [0] to [7], Digi [4][5][6][7][0][1][2][3]. Once you know it is easy to accomodate, see below;

double ntohd(char* netDoubleIn){ //provide pointer to input array

char* tmpDbl;
double retVal;

tmpDbl = (char*)&retVal;
tmpDbl[0] = netDoubleIn[3];
tmpDbl[1] = netDoubleIn[2];
tmpDbl[2] = netDoubleIn[1];
tmpDbl[3] = netDoubleIn[0];
tmpDbl[4] = netDoubleIn[7];
tmpDbl[5] = netDoubleIn[6];
tmpDbl[6] = netDoubleIn[5];
tmpDbl[7] = netDoubleIn[4];

return(retVal);
}

Hope this helps someone, feedback always appreciated. [:)]
ps: don’t forgot you need to do the same swap for a hton