FSTAT

Return the value of the last floating point call

 

 

VSupported on OpenVMS

 

xcall FSTAT(^REF(descrip)[, source_type])

Arguments

descrip

A user-created descriptor that must be fully constructed by the programmer and passed by reference. The descriptor specifies the address where the data is to be written and the data type that is to be written. (n)

source_type

(optional) The format in which the result was returned from the floating point function invoked using the FXSUBR subroutine. (n)

Discussion

This subroutine returns the value of the result of the last floating-point function called through the FXSUBR subroutine. The data type field of descrip determines how FSTAT translates the value. You can set up a descriptor for OpenVMS floating-point data types, and thereby retrieve the result in a format suitable for passing directly back into another floating-point function.

Source_type specifies what type of floater the result was, or what kind of routine was called. This can either be specified as a letter (“F,” “D,” “G”) or a number indicating the OpenVMS data type as defined in DBLSTARLET:$DSCDEF.DBL, DSC$K_DTYPE_F, DSC$K_DTYPE_D, DSC$K_DTYPE_G.

See also

Examples

The following program demonstrates how to encode floating point values from Synergy DBL, how to pass them to an OpenVMS routine, how to retrieve the result as a floating point value for passing into another OpenVMS routine, and how to retrieve the value into a Synergy DBL implied-decimal field.

main MATH
.include "$DSCDEF" library "dblstarlet" ;Needed for creating descriptor
.align QUAD
record
  group flt_desc  ,a              ;Descriptor pointing to
      flt_length  ,i2             ; d_float, "casting" it as an
      flt_dtype   ,i1             ; OpenVMS D_FLOAT
      flt_class   ,i1
      flt_addr    ,i4
  endgroup
  d_float         ,i8             ;Where we store the native D_FLOAT
  sin_rtn         ,d_addr         ;Address of sine routine
  asin_rtn        ,d_addr         ;Address of arcsine routine
  number          ,f28.10         ;Start number
  result          ,f28.10         ;Result
proc
    xcall flags(7000000,1)
    open(1, o, "TT:")
    flt_desc.flt_class = DSC$K_CLASS_S
    flt_desc.flt_dtype = DSC$K_DTYPE_D
    flt_desc.flt_length = ^size(d_float)
    flt_desc.flt_addr = ^addr(d_float)
;   Start standard OpenVMS descriptor for a D_FLOATING data type
    sin_rtn = ^xtrnl(MTH$DSIND)
    asin_rtn = ^xtrnl(MTH$DASIND)
;   Store addresses of routines for fxsubr
    number = 30.00
;   Set up Synergy DBL implied-decimal
    xcall lib$cvt_dx_dx(number, ^ref(flt_desc))
;   Convert the number to the D_FLOAT - descriptor tells routine
;   what to convert from and to.
    xcall fxsubr(sin_rtn, ^ref(d_float))
;   Call the OpenVMS math function.
    xcall fstat(^ref(flt_desc), "D")
;   Return the floating point return value into
;   our floating point descriptor. The "D" tells the routine to
;   convert FROM D_FLOAT format
    xcall lib$cvt_dx_dx(^ref(flt_desc), result)
;   Convert it to decimal.
    writes(1, "The sine of " + %string(number) +" is " + %string(result))
    xcall fxsubr(asin_rtn, ^ref(d_float))
;   Call the inverse function.
    result = %fstat(DSC$K_DTYPE_D)
;   Return the floating point return value into our implied-dec.
;   We must inform FSTAT what float format to convert FROM.
    writes(1, "The arc sine of the sine of " + %string(number) + " is " + %string(result))
    stop
endmain