|
Hello,
I would like to use C math functions in a CL program... but most of those
functions use doubles.. which are not supported in ILE CL...
so my idea was to use QXXPTOD do convert to a internal value passed to the
math function and then convert the result back to packed
this is just an example of what I would like to work in CL
pgm
DCL VAR(&A) TYPE(*DEC) LEN(15 5) value(300)
DCL VAR(&B) TYPE(*DEC) LEN(15 5) VALUE(400)
DCL VAR(&C) TYPE(*DEC) LEN(15 5) value(0)
dcl &dblA *char 8
dcl &dblB *char 8
dcl &dblC *char 8
DCL VAR(&DIG) TYPE(*INT) VALUE(15)
DCL VAR(&DEC) TYPE(*INT) VALUE(5)
/* convert Packed decimal to Double */
CALLPRC PRC(QXXPTOD) PARM((&A *BYREF) (&DIG *Byval) ( &DEC
*byval)) RTNVAL(&DBLA)
CALLPRC PRC(QXXPTOD) PARM((&B *BYREF) (&DIG *Byval) ( &DEC
*byval)) RTNVAL(&DBLB)
/* call a C library Math function */
CALLPRC PRC('hypot') PARM((&DBLA *BYVAL) (&DBLB *BYVAL))
RTNVAL(&DBLC)
/*convert Double to Packed decimal */
CALLPRC PRC(QXXDTOP) PARM((&C *byref) (&DIG *Byval) ( &DEC
*byval) (&DBLC *byval))
endpgm
I know there are other ways and other languages but I am just trying to
understand why this is not working in ILE CL.
thanks
Paul
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.