Branch: Tag:

1997-12-03

1997-12-03 22:47:41 by Fredrik Hübinette (Hubbe) <hubbe@hubbe.net>

division now always rounds towards minus infinity (I hope)

Rev: src/operators.c:1.21
Rev: src/testsuite.in:1.62
Rev: tutorial/tutorial.wmml:1.36

5:   \*/   #include <math.h>   #include "global.h" - RCSID("$Id: operators.c,v 1.20 1997/10/11 06:48:24 hubbe Exp $"); + RCSID("$Id: operators.c,v 1.21 1997/12/03 22:46:17 hubbe Exp $");   #include "interpret.h"   #include "svalue.h"   #include "multiset.h"
1071:    error("Division by zero\n");    sp--;    -  tmp=sp[-1].u.integer / sp[0].u.integer; -  if(tmp<0) -  if(tmp * sp[0].u.integer > sp[-1].u.integer) +  tmp=sp[-1].u.integer/sp[0].u.integer; +  +  if((sp[-1].u.integer<0) != (sp[0].u.integer<0)) +  if(tmp*sp[0].u.integer!=sp[-1].u.integer)    tmp--; -  +     sp[-1].u.integer=tmp;    return;    }