|
Quick and dirty...
|
*============================================================================================= * Quick and dirty cube root routine. * Requires two parameters: * o Number to calculate the cube root for * o Cube root returned to the caller * I've set these parameters to five decimal positions, but you obviously can redefine them * according to your own needs. * * Compile this source using CRTBNDRPG and then you'll be able to call this routine in your * non-ILE programs. *============================================================================================= H DFTACTGRP(*NO) ACTGRP(*CALLER) BNDDIR('QC2LE') * Prototype for log10 function D Log10 Pr 8F ExtProc('log10') D 8F Value * Prototype for pow function D Pow Pr 8F ExtProc('pow') D 8F Value D 8F Value D Log S 8F Inz D CubeRoot S 8F Inz D Number S 8F Inz D InpNbr S 15P 5 D OutNbr S 15P 5 *============================================================================================= C *Entry PList C Parm InpNbr C Parm OutNbr C Eval Number = InpNbr C Eval Log = Log10(Number) C Eval Log = Log/3 C Eval CubeRoot = Pow(10:Log) C Eval OutNbr = CubeRoot C Return
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.