On Tue, Apr 28, 2015 at 8:35 AM, Alexander Burger wrote:
> Hi Christophe,
> […]
>n = (Seed >>> 32) % n;
>
> should it be OK?
Yes. It works. Great.
> Thanks for the input!
Thank you for considering it !
The 2)b) of my big email (april, 26th) of this thread was not answered but
I'll copy pas
Hi Christophe,
> Would it be possible to just cast (Seed >>> 32) to a long:
>
> if ((n = evInt(ex.Cdr) + 1 - ((Number)x).Cnt) != 0)
> n = (long)(Seed >>> 32) % n;
Yes, this seems to be a good idea.
The (long) cast should not be needed, as 'Seed' and 'n' already are long
numbers. So if I cha
On Mon, Apr 27, 2015 at 8:01 AM, Alexander Burger wrote:
> […]
> A shift of 32 bits, however, would not suffice, because
> it would put the sign bit of the original 64-bit number into the MSB of
> the result.
OK, I understand.
I have some more ideas to try to make the behaviors of
(rand m n) in
Hi Christophe,
> Alex, if nobody in the mailing list is against modifying the rand of
> Ersatz, may I humbly ask you to use >>>32 instead of >>>33 ?
Sorry, I think this is not a good idea. Now I remembered why the shift
is 33 and not 32:
It has to do with the fact that Java doesn't support unsig
On Sun, Apr 26, 2015 at 5:48 PM, Alexander Burger wrote:
> Hi Christophe,
>
> […]
>
>> return n>=0? n*2 : -n*2+1;
>>
>> This ensures the return value is non negative (?).
>> But why would not the result overflow?
>
> Yes, it may overflow. The above operation is to keep the sign bit in bit
> zero o
H Christophe,
> final static long initSeed(Any x) {
>
> Means it gives back a signed 64 bits integer for anything we threw at
> it (called x).
Yes.
> long n; for (n = 0; x instanceof Cell; x = x.Cdr) n += initSeed(x.Car);
>
> Is a recursive trick that walks through x (if walkable, ie Cell) an
Hi,
Still struggling. I'd like some help to find my mistake trying to understand
the Ersatz version of initSeed. The source is here, if you don't have it handy:
https://code.google.com/p/picolisp/source/browse/ersatz/sys.src#234
final static long initSeed(Any x) {
Means it gives back a signed 64
On Thu, Apr 23, 2015 at 11:12 AM, Jon Kleiser wrote:
>
> Feel free to give it a try. As EmuLisp uses JavaScript numbers,
> 6364136223846793005 is too many digits, but you may find a way around it.
Progress is being made.
I use this JS lib for arbitrary big integers:
https://github.com/defunctzom
Hi Chri,
On 22. Apr, 2015, at 22:50, Christophe Gragnic
wrote:
. .
>
> Now the question. I found discrepancies between PicoLisp:
> : (rand 1 1000)
> -> 1
> : (rand 1 1000)
> -> 934
> : (bye)
>
> And Ersatz
> : (rand 1 1000)
> -> 1
> : (rand 1 1000)
> -> 967
> : (bye)
>
> I tried to inspect
Hi Christophe,
our mails overlapped :)
> PicoLisp was not the Haynes one, but the one referred as «Newlib» here:
> http://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
Right. I took it originally from the book by Donald Knuth.
> Maybe I was too tired. The differ
Hi Christophe,
> I use PicoLisp to implement a pedagogical language, directly
> embedded in PicoLisp. In an exercise about dices, I noticed a
> kind of similarity among the results of my students.
> ...
Nice! This sounds really interesting.
> Now the question. I found discrepancies between Pico
Hi,
After some more time to investigate, I found out that the LCG used in
PicoLisp was not the Haynes one, but the one referred as «Newlib» here:
http://en.wikipedia.org/wiki/Linear_congruential_generator#Parameters_in_common_use
More auto-answers and other questions below.
On Wed, Apr 22, 2015 at
Hi all,
The next paragraph gives a bit of context. If you are bored you can
skip it and go directly to the technical question.
I use PicoLisp to implement a pedagogical language, directly
embedded in PicoLisp. In an exercise about dices, I noticed a
kind of similarity among the results of my stud
13 matches
Mail list logo