Previous: Number Theoretic Functions, Up: Enhanced Number Types [Contents][Index]

This section is an unstructured assortment of new functions or functions which change their behaviour in an ENT-build.

- Function:
**current-btime** Return the current time, as the number of microseconds since 1970-01-01 00:00:00. The time is returned as a big integer.

(current-btime) ⇒ 1131714421468312 (current-btime) ⇒ 1131714424362856

With `current-btime`

some of the functions of the
‘`time-date`’ library can be quickly rewritten.

Compare

(/ (current-btime) (bigfr 86400000000)) ⇒ 13098.5557760026967592

to

(time-to-number-of-days (current-time)) ⇒ 13098.55588377945

Also, conversions from ordinary time conses to big time integers and vice versa are supported.

- Function:
**time-to-btime***specified-time* Return a big integer from

`specified-time`with the number of microseconds since the Epoch.

- Function:
**btime-to-time***specified-time* Return a time specified as (high low usec) as obtainable from

`current-time`

from`specified-time`.

(time-to-btime (current-time)) ⇒ 1131959836543525

(btime-to-time 1131959836543525) ⇒ (17272 22044 543525)

Of course, existing time functions are changed when SXEmacs is compiled with ENT enabled, such that they take both, time cons cells and big integer time values. We do not list the respective functions here again.

- Function:
**encode-btime***&rest arguments* Like ‘encode-time’ but return a big integer time instead.

Having ENT enabled the `random`

function may return
pseudo-random integers of unlimited size. However, called without the
optional limit argument, `random`

always returns an ordinary
integer (‘`int`’).

- Function:
**random***&optional limit* Return a pseudo-random number. All integers representable in Lisp are equally likely. On most systems, this is 31 bits’ worth.

With positive integer argument

`limit`, return random number in interval [0,`limit`).`limit`can be a big integer, in which case the range of possible values is extended.With argument

`t`

, set the random number seed from the current time and pid.

(random (factorial 20)) ⇒ 2391898294963683867 (random (factorial 20)) ⇒ 1300461496957250511

- Function:
**randomb***limit* Return a uniform pseudo-random number in the range ‘

`[0, 2^`’.`limit`)

Having ENT and the residue class subfeature enabled the sequence accessor functions accept residue classes as their input. This is a neat feature when round-robins over sequences are regarded.

(let ((v (make-vector 12 0)) (rr 0+12Z) (i 0)) (while (<= (aref v rr) 43) (aset v rr i) (incf rr) (incf i)) v) ⇒ [48 49 50 51 52 53 54 55 44 45 46 47]

The above example shows a counter (`rr`) which can be
continuously incremented without the need to check if its value is
still in the bounds of the vector. The same snippet with `rr`
being set to `0`

would survive for 12 cycles and then yield:
‘`Args out of range: [0 1 2 3 4 5 6 7 8 9 10 11], 12`’.

Previous: Number Theoretic Functions, Up: Enhanced Number Types [Contents][Index]