From: Boris Gubenko (Boris.Gubenko_at_[hidden])
Date: 2006-12-08 08:53:13
Johan Rede wrote:
> It may be overkill to try to handle the VAX FP modes.
> But maybe I should trigger a compile time assertion if they show up.
> Is there any way to detect AlphaVMS without /float=ieee at compile time?
Yes, based on the value of __IEEE_FLOAT macro.
On all the platforms: Tru64, AlphaVMS, iVMS and Linux, when IEEE
floating-point mode is in effect, the cxx compiler predefines
__IEEE_FLOAT macro as 1, otherwise it predefines it with a value
While only VMS supports multiple floating-point modes, conditionalization
below will be correct for all the platforms the cxx compiler supports:
#if defined(__DECCXX) && !__IEEE_FLOAT
# VAX FP mode
Or you can explicitly conditionalize for VMS:
#if defined(__DECCXX) && defined(__vms) && !__IEEE_FLOAT
# VAX FP mode
> Can you get the VAX FP modes on iVMS through compiler flags?
Yes: /float=g_float and /float=d_float.
>> float: -n.min/2 00 00 00 00
>> double: -n.min/2 00 00 00 00 00 00 00 00
> = positive zero
>> float: -n.min/2 80 00 00 00
>> double: -n.min/2 80 00 00 00 00 00 00 00
> = negative zero
Does it represent a problem on either platform or this is
> Wait, I'm a bit confused. Are you telling me that the Itanium processor
> supports the VAX FP modes?
No, it does not.
> Or is the VAX FP support done through software? Wouldn't that be very slow?
It is software emulation which is, obviously, slower than native IEEE, but
I don't have performance numbers at hand.
We encourage customers to use IEEE on both Alpha and Itanium. On Alpha,
most C++ customers are still using G_FLOAT, the default, but after the
IA64 port, there is a real push to use IEEE on both platforms, especially
in mixed-architecture environment.
> The VAX FP modes do not support denormals, infinity and NaN, right?
> We just need to able to detect the VAX FP modes at compile time.
In VAX FP modes, __IEEE_FLOAT macro is defined as zero.
Btw, there is another macro which can be used to distinguish between full
IEEE support (-ieee on Tru64 and /ieee=denorm on VMS) and fast IEEE mode
(which does not have NaNs and Infinity). This macro is _IEEE_FP which is
defined when IEEE support is enabled and not defined otherwise.
Based on the results I posted yesterday, is it correct to say that fpclassify
library passes the tests on both VMS platforms?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk