gae@osupyr.UUCP (02/28/87)
Is there (another) problem with the mp multiple-digit routines, or am I
misunderstanding something?
In my opinion, 2 raised to the power 3 does not have thousands of digits.
/* bug in rpow ??? */
#include <stdio.h>
#include <mp.h>
int base,exp;
MINT *temp1,*temp2,*result;
main()
{
result = itom(0);
base = 2;
exp = 3;
temp1=itom(base);temp2=itom(exp);
printf("base=");
printf("(length %d)\n",temp1->len);
mout(temp1);
printf(" exp=");
printf("(length %d)\n",temp2->len);
mout(temp2);
rpow(temp1,temp2,result);
printf(" result=");
printf("(length %d)\n",result->len);
mout(result);
exit(0);
}
--
Gerald A. Edgar TS1871@OHSTMVA.bitnet
Department of Mathematics edgar@osupyr.UUCP
The Ohio State University
Columbus, OH 43210 70715,1324 CompuServe
donn@utah-gr.UUCP (03/01/87)
Gerald Edgar asks: Is there (another) problem with the mp multiple-digit routines, or am I misunderstanding something? In my opinion, 2 raised to the power 3 does not have thousands of digits. I didn't realize anyone actually used this library... The manual page for mp(3X) in the Seventh Edition reports that 'rpow calculates a raised to the power b', where 'a' and 'b' are both 'mint' pointers. I have access to a copy of the Unix 32/V sources and it appears that the Seventh Edition description is incorrect -- the second argument to rpow() is an ordinary int exponent. (Also, 'mp.h' defines a type 'MINT', not 'mint'; this is one of those situations in which case distinction in C raises its ornery head.) I can't tell whether the mp library changed between the Seventh Edition and 32/V -- anyone out there know mp's pedigree? The dates on the 32/V sources are the same as the date on the Seventh Edition UPM (January 1979). When 4.3 BSD was a few months from release, some final checks were made for consistency across lint libraries, manual pages and sources. We discovered that the manual page for mp(3X) was missing -- the page doesn't appear in the copy of the 32/V release I mentioned above, so it's been missing for a long time. We managed to locate a replacement Seventh Edition page and soon discovered that it was incorrect and incomplete. The library itself contains a grand total of one (1) comment, so we had to poke around a bit to come up with the proper information... If you're doing any work with the mp library (?!), you might fare better by using the 4.3 BSD manual page than the Seventh Edition one. My one regret is failing to catch the '#ifdef lint' in 'mp.h', Donn Seeley University of Utah CS Dept donn@cs.utah.edu 40 46' 6"N 111 50' 34"W (801) 581-5668 utah-cs!donn