Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Progress > Re: Modulo func...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 4 of 5 Topic 905 of 980
Post > Topic >>

Re: Modulo function in progress 4gl

by google@[EMAIL PROTECTED] Aug 2, 2007 at 06:10 AM

On Aug 2, 12:35 pm, Claus <socaciu.clau...@[EMAIL PROTECTED]
> wrote:
> Actually is not what i wanted.
>
> The problem is to calculate the modulo of a integer number  of 30
> digits long.

Hi Claudiu,

Not sure if you are looging at doing this in Progress and if so the
problem will be that it does not sup****t integers of that size, what
you can do is use a decimal and create your own function.

def var aa as dec no-undo.

function fModulo returns dec
   (longNum as dec, longNum2 as dec) forward.

aa = 123456789012345678901234567890.

message "ans --> " fModulo (aa,9996614.0).

function fModulo returns dec (longNum as dec, longNum2 as dec).

    def var i as int.

    if longNum <  2147483647 and
       longNum2 < 2147483647 then
       return dec(longNum modulo longNum2).

    assign longNum  = truncate(longNum,0)
           longNum2 = truncate(longNum2,0).

    return truncate(longNum - (longNum2 * truncate((longNum /
longNum2),0)),0).

end.
 




 5 Posts in Topic:
Modulo function in progress 4gl
Claus <socaciu.claudiu  2007-07-16 13:34:48 
Re: Modulo function in progress 4gl
progcat@[EMAIL PROTECTED]  2007-07-31 16:02:51 
Re: Modulo function in progress 4gl
Claus <socaciu.claudiu  2007-08-02 11:35:22 
Re: Modulo function in progress 4gl
google@[EMAIL PROTECTED]   2007-08-02 06:10:16 
Re: Modulo function in progress 4gl
Claus <socaciu.claudiu  2007-08-06 06:44:42 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 23:38:33 CST 2008.