Search found 2807 matches

by Richard
Nov 02, 2018 5:19
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

If you keep everything as integers you can do;
Dim as Integer n1, n2, sum, fract, avg
sum = n1 + n2
fract = sum And 1 ' test if odd, fract is 1 if half
avg = sum shr 1 ' which divides by two
by Richard
Nov 02, 2018 1:06
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@Albert.
You have no choice but to convert the number to decimal using the st = Str( dp ) function, then parse the string.
You need to better specify the input range and data format to get a better answer.
by Richard
Oct 12, 2018 0:25
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

I was thinking, if you convert to binary then you can step by 32 bits..without a sub-carry. There are many possibilities. Go ahead and see what you can do. The resized array can be referenced by pointers as 8, 16 or 32 bit unsigned integers. Because the array gets an extra zero most significant ele...
by Richard
Oct 07, 2018 8:50
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@ Albert. Here are new Pack() and Unpack() routines that convert between ASCII strings of decimal digits and packed binary data in arrays of Ulong. They convert data in blocks of 9 digits, so are a bit faster than the earlier versions. There are some strange exceptions during the Unpack where expans...
by Richard
Aug 26, 2018 5:04
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

I don't think you know what you are doing. Why would you need ASCII binary, if not to delay the process? When you multiply 3.3 Mbits by 3.3 Mbits in ASCII it requires 10,890,000,000,000 partial product bits go into a massive Wallace Tree. https://en.wikipedia.org/wiki/Wallace_tree Log₁₀( 2 ³² ) = 9....
by Richard
Aug 26, 2018 2:32
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@Albert. Why do you need to find more shortcuts ?
What is 15 seconds when your multiply will take a week.
by Richard
Aug 25, 2018 20:53
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

I converted your base10_to_2() to use pointers , it only speeds it up by a second or so on 1 million. I've got to convert the acc( i ) to use a pointer into the acc( ) array.. I think array access takes 16 clocks per access.. i think an array( pointer ) takes 1 clock (not sure) ?? I am convinced yo...
by Richard
Aug 25, 2018 5:18
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@Albert. First demonstrate that your algorithm works for 10, 100 and 1000 decimal digit numbers when represented in ASCII base two. I can then accurately predict what your million decimal digit time will be. If you can do a 10 x 10 decimal digit multiply in 100 microsec, then 100 x 100 will only tak...
by Richard
Aug 23, 2018 21:57
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@Albert. Why are you interested in a magicians prop and party toy from over 100 years ago? The Wimshurst Mchine, WM, is a parametric capacitance amplifier powered by rotation of the shaft. It has an energy conversion efficiency of less than 1 part in 1000. The sparks make hot air and the sound of cl...
by Richard
Aug 23, 2018 3:26
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

You may be describing a Wimshurst Machine. https://en.wikipedia.org/wiki/Wimshurst_machine A small motor ( maybe solar powered. ) could power thousands of disks to generate voltage.. Power is the rate of flow of energy, which is voltage * current. But the machine produces a voltage only when the cur...
by Richard
Aug 19, 2018 2:15
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

My array indexing code is even slower because I do -exx checking when writing code like this. The loop speed limitation will be the bin( txt, 32 ) conversion from Ushort to the 32 character ASCII string, then the memory allocation needed for the continuous extension of that string as it grows. Anyho...
by Richard
Aug 19, 2018 0:33
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@ Albert. Introducing the advancing k marker only doubled the speed of the process over the brute force solution. The use of 9 digit and 29 bit blocks is probably not optimum, but it does seem to give the right answer ever time without too much head scratching. I guess there might be another 5% avai...
by Richard
Aug 18, 2018 10:06
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

@Albert. Give these a try. They have not been fully tested yet. How do they rate speed-wise compared to others you have ? '======================================================================= ' Convert base two ASCII binary string to base ten ASCII decimal string '================================...
by Richard
Aug 16, 2018 12:35
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

That example of dodicatuana looks like a micrograph of my engine oil.
by Richard
Aug 15, 2018 3:55
Forum: General
Topic: Squares
Replies: 6008
Views: 340847

Re: Squares

I need to convert long strings of decimals to base2 and base2 back into base10 like a string of 1,000,000 decimal digits converted to base2.. That will generate unreadable 3.010300 megabyte strings of confusing data. You do not need the base change to be fast if it is only needed to convert a few t...

Go to advanced search