Search found 5943 matches
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(...
- Nov 10, 2019 12:20
- Forum: Community Discussion
- Topic: FreeBASIC 1.07 Release Discussion
- Replies: 42
- Views: 6192
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...
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...
- Nov 08, 2019 18:38
- Forum: Beginners
- Topic: Why UBound doesnt take into account 0 reporting array size?
- Replies: 6
- Views: 181
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 ...
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 2036278952 mod 1715 -857
print 2036278952ul mod 1715 -857
print 2036278952ull mod 1715 -857
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...
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) ...
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...
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, ...