Search found 5943 matches

by dodicat
Nov 11, 2019 21:18
Forum: General
Topic: Squares
Replies: 7221
Views: 436706

Re: Squares

More spirals. Type spiral As Long x,y As Double rad,grade,ang As Ulong clr Declare Sub Draw End Type Sub spiral.draw Dim As Double start,delta=rad/3500 Var o=rad Do Circle(x,y),rad,clr,start+ang,start+ang+delta rad-=delta*grade start+=delta Loop Until rad<=0 rad=o End Sub sub setup(s() as spiral,da(...
by dodicat
Nov 11, 2019 15:52
Forum: General
Topic: Squares
Replies: 7221
Views: 436706

Re: Squares

Let the compiler do the maths.

Code: Select all

screen 20
dim as double delta=.01,rad=350,start
do
    circle(1024\2,768\2),rad,12,start,start+delta
    rad-=delta*8
    start+=delta
loop until rad<=0

sleep 
by dodicat
Nov 10, 2019 14:10
Forum: Community Discussion
Topic: FreeBASIC 1.07 Release Discussion
Replies: 42
Views: 6192

Re: FreeBASIC 1.07 Release Discussion

Where does WReallocate come from?
Tried windows.bi, crt.bi.
. . .
Variable not declared, WReallocate . . .
. . .
by dodicat
Nov 10, 2019 12:20
Forum: Community Discussion
Topic: FreeBASIC 1.07 Release Discussion
Replies: 42
Views: 6192

Re: FreeBASIC 1.07 Release Discussion

according to the help file: The encoding to be used when reading or writing text, can be one of: Encoding "ascii" (ASCII encoding is used, default) Encoding "utf8" (8-bit Unicode encoding is used) Encoding "utf16" (16-bit Unicode encoding is used) Encoding "utf32&q...
by dodicat
Nov 09, 2019 10:28
Forum: General
Topic: Len of udt
Replies: 7
Views: 223

Re: Len of udt

Because of datatype integer then either 32 bit write/read or 64 bit write/read, but cannot cross write/read. Using sizeof to to load the udt array from file: #include "file.bi" Type Smarties PortNbr As Integer = 0 'as edited in Settings2 Emergency As Long = 0 AutoMan As Long = 0 '0 or 1 Ig...
by dodicat
Nov 08, 2019 18:38
Forum: Beginners
Topic: Why UBound doesnt take into account 0 reporting array size?
Replies: 6
Views: 181

Re: Why UBound doesnt take into account 0 reporting array size?

You can write little macros (defines) to do tasks. For instance flipping between zero based and one based arrays, and a custom ubound. #define ubnd(a) iif(lbound(a)=0,ubound(a)+1,ubound(a)) #define b0(a) redim preserve a(0 to iif(lbound(a)<>0,ubound(a)-1,ubound(a))) #define b1(a) redim preserve a(1 ...
by dodicat
Nov 07, 2019 20:56
Forum: General
Topic: Squares
Replies: 7221
Views: 436706

Re: Squares

Hi Albert.
I had a folder compressor done a while back.
I'll try and find it.
by dodicat
Nov 06, 2019 18:47
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

Thanks deltarho.
"The upper class can kiss my ass,
DODICAT is up there at last."
by dodicat
Nov 06, 2019 12:53
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

But it is very confusing, freebasic is usually quite friendly, but not always.

Code: Select all



print 2024863461 mod 1715 -857
print 2024863461ul mod 1715 -857
print 2024863461ull mod 1715 -857
print

print 2036278952 mod 1715 -857
print 2036278952ul mod 1715 -857
print 2036278952ull mod 1715 -857
sleep
 
by dodicat
Nov 06, 2019 12:23
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

I tried with dmod, - OK.(Which told me something odd is going on) If I cast your ulong generator to long then add the one - OK. -- With -857 to 857 range (well, one is a long anyway, but I didn't think you would have to cast ulong to long to add a long) If x mod y=z, looks like if x as ulong so is t...
by dodicat
Nov 05, 2019 22:45
Forum: General
Topic: count of digits in large number
Replies: 5
Views: 190

Re: count of digits in large number

The crt gives a log10

Code: Select all


#include "crt.bi"
function  countDigit(n As Ulongint) As Integer
return INT(log10(n) + 1)
end function
 
Dim As Integer n
input "Enter number: ";n
print countDigit(n)
Sleep
by dodicat
Nov 05, 2019 22:44
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

Hi deltarho, sorry for the delay, I've had a busy couple of days. I cannot replicate your error. Are you sure you go from -limit to limit in all your test cases, and haven't skipped -limit somewhere? Here are the three, my own 64 bit generator, and your ulong generator both ways (using mod and not) ...
by dodicat
Nov 03, 2019 13:56
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

No, it was just a curiosity, I'll study your problem.
by dodicat
Nov 03, 2019 12:26
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

What about double mod (same as fmod in crt) Doubles are nearly as fast as integers, and here, faster in 64 bits. #define dmod(x,y) (y)*Frac((x)/(y)) dim as longint ans1,ans2 for n as long=1 to 10000000 var n1=1+int(rnd*5000000) var n2=int(rnd*5000000) ans1=n2 mod n1 ans2=dmod(n2,n1) if n<20 then pri...
by dodicat
Nov 02, 2019 12:33
Forum: General
Topic: Home-brewed encryption
Replies: 39
Views: 858

Re: Home-brewed encryption

OK deltarho- sorry. I was using the 64 bit compiler, official build. My main thrust in this thread was to say that using the mod method with local mapping is perfectly viable for a ranger. Of course mapping the whole range (your method) is equally viable. -Wc -O3 (with 64 bits) ten timed runs next, ...

Go to advanced search