|
Below is a little demo program that produces what are, to me,
unpredictable results. This is a exercise in using C library
functions. The program was compiled under v3r7 using activation
group *caller and binding directory qc2le.
The first and second calls execute correctly. The third call returns
a value that appears to be ln(ln(2)). It's not an artifact of using
2 for the function argument--it returns the same value for other
numbers also. The same code works fine if the function argument is
initialized each time using the %float() function.
I'm sure there's something I'm missing here. Any suggestions.
JEFTST/QRPGLESRC
SEU==>
NATLOG3
*************** Beginning of data
**********************************************************************
**
***************
0004.00 Dlogc pr 8f extproc('log')
0005.00 Darg 8f
0006.00 D
0007.00 Dlog s 8f
0008.00 Ddog s 8f
0013.00 D*
0014.00 C eval dog = 2.0
0015.00 C eval log = logc(dog)
0016.00 C
0021.00 C eval dog = %float(2.0)
0023.00 C eval log = logc(dog)
0024.00 C
0030.00 C eval log = logc(dog)
0031.00 C
0034.00 C eval *inlr = *on
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* This is the RPG/400 Discussion Mailing List! To submit a new *
* message, send your mail to "RPG400-L@midrange.com". To unsubscribe *
* from this list send email to MAJORDOMO@midrange.com and specify *
* 'unsubscribe RPG400-L' in the body of your message. Questions should *
* be directed to the list owner / operator: david@midrange.com *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.