diff options
Diffstat (limited to 'src/benchmarks/cfrac/picmp.c')
| -rw-r--r-- | src/benchmarks/cfrac/picmp.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/benchmarks/cfrac/picmp.c b/src/benchmarks/cfrac/picmp.c new file mode 100644 index 0000000..b942268 --- /dev/null +++ b/src/benchmarks/cfrac/picmp.c @@ -0,0 +1,41 @@ +#include "pdefs.h" +#include "precision.h" + +static char cmpError[] = "Second arg not single digit"; + +/* + * Single-digit compare + */ +int picmp(u, v) + register precision u; + register int v; +{ + register int i; + + (void) pparm(u); + + if (u->sign) { + i = -1; + if (v < 0) { + if (-v >= BASE) { + errorp(PDOMAIN, "picmp", cmpError); + } + if (u->size == 1) { + i = - (int) *(u->value) - v; + } + } + } else { + i = 1; + if (v >= 0) { + if (v >= BASE) { + errorp(PDOMAIN, "picmp", cmpError); + } + if (u->size == 1) { + i = (int) *(u->value) - v; + } + } + } + + pdestroy(u); + return i; +} |
