bug in mp?

shallit at ascutney.dartmouth.edu shallit at ascutney.dartmouth.edu
Wed May 24 05:14:20 AEST 1989


I would like to hear from users of mp whether the following represents
a bug or just a misunderstanding as to how mp works.

When I try to compute (-10) - (-20), I get -10 instead of 10.
Here's the code:
------------------------------------------------------------------------------

#include <mp.h>

/* compile with cc test.c -lmp   */

main()
{
	MINT *a, *b, *c, *d, *e, *f;

	a = itom(-10);   
	b = itom(-20);
	c = itom(0);   

	msub(a,b,c);   

	d = itom(10);
	e = itom(20);
	f = itom(0);

	msub(d,e,f);

	printf("c = ");
	mout (c);
	printf("\n f = ");
	mout (f);
}

-------------------------------------------------------------------------

Jeff Shallit
Dartmouth College
shallit at dartmouth.edu



More information about the Comp.lang.c mailing list