Here's a suppliment to the quest for "huge number" QB math. The Multiply$ function listed here multiplies the values in Num1$ and Num2$ and prints a 100-digit solution.<br>I'm sorry if I couldn't use my calculator to verify the accuracy. <grin><br><b><FONT FACE=monospace><br>DEFINT A-Z<br>DECLARE FUNCTION Multiply$ (Num1$, Num2$)<br>CLS<br><br>Num1$ = "583416511508123631651151861331133779121514779413347"<br>Num2$ = "4357489407512325887801515201452014235892514689231"<br><br>PRINT Multiply$(Num1$, Num2$)<br>PRINT : PRINT "...or settle for..."<br>PRINT VAL(Num1$) * VAL(Num2$)<br><br>FUNCTION Multiply$ (Num1$, Num2$) </b></font><br>'Format the number strings so they'll be easy to use... <b><FONT FACE=monospace><br>IF LEN(Num2$) > LEN(Num1$) THEN<br> Num1$ = STRING$(LEN(Num2$) - LEN(Num1$), "0"

+ Num1$<br>END IF<br>IF LEN(Num1$) > LEN(Num2$) THEN<br> Num2$ = STRING$(LEN(Num1$) - LEN(Num2$), "0"

+ Num2$<br>END IF<br>Num1$ = "0" + Num1$: Num2$ = "0" + Num2$: Carry$ = "0" </b></font><br>'Loop through the digits of the first number <b><FONT FACE=monospace><br>FOR R2 = LEN(Num2$) TO 1 STEP -1<br> Temp2$ = Answer$: Answer$ = ""<br> Temp1$ = STRING$(ABS(R2 - LEN(Num2$)), "0"

<br> IF MID$(Num2$, R2, 1) <> "0" THEN </b></font><br> 'If we aren't trying to multipy by zero then<br> 'loop through the digits of the second number. <b><FONT FACE=monospace><br> FOR R1 = LEN(Num1$) TO 1 STEP -1<br> A$ = LTRIM$(STR$(VAL(MID$(Num1$, R1, 1)) * VAL(MID$(Num2$, R2, 1)) + VAL(Carry$)))<br> IF LEN(A$) > 1 THEN<br> Carry$ = LEFT$(A$, 1)<br> ELSE<br> Carry$ = "0"<br> END IF<br> Temp1$ = RIGHT$(A$, 1) + Temp1$<br> NEXT<br> END IF </b></font><br> 'Format the temporary number strings for easy of use <b><FONT FACE=monospace><br> IF LEN(Temp2$) > LEN(Temp1$) THEN<br> Temp1$ = STRING$(LEN(Temp2$) - LEN(Temp1$), "0"

+ Temp1$<br> END IF<br> IF LEN(Temp1$) > LEN(Temp2$) THEN<br> Temp2$ = STRING$(LEN(Temp1$) - LEN(Temp2$), "0"

+ Temp2$<br> END IF<br> Temp1$ = "0" + Temp1$: Temp2$ = "0" + Temp2$: Carry$ = "0" </b></font><br> 'Add the temporary strings together <b><FONT FACE=monospace><br> FOR R = LEN(Temp2$) TO 1 STEP -1<br> A$ = LTRIM$(STR$(VAL(MID$(Temp1$, R, 1)) + VAL(MID$(Temp2$, R, 1)) + VAL(Carry$)))<br> IF LEN(A$) > 1 THEN<br> Carry$ = LEFT$(A$, 1)<br> ELSE<br> Carry$ = "0"<br> END IF<br> Answer$ = RIGHT$(A$, 1) + Answer$<br> NEXT<br>NEXT<br></b></font><br>'Strip off the leading zeros...<br><b><FONT FACE=monospace><br>FOR Re = 1 TO LEN(Answer$)<br> IF MID$(Answer$, Re, 1) <> "0" THEN<br> Answer$ = RIGHT$(Answer$, LEN(Answer$) - Re + 1)<br> EXIT FOR<br> END IF<br>NEXT<br><br>Multiply$ = Answer$<br></b></font><br>'This is your 100-digit answer.<br>'It should require a fraction of a second on modern systems but I would hate to try it with two 4000-digit numbers. You might have to wait a while... go out for dinner and a movie.<br><b><FONT FACE=monospace><br>END FUNCTION<br></b></font><br><br> <p> <br><a href=mailto: > </a><br><a href=
plain black box</a><br>