| | | **Particular routines for INTEGERobjects** |

### Particular routines for INTEGERobjects

The *make, select, change, build* routines are the basic routines,
let us now look at some particular
ones:
The following routine allows to evaluate the number of digits:
- Its NAME is
*intlog,*
- and the SYNOPSIS is
*INT intlog(OP integerobject).*
- The DESCRIPTION: It computes the number of digits of the
INTEGERobject.
The result is the return value, which is always
*>0.*

For the generation of random INTEGERobjects, look at
the following codefragment:
...
INT i;
...
scan(INTEGER,upper);
scan(INTEGER,lower);
for (i=0L;i<1000L;i++)
{
random_integer(result,lower,upper);
println(result);freeself(result);
}
...

which prints 1000 random numbers between the upper and lower
bound. Because this is a lowlevel routine, you have to free
the result object, before you call the routine.
The description of this routine for *the generation of
random integers* reads as follows:
- The NAME:
*random_integer *
- The SYNOPSIS:
*INT random_integer(OP result,lower,upper).*

- The DESCRIPTION: It computes a random INTEGERobject, between upper and lower
bound, which both must be INTEGERobjects. There is no check, whether
these are INTEGERobjects. If lower is NULL, then the default is 0.
if upper is NULL, the default is lower+10
- The RETURN: the returnvalue is OK or ERROR if an error occured
- Possible BUGS: as the random routine is not well implemented on most
systems,
*random_integer* shows sometimes very non random results.

There is also a routine for *testing* the implementation of INTEGERobjects:
- NAME:
*test_integer*
- SYNOPSIS:
*INT test_integer()*
- DESCRIPTION: It tests the implementation of INTEGERobjects.

harald.fripertinger@kfunigraz.ac.at,

last changed: November 19, 2001

| | | **Particular routines for INTEGERobjects** |