× 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: Source for cube root calculation
  • From: "Richard Thomas" <RichardThomas@xxxxxxx>
  • Date: Wed, 21 Feb 2001 13:21:32 +0300

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 thread ...


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.