aboutsummaryrefslogtreecommitdiff
path: root/src/benchmarks/cfrac/pneg.c
blob: c78106610567dc95560a127f54b2869921ff333a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include "pdefs.h"	/* private include file */
#include "precision.h"	/* public include file for forward refs */
#include <string.h>

/*
 * negation
 */
precision pneg(u)
   register precision u;
{
   precision w;

   (void) pparm(u);
   w = palloc(u->size);
   if (w == pUndef) return w;

   w->sign = u->sign;
   if (pnez(u)) {		/* don't create a negative 0 */
      w->sign = !w->sign;
   }
   (void) memcpy(w->value, u->value, u->size * sizeof(digit));

   pdestroy(u);
   return presult(w);
}