vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| On Jul 16, 8:34 am, Claus <socaciu.clau...@gmail.com> wrote: > Hello, > > Does anyone know where to find the code of the MODULO function used in > progress. > > Thanks in advance. Claudiu. I think this is what you want: Try this program: display 10 mod 3. |
| |||
| On Aug 2, 12:35 pm, Claus <socaciu.clau...@gmail.com> 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 support 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. |
| ||||
| On Aug 2, 4:10 pm, goo...@devenv.com wrote: > On Aug 2, 12:35 pm, Claus <socaciu.clau...@gmail.com> 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 support 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. Thanks for this. It is what I wanted. |