Carp provides for 'misreporting' the location of errors via $Carp::CarpLevel = 1;
Yep - that does it nicely. (After I posted the sopw I realised that particular question didn't have a real lot to do with "XS", "C doubles", or "-Duselongdouble" :-)
In that respect, when the XS code is compiled, the C compiler probably is yelling about it
Haven't noticed any complaints from gcc - even if the SvNV() is not explicitly cast to a double. On windows, with an MSVC-built perl, you aren't going to get a "proper" -Duselongdouble build of perl ... in that any Microsoft compiler that knows about long doubles will tell you that sizeof(long double) == sizeof(double) == 8. With MinGW, it should be theoretically possible to build a -Duse64bitint and -Duselongdouble build of perl .... but since MinGW uses the msvcrt.dll runtime library, I don't think it would be possible for such a perl to printf() the long double values correctly.
I generally resort to adding an obviously fatal error at the end of the inline C
The idea of the use Inline C => Config => BUILD_NOISY => 1; is that it provides verbosity (including any compiler warnings), thus eliminating the need to take such measures.
It could attempt to detect whether the number of significant bits set in the mantissa of the long double exceeds 53
Yes - that's what I was trying to think of. It's just a matter of finding the position of the least significant (set) bit in the argument that's given to perl_foo(). It's the perl code (the 'perl_foo' function to be precise) that needs to determine whether there has been a loss of precision.
Thanks BrowserUk.
Cheers, Rob | [reply] [d/l] [select] |
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.
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] |
Gah. How stupid is that.
Stupidity is hard to quantify ... so I'm therefore relieved that the question was rhetorical :-) I was recently directed to http://blogs.msdn.com/ericflee/archive/2004/06/10/152852.aspx ... which I found to be rather interesting, somewhat amusing, and a little disturbing.
Cheers, Rob
| [reply] |