## Search found 2879 matches

### Re: Squares

@Albert. I have no idea what you think you are doing. But it seems you need to propagate carry by sweeping from right to left. 0001101110010000 = ans. 0001020302010000 = me. 0001020302010000 2 dec is 10 bin 0001020310010000 3 dec is 11 bin 0001021110010000 2 dec is 10 bin 0001101110010000 carry is n...

### Re: Squares

I'm not sure I understand the question. A 1 million x 1 million digit multiply will have at most 1 million partial products to accumulate, so you will need at least 20 more bits in your accumulator register. 2^20 = 1 million, so I would accumulate in a 64 bit ULongInt passing carry to a 32 bit exten...

### Re: Squares

@Albert. Just like my diagonal multiply avoided multiple output references, to minimise the number of times Mod 1e9 and DIV 1e9 were called. You will find that for numbers with different lengths you will need a more complex control structure with two multiply kernels. Here is the anotated picture of...

### Re: Squares

@dodicat. Your computer does run differently. Maybe there is some advantage in 32 bits for string processing. n1 = 15745121398853196173 n2 = 16103048213999544446 15708977747966183436 0.1671305693962495 albert 15708977747966183436 0.12494262704422 dodicat 15708977747966183436 0.09886247960093897 rich...

### Re: Squares

@dodicat. Why spend all that time in the For Next loop. 'a ulongint generator Type Rand a As Ulongint b As Ulongint c As Ulongint d As Ulongint End Type Function ranulong( Byref x As rand ) As Ulongint Dim e As Ulongint = x.a - ( ( x.b Shl 7 ) Or ( x.b Shr ( 64 - 7 ) ) ) x.a = x.b xor ( ( x.c Shl 13...

### Re: Squares

@Albert. When you use strings to perform the AND operation on ULongInt data you should be doing the Bin() conversions every time inside your function. You should not be arbitrarily swapping the input numbers based on size, but should find and control the length of the strings inside your AND functio...

### Re: Squares

@Albert. My code is significantly slower than the built-in logic functions. There must be a problem with the way you are applying your speed testing code. I wrote the arithmetic logic functions to show that it is possible to “advance backwards” even faster, without using the MOD function. Speed has ...

### Re: Squares

@Albert. I quickly wrote and posted the arithmetic logic functions before driving all day. By the time I got back I'd thought about what I was doing and so could write them differently. I really can't think of any use for them, apart from filling time. I would have thought you would prohibit the use...

### Re: Squares

' Bitwise Logic Functions, NOT, AND, OR, XOR, by arithmetic without using those logic functions '------------------------------------------------------- Function arith_NOT( Byval x As Ubyte ) As Ubyte Return 255 - x End Function '------------------------------------------------------- Function arit...

### Re: Squares

Now to do numbers outside of powers of 2 You need to avoid the Mod function and start from the most primitive operators. They are NOT, AND and OR. You can then make XOR( a, b ) = ( a And Not(b) ) Or ( b And Not(a) ) from which you can do addition. Once you can ADD you can INCrement which makes it p...

### Re: Squares

@Albert. Why do you insist on doing the impossible backwards? The fundamental of logic is the Complement or NOT function. It can be done by one transistor and one input resistor. The fundamental two input AND and OR functions can be made simply using one diode for each input. By using a transistor t...

### Re: Squares

Merry Christmas to all the squares. @Albert. When an addition is performed, the XOR produces the sum of the bits while AND is used to generate the carry. That is why (a + b) - ( a and b ) shl 1 removes the carry and so leaves only the XOR function. It is not my formula, I have seen it around since t...

### Re: Squares

Build an output string first using normal string functions and maybe the vb Format function. Then prefix that string with echo and Shell it out. To print you should first work out how to print on your particular operating system, then use Shell to issue that command to the system. You might consider...

### Re: Squares

Sorry about that.

You can use carry subtraction to generate the Xor.

You can use carry subtraction to generate the Xor.

Code: Select all

`' c = a Xor b`

c = (a + b) - (a And b) shl 1

### Re: Squares

This will bypass the graphics screen to print a string to the console in Windows.

Code: Select all

`shell "echo "+ "string to console"`