in reply to Re^2: XS, C doubles and -Duselongdouble
in thread XS, C doubles and -Duselongdouble
It's just a matter of finding the position of the least significant (set) bit
It's probably quicker to just test that there are no bits set in the lowest 8 bits (64-52) of the mantissa. Those 8 bits are stored in the last (10th) byte of the real*10 representation. So it should just be a case of (assuming you have the 10 bytes packed in scalar)
if( substr $packedReal10, -1 ) { warn 'Loss of precision...'; }
any Microsoft compiler that knows about long doubles will tell you that sizeof(long double) == sizeof(double) == 8.
Gah. How stupid is that. You know, I have a funny feeling that I saw a set of 80bit real math functions kicking around inside one of the system DLLs. In theory, it would be possible to wrap a header file and an import library around that and get access to them from C/C++. I can't remember where I (think) I saw them and a quick grep didn't locate them. I'll have another look later.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: XS, C doubles and -Duselongdouble
by syphilis (Archbishop) on Jun 10, 2007 at 15:35 UTC | |
by BrowserUk (Patriarch) on Jun 10, 2007 at 17:03 UTC |