| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
* tests/013/well512a.tl: New file.
* tests/013/well512a.expected: New file.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* rand.c (rand32_bug): New static function formed by
renaming the original buggy rand32.
(rand32_good): Copy of rand32 with two bugfixes. The term
involving variable r2 must be only left shifted by 28 bits,
and not xor-ed with the original value. The order of
operations is wrong in the term that contains the & operation.
(rand32): New static function pointer variable, serving
as the rand32 function. Points to rand32_good by default.
(rand_compat_fixup): Test for 243 or lower compatibility,
under which rand32 is made point to rand32_bug. This is done
before the call to make_random_state for replacing
*random-state*, which has to use the old function.
* txr.1: compat note added.
* tests/013/maze.expected: Updated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The purpose is to eliminate any biases in
the PRNG arising out of the regularity of that pattern, so
that the behavior of successive values is good from the
beginning.
This doesn't solve the problem that a short warm-up period
leads to a poor distribution of initial values relative to the
seed space. In other words, that similar seeds lead to
initially similar sequences.
* rand.c (rand_tab): New static array.
(make_random_state): Set uninitialized parts of state from the
corresponding elements in rand_tab, rather than to the
0xAAAAAAAA values.
(rand_compat_fixup): In 139 compatibility mode, clobber
rand_tab with 0xAA bytes.
* tests/013/maze.expected: Updated.
* txr.1: Added some PRNG implementation notes, and
also compatibility notes.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This mistake causes wasteful behavior for power-of-two
moduli in the random function, in both the bignum and
fixnum cases. For instance, the modulus 16 is taken
to be 17 bits wide. But we really want the width 16:
the number of bits needed for values in the range [0, 16).
The result isn't wrong, but the loop generates 17-bit
random numbers, and then throws away those which equal
or exceed the modulus, which is wasteful.
* mpi/mpi.c (mp_is_pow_two): New function.
* mpi/mpi.h (mp_is_pow_two): Declared.
* rand.c (random): In bignum case, after counting
bits in the modulus, subtract 1 if the modulus is a power
of two. In the fixnum case, subtract 1 from the modulus
and then count the bits in the reduced value.
* tests/013/maze.expected: regenerate due to different
prng behavior.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* eval.c (eval_init): Register intrinsic functions rcons,
rangep from and to.
(eval_init): Register rangep intrinsic.
* gc.c (mark_obj): Traverse RNG objects.
(finalize): Handle RNG in switch.
* hash.c (equal_hash, eql_hash): Hashing for for RNG objects.
* lib.c (range_s, rcons_s): New symbol variables.
(code2type): Handle RNG type.
(eql, equal): Equality for ranges.
(less_tab_init): Table extended to cover RNG.
(less): Semantics defined for ranges.
(rcons, rangep, from, to): New functions.
(obj_init): range_s and rcons_s variables initialized.
(obj_print_impl): Produce #R notation for ranges.
(generic_funcall, dwim_set): Recognize range objects for indexing
* lib.h (enum type): New enum member, RNG. MAXTYPE redefined
to RNG value.
(TYPE_SHIFT): Increased to 5 since there are now 16 type
codes.
(struct range): New struct type.
(union obj): New member rn, of type struct range.
(range_s, rcons_s, rcons, rangep, from, to): Declared.
(range_bind): New macro.
* parser.l (grammar): New rule for recognizing
the #R sequence as HASH_R token.
* parser.y (HASH_R): New terminal symbol.
(range): New nonterminal symbol.
(n_expr): Derives the new range symbol.
The n_expr DOTDOT n_expr rule produces rcons expression rather
than const.
* match.c (format_field): Recognize rcons syntax in fields
which is now what ranges translate to. Also recognize range
object.
* tests/013/maze.tl (neigh): Fix code which destructures
range as a cons. That can't be done any more.
* txr.1: Document ranges.
|
|
* Makefile (tst/tests/013/maze.out): Add TXR_ARGS. Disable
gc-debugging for tests in new directory.
* tests/013/maze.expected: New file.
* tests/013/maze.tl: New file.
|