Search found 3181 matches

by MrSwiss
Sep 20, 2019 12:02
Forum: Beginners
Topic: File created by an external program
Replies: 4
Views: 189

Re: File created by an external program

There is another method, based more on messaging, which I've used in similar scenario. This let's the external process deal with the file, as long as it takes. After finishing, it simply creates a second, empty "message-file" that tells your program that the other process is finished (your...
by MrSwiss
Sep 19, 2019 16:26
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

coderJeff wrote:It is an fbc optimization. C doesn't have a power operator, only 'pow` function, so fbc makes this choice to optimize before the expression is even passed to gas/gcc backend.

Thank you, that clears it.
by MrSwiss
Sep 17, 2019 12:10
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

... will find itself in the float environment which is slower than the integer environment. This is definitely NOT the case any longer, with todays CPU/FPU combinations, as tests made by myself show clearly, it's the floats that have the edge, nowadays. This is due to the fact that since the 80486D...
by MrSwiss
Sep 17, 2019 1:12
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

I'll give you two possible solutions of 'Pythagoras' aka: 'distance', between two 2D vectors, often used in conjunction, with fbGFX coding. (Aka: hypotenuse) This one is used, by the more advanced coders: #Define distance(hd, vd) ( Sqr((hd)*(hd) + (vd)*(vd)) ) ' vd = vertical distance | hd = horizon...
by MrSwiss
Sep 16, 2019 23:39
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

deltarho[1859] wrote:But if only the second is needed then the first is obligatory.
Well, as it is in my code I need LUmax, even before ever touching DmulF.
In the initializer procedures of the PRNG.
Therefore, the use, in the second constant's definition, comes 'for free'.
by MrSwiss
Sep 16, 2019 23:03
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

deltarho[1859] wrote:Come to think of it a simpler version is:
I was expecting such a comment from somebody, that only speaks decimal.
For those speaking binary too, as well as using both constants in code, my
version makes probably more sense.
by MrSwiss
Sep 16, 2019 13:40
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

In my tests dividing by 2^32 or a Const has no effect on the throughput. In the old days we had to do the optimizing. No, this needs conversion to: multiplication (division is slower, uses more CPU/FPU cycles) and this one, is used on every single call (as in the quoted article!). Const As ULong UL...
by MrSwiss
Sep 15, 2019 22:25
Forum: Projects
Topic: Full RGB image to DOS CGA and EGA
Replies: 9
Views: 271

Re: Full RGB image to DOS CGA and EGA

Anyway, I thought that freebasic automatically converts "/" to "\" (and the other way around?) for file usage depending on the OS. Well, not quite, it's as follows (OS specific, nothing to do with FB): Windows can handle "\" and "/" likewise. DOS/Linux need t...
by MrSwiss
Sep 15, 2019 19:15
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

I'm referring to the use of 2^32 in the #Define (where it is wrong) and not the division to get a Double [0 .. 1): #define Get64Bit (Cast( Ulongint, Rnd*(2^32) ) Shl 32) Or Cast( Ulongint, Rnd*(2^32) ) ' should be ... #define Get64Bit ( (CULngInt(Rnd() * (2^32-1)) Shl 32) + (Rnd() * (2^32-1)) ) Btw....
by MrSwiss
Sep 15, 2019 17:09
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

Hmmm, I suppose that could mean my faulty logic was random. Corrected code posted above. Your faulty logic starts off, with a wrong formula (calculating maximum value of ULong). It isn't: 2^32 but: 2^32-1 Below code proofes, that your formula 'breaks' a ULong (the result needs 33 bit's): Const As U...
by MrSwiss
Sep 14, 2019 12:10
Forum: General
Topic: String to number conversion with error handling
Replies: 4
Views: 148

Re: String to number conversion with error handling

FB-Manual wrote:Return Value:
Returns a longint of the converted string

If the first character of the string is invalid, Vallng will return 0.
Null/zero '0' is the error-indicator, you are looking for.
Therefore, all works as expected ...
by MrSwiss
Sep 13, 2019 15:12
Forum: Windows
Topic: Setting gcc compiler for WinFBE
Replies: 93
Views: 2825

Re: Setting gcc compiler for WinFBE

as opposed to a tedious navigation to the compiler path that FBEdit requires, provided, of course, we can remember where they are.
Nobody can help you, in case your compilers are "all over the show" on your storage medium ... :rofl:
by MrSwiss
Sep 13, 2019 15:06
Forum: Tips and Tricks
Topic: UInteger to max. value (32/64)
Replies: 1
Views: 105

UInteger to max. value (32/64)

Some people seem to think that, the changing size (number of bytes) of UInteger, is making this a challenge. It isn't in reality, there are even two methods to do so. Okay the simple one, I personally consider it to be 'hackish', because IMO the com- piler should throw a warning, when a unsigned var...
by MrSwiss
Sep 12, 2019 10:51
Forum: Windows
Topic: Setting gcc compiler for WinFBE
Replies: 93
Views: 2825

Re: Setting gcc compiler for WinFBE

It must be noted that we have a "very old" IDE, that handles that issue, without the problems
the "newer" IDE's seem to have: FBEdit *lets you switch compiler path at will, any time*.
by MrSwiss
Sep 09, 2019 15:18
Forum: Tips and Tricks
Topic: Fastest PRNG around, the XORSHIFT
Replies: 34
Views: 1080

Re: Fastest PRNG around, the XORSHIFT

ShawnLG wrote:According to the FB manual, only long and ulong vary depending on platform.
No, Long/ULong are static (32 bit always), U/Integer is the 'dynamic' one
(depending on pointer size).
Where in the manual (is it current?), did you get that from?

See: Integer Types (Standard Data Types page).

Go to advanced search