diff options
Diffstat (limited to 'src/benchmarks/cfrac/itop.c')
| -rw-r--r-- | src/benchmarks/cfrac/itop.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/benchmarks/cfrac/itop.c b/src/benchmarks/cfrac/itop.c new file mode 100644 index 0000000..87d309a --- /dev/null +++ b/src/benchmarks/cfrac/itop.c @@ -0,0 +1,25 @@ +#include "pdefs.h" +#include "pcvt.h" +#include "precision.h" + +/* + * Integer to Precision + */ +precision itop(i) + register int i; +{ + register digitPtr uPtr; + register precision u = palloc(INTSIZE); + + if (u == pUndef) return u; + + if (u->sign = (i < 0)) i = -i; + uPtr = u->value; + do { + *uPtr++ = modBase(i); + i = divBase(i); + } while (i != 0); + + u->size = (uPtr - u->value); /* normalize */ + return presult(u); +} |
