Re: [fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Michalis Kamburelis
Alan Mead wrote: ... I was hoping that the algorithms underlying the RTL.Randomize and RTL.Random would switch to using MT in fpc version 2. -Alan Reading comments in rtl/inc/system.inc FPC 1.9.x uses Mersenne Twister. Commited to CVS on 2003/10/26 by Jonas. -- Michalis _

Re: [fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Alan Mead <[EMAIL PROTECTED]> wrote: > I was hoping that the algorithms underlying the RTL.Randomize and > RTL.Random would switch to using MT in fpc version 2. Here's the post I recalled: http://www.mail-archive.com/[EMAIL PROTECTED]/msg01565.html Is this still the case that 1.9.x implements M

Re: [fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Jeff, Thanks for this link. I found a Pascal implementation of MT somewhere .. not this one I think. Is it your code? Do you know the difference between the Real1() and Real2() etc. methods? I was hoping that the algorithms underlying the RTL.Randomize and RTL.Random would switch to using MT i

Re: [fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-29 Thread Alan Mead
Alan Mead <[EMAIL PROTECTED]> wrote: > I don't know if this is really a bug or whether it's known... I > have > this line of code: > > while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do > inc(i); > > It compiles fine but I get a RTE: > > An unhandled exception occurred at 0x0807B18

[fpc-pascal] RE: Random(), Randomize, and Linux permissions

2004-09-29 Thread Jeff Pohlmeyer
> Last time I compared FPC's random() to MT, MT was a clear winner. Have you tried this ? http://daniel.taickim.net/development/mtwister.pp __ Do you Yahoo!? Yahoo! Mail is new and improved - Check it out! http://promotions.yahoo.com/new_mail

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Michael . VanCanneyt
On Wed, 29 Sep 2004, Jilani Khaldi wrote: > > Or, simpler, use DecodeDateTime function from DateUtils unit. It's > even Delphi-compatible. I'm not sure whether it exists in FPC 1.0.x > (even if not, it's probably > > possible to just compile DateUtils unit sources from FPC 1.9.4 using > FPC

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Jilani Khaldi
>It's a lot simpler to use simply SysUtils.DecodeDate and DeccdeTime. Uses SysUtils; var Year, Month, Day, hour,minute,second,msec : word; begin decodedate(trunc(thetdatetime),year,month,day); decodetime(frac(thetdatetime),hour,minute,second,msec); end; Well, I want to use the double value as

[fpc-pascal] Free Pascal soom will land in Italy!

2004-09-29 Thread Jilani Khaldi
Hi All, In the next issue of Linux&C n.42 (http://www.oltrelinux.com) there will be the first article (Special) about Free Pascal (8 pages for this article, never happened before with other cool languages). Linux&C is the number one magazione in Italy dedicated to Linux with nearly 50.000 reade

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Jilani Khaldi
> Or, simpler, use DecodeDateTime function from DateUtils unit. It's even Delphi-compatible. I'm not sure whether it exists in FPC 1.0.x (even if not, it's probably > possible to just compile DateUtils unit sources from FPC 1.9.4 using FPC 1.0.10), but it exists in FPC 1.9.x for sure. I know I c

Re: [fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-29 Thread David Emerson
I believe that your code is being interpreted as: (NOT fmt[i]) in ['0'..'9'] instead of the intended NOT (fmt[i] in ['0'..'9']) Pascal's rules for parsing logical expressions differ from the standard rules of the propositional calculus (i.e. modern symbolic logic). Thus, this behavior is "by d

Re: [fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-29 Thread Marcel Martin
Alan Mead a écrit : > > I don't know if this is really a bug or whether it's known... I have > this line of code: > > while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do > inc(i); > > It compiles fine but I get a RTE: > > An unhandled exception occurred at 0x0807B180 : > EVariantErro

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Marco van de Voort
> > Or you might scan the strings created by DateToStr. That'd be > > quick-n-dirty, though :-) > > > > Anton. > > > > Or, simpler, use DecodeDateTime function from DateUtils unit. It's even > Delphi-compatible. I'm not sure whether it exists in FPC 1.0.x (even if > not, it's probably possibl

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Michael . VanCanneyt
On Wed, 29 Sep 2004, Anton Tichawa wrote: > Michael Van Canneyt wrote: > > >On Wed, 29 Sep 2004, Jilani Khaldi wrote: > > > > > > > >>Hi All, > >>Does somebody kown the algorithm to convert a date from the double > >>format to an explicit format? > >>Example: the function "now" givers me: 3.

Re: [fpc-pascal] Known issue with 1.9.4 [2004/05/30] for i386 on Linux?

2004-09-29 Thread Marcel Martin
Alan Mead a écrit : > > I don't know if this is really a bug or whether it's known... I have > this line of code: > > while ( (i<=Length(fmt)) and (NOT fmt[i] IN ['0'..'9']) ) do > inc(i); > > It compiles fine but I get a RTE: > > An unhandled exception occurred at 0x0807B180 : > EVariantErro

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Michalis Kamburelis
Anton Tichawa wrote: Michael Van Canneyt wrote: On Wed, 29 Sep 2004, Jilani Khaldi wrote: Hi All, Does somebody kown the algorithm to convert a date from the double format to an explicit format? Example: the function "now" givers me: 3.825956615197917E+004 I want to transform it in: year-month-

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Marco van de Voort
> Michael Van Canneyt wrote: > > > > > > Or, if you need the values for some sort of calculation, you have to > > - find out the reference date, i. e. DateToStr(0) > - and the scale, (I think 1.0 = 1 day) > - consider the month lengths, with february changing in leap years > - for historic date

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Anton Tichawa
Michael Van Canneyt wrote: On Wed, 29 Sep 2004, Jilani Khaldi wrote: Hi All, Does somebody kown the algorithm to convert a date from the double format to an explicit format? Example: the function "now" givers me: 3.825956615197917E+004 I want to transform it in: year-month-day Why not

Re: [fpc-pascal] Random(), Randomize, and Linux permissions

2004-09-29 Thread Alan Mead
Thanks for all the suggestions. Right, if my program were to execute cntinuously while it generated these random numbers, it would be easy to just call randomize once. But my program runs very quickly and I'd like it to produce very random numbers even upon repeated execution of the program. If

Re: [fpc-pascal] Explicit date from double format

2004-09-29 Thread Michael Van Canneyt
On Wed, 29 Sep 2004, Jilani Khaldi wrote: > Hi All, > Does somebody kown the algorithm to convert a date from the double > format to an explicit format? > Example: the function "now" givers me: 3.825956615197917E+004 > I want to transform it in: year-month-day Why not use DateToStr() or F

[fpc-pascal] Explicit date from double format

2004-09-29 Thread Jilani Khaldi
Hi All, Does somebody kown the algorithm to convert a date from the double format to an explicit format? Example: the function "now" givers me: 3.825956615197917E+004 I want to transform it in: year-month-day Thanks! Jilani ___ fpc-pascal maillist

Re: [fpc-pascal] Random(), Randomize, and Linux permissions

2004-09-29 Thread Jonas Maebe
On 29 sep 2004, at 08:36, Alan Mead wrote: It's known that Randomize() is not effective when called rapidly... Why do you want to call randomize rapidly? Reading a numbers from /dev/random is semantically closer to calling random() a lot than to calling randomize() a lot. Jonas _

Re: [fpc-pascal] Random(), Randomize, and Linux permissions

2004-09-29 Thread Florian Klaempfl
Alan Mead wrote: It's known that Randomize() is not effective when called rapidly... I tried to solve this using the code sample below. I can cat /dev/null (without becoming root) but when I run the code below I get an access denied RTE at 'Reset(f,1);'.. this code works fine when run as /dev/rand