diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-09 18:03:33 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 1999-06-09 18:03:33 +0000 |
commit | 0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32 (patch) | |
tree | 62d12a119f5dfc15abe2f6d298617e174a0a06af /init.c | |
parent | 8d21dd7188076894a6f65e510797c8c6928e474f (diff) | |
download | mpfr-0cf5fc5ea4b5ed46b454d3bf3adc620d9fff2d32.tar.gz |
Initial revision
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@2 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 28 |
1 files changed, 28 insertions, 0 deletions
@@ -0,0 +1,28 @@ +#include <stdio.h> +#include "gmp.h" +#include "gmp-impl.h" +#include "mpfr.h" + +void +#if __STDC__ +mpfr_init2 (mpfr_t x, unsigned long int p) +#else +mpfr_init2 (x, p) + mpfr_t x; + unsigned long int p; +#endif +{ + unsigned long xsize; + + if (p==0) { + printf("*** cannot initialize mpfr with precision 0\n"); exit(1); + } + + xsize = (p - 1)/BITS_PER_MP_LIMB + 1; + + x -> _mp_prec = p; + x -> _mp_d = (mp_ptr) (*_mp_allocate_func) + (xsize * BYTES_PER_MP_LIMB); + x -> _mp_size = xsize; + x -> _mp_exp = 0; +} |