Shop OBEX P1 Docs P2 Docs Learn Events
I don''t know Multiply a big quantities withBS2P. Please Help Me! — Parallax Forums

I don''t know Multiply a big quantities withBS2P. Please Help Me!

ArchiverArchiver Posts: 46,084
edited 2004-01-13 19:41 in General Discussion
Buenos dias, Damian.

I get 23976 x 99999 = 2397576024


x0 VAR Word ' up to 23976
y0 VAR Word ' y1:y0 up to 999999
y1 VAR bit ' the high bit of y1:y0
z0 VAR Word ' result, z1:z0
z1 VAR Word
' y1:y0 is binary code
' 99999 * 23976 < 2^32
' the product will always fit in 32 bits

x0 = 23976
y0=34463
y1=1 ' 1 * 65536 + 34463 = 99999
z0= x0 * y0 ' low word of product
z1= (x0**y0) + (x0*y1) ' high word, no carry
' one cross-term, from x0*y1
DEBUG DEC z1,tab ,DEC z0,CR ' 36584*65536+7000=2397576024
GOSUB showdubdec10 ' kick out the digits 2397576024


The routine showdubdec10 is found at this URL:
http://www.emesystems.com/BS2math6.htm#showdubdec
That routine stores the intermediate 10 digit ascii decimal result
in scratchpad RAM before printing it.

I hope that helps,
-- best regards
Tracy Allen
electronically monitored ecosystems
http://www.emesystems.com
mailto:tracy@e...






>My friend,
>
>
>I need to send this result (product to a parallel printer, i think, i would
>need to convert the hex number to BCD number to send it to the report of
>this printer...
>
>The complete proyect is, I need to add 24 number to max quantities 999
>Ej:
>1) 123
>2) 456
>3) 789
>4) 123
>5) 456
>6) 789
>7) 123
>8) 456
>9) 789
>10) 123
>11) 456
>12) 789
>13) 123
>14) 456
>15) 789
>16) 123
>17) 456
>18) 789
>19) 123
>20) 456
>21) 789
>22) 123
>23) 456
>24) 789 +
>
>23,976.00 is the max number to add 24 x 999(Max quantities)
>
>Next I need to multiply with a number (The max number to multiply is
>99,999.00)..
>in fact The max result number is 23976 x 99999 =1297576024 I neet to do
>this operattions...
>
>If you can help me please let me know... i appreciate your help and prompt
>response
>
>Best Regards,
>VENPROELEC C.A.
>Eng. Damian Trujillo G.
>Venezuela, Caracas
>Phone:+58-416-8180941
>Fax: +58-212-2347509
>
>
>
>Please let me know What Can i do?
>
>
Mensaje Original
>
>De: Tracy Allen [noparse]/noparse][url=http://forums.parallaxinc.com/group/basicstamps/post?postID=WNq5-FHigBp9L7h8QQmmmXCM2GueBCqiGmGNkvQdEFMSI5Xn52JSoVI5z34LkHfBwxH8_jJg7gBJ3FV8]tracy@e...[/url
>Para: basicstamps@yahoogroups.com [noparse]/noparse][url=http://forums.parallaxinc.com/group/basicstamps/post?postID=J_iz3iaYIXK8Z9UnqP-oYeWJTU00bUjLYqrLPsSZNrgKzFRSWTPE1YBJAzCxOLSROg43NvspEJiyMT7jA4IaqioZg2c]basicstamps@yahoogroups.com[/url
>Cc:
>Asunto: Re: [noparse][[/noparse]basicstamps] I don't know Multiply a big quantities withBS2P.
>Please Help Me!
>Fecha: 12/01/2004 21:42:20
>Mensaje:
>
>
> Amigo,
>
> What are you going to do with the product of the numbers? I mean,
>will you have to print it on a screen, send it through a
>communication channel, record it in memory? Or will it be involved
>in further calculations and process control?
>
>And you state that the numbers are "dec number". How are they coded
>in the BASIC Stamp--binary, BCD, packed BCD, other?
>
> -- Tracy
>
>
>>Dear Basic Stamp Friends,
>>
>>I need your help about one big problem that i have...
>>
>>I need to multiply two (2) differents dec number quantities with BS2P, but
> >my problem is folloging:
> >
> >1) The max first number is 23976 (dec number)
> >2) The Max Second Number is 99999 (dec number)
> >3) The Max result is 2397576024 (Dec Number)
> >
> >I don't know What can i do to make it, because i understand taht the max
>>result to multiply is FFFF (Hex Number- WORD)
>>
>>I f anybody know What can i do, or If anybody have one similary program to
>>do it, I would appreciate your help
>>
>>Best Regards,
>>VENPROELEC C.A.
>>Eng. Damian Trujillo G.
>>Venezuela, Caracas
>>Phone:+58-416-8180941
>>Fax: +58-212-2347509
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the Subject and
>Body of the message will be ignored.
>
>
>Yahoo! Groups Links
>
>To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
>To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
>Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
>
>
>
>
>
>
>
>To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
>from the same email address that you subscribed. Text in the
>Subject and Body of the message will be ignored.
>
>
>Yahoo! Groups Links
>
>To visit your group on the web, go to:
> http://groups.yahoo.com/group/basicstamps/
>
>To unsubscribe from this group, send an email to:
> basicstamps-unsubscribe@yahoogroups.com
>
>Your use of Yahoo! Groups is subject to:
> http://docs.yahoo.com/info/terms/
Sign In or Register to comment.