From: SMTP%"lionel@quark.enet.dec.com" 1-JUN-1993 13:09:04.28 To: EVERHART CC: Subj: Re: Converting D_FLOATS to G_FLOATS X-Newsgroups: comp.os.vms From: lionel@quark.enet.dec.com (Steve Lionel) Subject: Re: Converting D_FLOATS to G_FLOATS Message-ID: <1993Jun1.152152.16808@dbased.nuo.dec.com> Lines: 56 Sender: news@dbased.nuo.dec.com (USENET News System) Reply-To: lionel@quark.enet.dec.com (Steve Lionel) Organization: Digital Equipment Corporation, Nashua NH Date: Tue, 1 Jun 1993 15:21:52 GMT To: Info-VAX@KL.SRI.COM X-Gateway-Source-Info: USENET In article <1993May31.150932.1@slacvx.slac.stanford.edu>, fairfield@slacvx.slac.stanford.edu writes: |>In article <1udmf8$3qm@sun.Panix.Com>, sabu@panix.com (Sabu Bhatia) writes: |>> Has anyone ou there written a function in vaxc to convert D_FLOATS to G_FLOATS |>> using descriptors and LIB$* system calls. If so I would be greatful if you |>> could mail me a copy |> |> A careful reading of the OLD (or the FM) reveals that LIB$CVT_DX_DX |>_won't_ work for your purposes: it basically converts numeric bytes to text, |>or text to binary. This is not true, but I can certainly understand how you reached that conclusion based on what's in the manual. Indeed, the manual is SERIOUSLY confused, and I will bring this up to the writers. LIB$CVT_DX_DX will convert between any two atomic datatypes for which you can construct a valid descriptor. It can also convert atomic types to (or from) text, and it is this latter capability which most of the confusing manual text is attempting to describe. |> |> What _will_ work are a pair of routines in the MTH$ run-time library: |> |> d_float = MTH$CVT_G_D (&g_float); /* Convert G-floating to D-floating */ |> g_float = MTH$CVT_D_G (&d_float); /* Convert D-floating to G-floating */ Yes, these will also work and are the routines I would recommend for the purpose. Note that there are also variants (MTH$CVT_GA_DA and MTH$CVT_DA_GA) which convert arrays of values in one call. |> |>I did a quick search of the .H files in SYS$LIBRARY and failed to find |>function prototypes for these entries, so perhaps you'll have to do that |>yourself... Not being really up to speed on VAXC, perhaps someone else |>can enlighten us on where the MTH$ run-time library prototypes hide, or ??? |> Good question. I'd expect them to be in a MTH$ROUTINES.H, as there are similar files for other RTL facilities (LIB$, etc.), but this doesn't exist. Perhaps the VAX C folks thought that MATH.H, which defines most math intrinsics, would do instead? I'll pass along to them a suggestion that they also provide a MTH$ROUTINES.H. These routines are documented in the online HELP under HELP RTL. But I admit that the MTH$ facility is probably not the place most people would go to look for them. Our thinking at the time was that these routines "looked like" MTH$ routines, in that they returned a function value rather than a status as most (but not all) of the LIB$ routines do, and signal errors rather than returning a status. -- Steve Lionel lionel@quark.enet.dec.com SDT Languages Group Digital Equipment Corporation 110 Spit Brook Road Nashua, NH 03062