Multiply Signed numbers (Assembly)
scotta
Posts: 168
Does anyone have an Assembler signed integer math library posted ?
Scott
Scott
Comments
If you don't mind me asking...[noparse]:)[/noparse]
Are you generally interested in numbers?
Rich
That is beautiful code... I forgot to ask you how long it took you to write.
If you get to the point that you find the math more interesting than the application...let me know[noparse]:)[/noparse]
Would it be ok for me to use your code... in my E-book project?
Rich
Will probably repost a better copy, go ahead and
put it in the book.
Scott
Before you go to bed... I have one more question?
I learned a trick... how to accelerate calculations based on exponential functions. It is absolutely amazing.
Would you be interested in seeing it? not tonight of course.
Be careful how you answer my question... because first you would have to give me an exponential function... in assembly.
Rich
Cam Thompson, Micromega Corporation
Its Mikes divide routine with an attempt for signed number support.
The resulting divide works, but the re-sign code does not work.
NUMA=NUMA/NUMB
There's no overflow checking though.
I can't see why it does not work with a signed divisor.
What am I missing ?
At the end of the routine you posted
This should be
In the future, when you have a routine and you're not getting what you expect, please post the input values and the output value(s).
Well.....that certainly was fast. I'm working on assembly... and I will be an expert by the time I get done... [noparse]:)[/noparse]
How many Earth days do you want to wait?
I worked it out in integer form... and I haven't checked to see if there is any other logic required for decimated numbers... my brain says no... but I haven't thought about it for a couple of years.
The idea is to compare the computational burden of computing a consecutive series of equal ordered exponential terms. The method is expandable to full exponential equations, but the equations have to be structured right (which is always possible... but never done)... the longer the series the higher the gain... and by analogy the more complex the exponential equation the higher the gain. The key is that somewhere in the solution space there has to be area of interest that contains a consecutive series of root terms.
If you want me to do it, the easiest way to show you the trick is to ask you to limit your algorithm to integers only... then take a small array... say 10 consectuive integers and calculate the exponents... and you need to put a counter in to get a total number of instructions required to do that.
And then put the whole thing in workable code... knowing that you are doing that... I could easily rewrite the routine. Probably. I might need a little help.
I think there are some important real world applications for this. It is neat. But it could be that someone has figured out a better way and put it into in general circulation.
Thanks again,
Rich
What did you work out (in integer form). I'm a little lost
Scott
Sorry this took so long. I was trying my best lame approach to putting this in Propeller Assembly... still thinking about it.
This basically shows how to generate exponents through a sum of differences method... this is what Babbage was trying to do with his difference engine... but I think he got his math screwed up... first time around.
By the way... any help coding this in assembly would be greatly appreciated [noparse]:)[/noparse]... for da Book.
Rich
I ask you to think of a number between 2 and 101... and don't tell anyone... then I will send you a program that will compute the cube of that number in the most efficient way possible and display it on your screen.
BUT I took so long... I didn't think a joke would be quite appropriate.
Rich
So, there are some over-head calculations... which aren't shown.
Rich