version 1.1.1.2, 2000/09/09 14:13:07 |
version 1.1.1.3, 2003/08/25 16:06:34 |
|
|
/* mpf_set_ui() -- Assign a float from an unsigned int. |
/* mpf_set_ui() -- Assign a float from an unsigned int. |
|
|
Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc. |
Copyright 1993, 1994, 1995, 2001, 2002 Free Software Foundation, Inc. |
|
|
This file is part of the GNU MP Library. |
This file is part of the GNU MP Library. |
|
|
Line 23 MA 02111-1307, USA. */ |
|
Line 23 MA 02111-1307, USA. */ |
|
#include "gmp-impl.h" |
#include "gmp-impl.h" |
|
|
void |
void |
#if __STDC__ |
mpf_set_ui (mpf_ptr f, unsigned long val) |
mpf_set_ui (mpf_ptr x, unsigned long int val) |
|
#else |
|
mpf_set_ui (x, val) |
|
mpf_ptr x; |
|
unsigned long int val; |
|
#endif |
|
{ |
{ |
if (val != 0) |
mp_size_t size; |
|
|
|
f->_mp_d[0] = val & GMP_NUMB_MASK; |
|
size = val != 0; |
|
|
|
#if GMP_NAIL_BITS != 0 |
|
if (val > GMP_NUMB_MAX) |
{ |
{ |
x->_mp_d[0] = val; |
f->_mp_d[1] = val >> GMP_NUMB_BITS; |
x->_mp_size = 1; |
size = 2; |
x->_mp_exp = 1; |
|
} |
} |
else |
#endif |
{ |
|
x->_mp_size = 0; |
f->_mp_exp = f->_mp_size = size; |
x->_mp_exp = 0; |
|
} |
|
} |
} |