Multiplying large numbers
I think this is a quick question.
I need to raise numbers to the fifth power. Of course, this must be done with a series of multiplications since there is no exponent support in PBP.
The largest number possible in my equation would be 43. The max I could raise that to would be two (43*43=1849 which PBP can handle directly, 43^3=79507 which is greater than 16 bit).
I know that I'll have to use the DIV32 function after the calculation to get my answer reduced to something reasonable. That's easy enough.
So what I'm wondering is, is this "legal" in PBP?:
Dummy=43*43*43*43*43
Result=DIV32 12000
My confusion comes in the fact the the PBP documentation only gives examples of multiplying two numbers, then using the DIV32.
Thanks much,
Jason
So simple that it's brilliant...
Thanks Paul
To answer your question, the number can be very small... less than 10. And there are actually two constants that I'll be dividing by - one is 12000 (120*100), the other is 600 (6*100).
I was giving the abbreviated story about what I am up to. What I'm actually calculating is a Taylor series expression for sin(theta). I'll write it out for the benefit of anyone else that happens upon this post:
sin(x)=theta -(theta^3)/3!+(theta^5)/5!...... with theta in radians
They can also check out this link that I have been refering to:
http://www.picbasic.co.uk/forum/show...ghlight=arcsin
Of course, to calculate to any degree of accuracy, I have to scale numbers up (to get some significant figures) and then scale the final result down appropriately. My goal is two sig figs past the decimal point, with the last being rounded to either 0 or 5. Since that theta^5 is in there, the numbers get really difficult... especially when they are scaled up to begin with!
Since 3!=6, and I'm playing around with scaling, you can see where the 600 comes from. Same story for the 12000.
Anyhow, thanks so much... this will clean up my code nicely while improving accuracy.
Jason