![]() |
Software > OpenVMS Systems > Ask the Wizard ![]() HP OpenVMS Systemsask the wizard |
![]() |
The Question is: How can I determine if a variable contains an invalid floating point value prior to use in Fortran, using VAX F & D type floats. Looking to avoid a process crash with the following error: "SYSTEM-F-FLTINV, floating invalid operation". The Answer is : While pre-processing the floating point data is certainly a valid approach to solving the problem, it does slow the aggregate application performance when the data is most commonly found to be correct, when compared with no preemptive testing and a signal handler. While you could use cvt$convert_float -- as described in the OpenVMS RTL Library (LIB$) Manual for a test-conversion of the value -- and allow the routine to return a condition value of CVT$_NORMAL for valid floating-point format conversions and any of a variety of other values signaling various data errors -- the most appropriate approach here is likely to implement and utilize a signal handler to capture and repair the error should it arise. Fortran compilation with FORTRAN/FLOAT=IEEE/IEEE=DENORM_RESULTS or with /FLOAT=IEEE/IEEE=UNDERFLOW_TO_ZERO, or by isolating the potentially-bogus floating point math into one or more function calls, would be the approach used by the OpenVMS Wizard. (This for IEEE float, obviously.) Specifically with VAX formats and format conversions, you will have to compile the particular code module(s) with the appropriate floating point format selected, or you will have to generate code which knows the data format and performs the appropriate conversion. It is certainly possible to select the conversion at run-time (in-line code or shareable image activation or otherwise), but you are still required to know the format of the particular floating point data involved. The OpenVMS Wizard would encourage use of IEEE floating point formats on OpenVMS Alpha, as the native floating point format on OpenVMS I64 is IEEE. (On Alpha systems, there is no particular penalty for using the VAX formats, though -- as with any floating point conversions -- certain of the conversions involved can result in a loss of precision.)
|