Handling Reversed Byte OrderThis problem was corrected in Origin 5.0.
To get correct values in version 4.1 you could take one of two approaches:
1.In-Line Processing
In this method each value is read and fixed one-by-one. Here are algorithms that handle Float and Double types after reading bytes into variable n1, n2, n3, etc. (up to n4 for Floats and n8 for Doubles).
// Reverse FLOAT
si=(n1&128)==128?-1:1;
ex=2^(((n1&127)*2+(n2&128)/128)-128);
if(ex==2^-128) ex=0;
ma=(((128+n2&127)*256+n3)*256+n4)/2^22;
n=si*ma*ex; // This is the true value
// Reverse DOUBLE
si=(n1&128)==128?-1:1;
ex=2^((((n1&127)*16)+(n2&240)/16)-1024);
ma=(((((((16+n2&15)*256+n3)*256+n4)*256+n5)*256+n6)*256+n7)*256+n8)/2^51;
n=si*ma*ex; // This is the true value
2.Post Processing
In this method a column of data is corrected by a conversion factor. This is easier for integer numbers than floating point numbers. For example, for the conversion of a column of integers you could use
col(A) = 256 * (col(A)&255) + (col(A)&65280) / 256
A conversion for Float or Double would be more complicated since it would require transforming the algorithms above into single expressions.
Any math gurus out there?