[BACK]Return to div_ui.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib / gmp / mpf

Diff for /OpenXM_contrib/gmp/mpf/Attic/div_ui.c between version 1.1.1.1 and 1.1.1.3

version 1.1.1.1, 2000/01/10 15:35:22 version 1.1.1.3, 2003/08/25 16:06:35
Line 1 
Line 1 
 /* mpf_div_ui -- Divide a float with an unsigned integer.  /* mpf_div_ui -- Divide a float with an unsigned integer.
   
 Copyright (C) 1993, 1994, 1996 Free Software Foundation, Inc.  Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
   
 This file is part of the GNU MP Library.  This file is part of the GNU MP Library.
   
 The GNU MP Library is free software; you can redistribute it and/or modify  The GNU MP Library is free software; you can redistribute it and/or modify
 it under the terms of the GNU Library General Public License as published by  it under the terms of the GNU Lesser General Public License as published by
 the Free Software Foundation; either version 2 of the License, or (at your  the Free Software Foundation; either version 2.1 of the License, or (at your
 option) any later version.  option) any later version.
   
 The GNU MP Library is distributed in the hope that it will be useful, but  The GNU MP Library is distributed in the hope that it will be useful, but
 WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY  WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public  or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
 License for more details.  License for more details.
   
 You should have received a copy of the GNU Library General Public License  You should have received a copy of the GNU Lesser General Public License
 along with the GNU MP Library; see the file COPYING.LIB.  If not, write to  along with the GNU MP Library; see the file COPYING.LIB.  If not, write to
 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,  the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 MA 02111-1307, USA. */  MA 02111-1307, USA. */
Line 24  MA 02111-1307, USA. */
Line 24  MA 02111-1307, USA. */
 #include "longlong.h"  #include "longlong.h"
   
 void  void
 #if __STDC__  
 mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)  mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
 #else  
 mpf_div_ui (r, u, v)  
      mpf_ptr r;  
      mpf_srcptr u;  
      unsigned long int v;  
 #endif  
 {  {
   mp_srcptr up;    mp_srcptr up;
   mp_ptr rp, tp, rtp;    mp_ptr rp, tp, rtp;
Line 43  mpf_div_ui (r, u, v)
Line 36  mpf_div_ui (r, u, v)
   mp_exp_t rexp;    mp_exp_t rexp;
   TMP_DECL (marker);    TMP_DECL (marker);
   
   #if GMP_NAIL_BITS != 0
     if (v > GMP_NUMB_MAX)
       {
         mpf_t vf;
         mp_limb_t vl[2];
         SIZ(vf) = 2;
         EXP(vf) = 2;
         PTR(vf) = vl;
         vl[0] = v & GMP_NUMB_MASK;
         vl[1] = v >> GMP_NUMB_BITS;
         mpf_div (r, u, vf);
         return;
       }
   #endif
   
   usize = u->_mp_size;    usize = u->_mp_size;
   sign_quotient = usize;    sign_quotient = usize;
   usize = ABS (usize);    usize = ABS (usize);
   prec = r->_mp_prec;    prec = r->_mp_prec;
   
   if (v == 0)    if (v == 0)
     v = 1 / v;                  /* divide by zero as directed */      DIVIDE_BY_ZERO;
   
   if (usize == 0)    if (usize == 0)
     {      {
       r->_mp_size = 0;        r->_mp_size = 0;

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.3

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>