× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: Re: RPGIV math function
  • From: Scott Klement <klemscot@xxxxxxxxxxxx>
  • Date: Mon, 4 Dec 2000 23:38:14 -0600 (CST)


Hello,

I'm new to this list, but I've been hanging out on RPG400-L for a long
time, now. :)   You might have more luck asking your questions there,
since there are many RPG experts reading the list.

You can call any standard C function from RPG IV without needing the C
compiler.  You need to create your own prototypes for the C functions,
then just bind to the QC2LE binding directory to use the function.

Put this in your RPG D-specs:

D log             PR             8F 0 extproc('log')                   
D   x                            8F 0                                   

and when you do your CRTPGM or CRTBNDRPG add "BNDDIR(QC2LE)" to the
compile command.

In your C specs, you can just do

C                 eval     myvar = log(whatever)


Doing exponents is built into the language with the "**" operator.

C                 eval     X = Y ** 2



You can also do a lot of math stuff with the CEE API's, as well.  If this
idea interests you, you might check out the manual in your softcopy
library or online...

OS/400 Integrated Language Environment (ILE) CEE APIs


If you want more detail, please ask it on the RPG list.  

Hope that helps!



On Mon, 4 Dec 2000, Trevor wrote:

> Can anyone help?
> 
> I have to calculate the exponent of a number (e raised to the power of that
> number where e = the natural logarithm 2.71828182845904). Given I have no C
> compiler and I need to access this from RPGIV, how can I create/access a
> procedure that would do this?
> 
> Thanks in advance,
> Trevor
> 

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

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.