/**************************************************************************/
/*                                                                        */
/*                                 Sources                                */
/*                                from  the                               */
/*                           XSC SOFTWARE PACKAGE                         */
/*                                                                        */
/*                Copyright (c) 1997 University of Karlsruhe              */
/*                     Institute for Appl. Mathematics                    */
/*                                                                        */
/* This program is free software for non-commercial use. For details, see */
/* the file LICENSE.XSC, distributed with this software package.          */
/*                                                                        */
/* This program is distributed WITHOUT ANY WARRANTY. For details, see the */
/* file LICENSE.XSC, distributed with this software package.              */
/*                                                                        */
/**************************************************************************/

/* RCS $Id: l_exct.c,v 1.2 1997/09/25 17:35:08 ae59 Exp $ */
/*
$Log: l_exct.c,v $
 * Revision 1.2  1997/09/25  17:35:08  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:23:17  ae59
 * Put under RCS control
 *
 */

/****************************************************************/
/*                                                              */
/*      Filename        : l_exct.c                              */
/*                                                              */
/*      Entries         : void l_exct(a,b,r,l)                  */
/*                        multiprecision *a;                    */
/*                        multiprecision b;                     */
/*                        a_intg *r;                            */
/*                        a_intg *l;                            */
/*                                                              */
/*      Arguments       : a = multiprecision variable           */
/*                        b = multiprecision value              */
/*                        r = rounding bits                     */
/*                        l = length of mantissa                */
/*                                                              */
/*      Description     : Assign exact multiprecision value     */
/*                        without considering Maxl and without  */
/*                        changing rounding flags or mantissa   */
/*                        length.                               */
/*                                                              */
/*      Date            : 1991-11-22                            */
/*      1991-11-22 : new routine                                */
/****************************************************************/

#ifndef ALL_IN_ONE
#ifdef AIX
#include "/u/p88c/runtime/o_defs.h"
#else
#include "o_defs.h"
#endif
#define local
#endif

#ifdef LINT_ARGS
local void l_exct(multiprecision *a,multiprecision b,a_intg *r,a_intg *l)
#else
local void l_exct(a,b,r,l)

multiprecision *a;
multiprecision b;
a_intg *r;
a_intg *l;
#endif
        {
        E_TPUSH("l_exct")

        *l = (b->z) ? -((a_intg)MAXINT) : (a_intg)b->l;
        *r = b->r;

        if (*a==b) { E_TPOPP("l_exct") return; }

        if ((*a)->l!=0)
           {
           (*a)->l = 0;
#ifdef HEAP_CHECK
b_freh((a_char *)&(*a)->m,(a_char *)(*a)->m,(a_char *)"l_exct");
#endif
           B_FREE((*a)->m)
           }

        if (((*a)->z = b->z)==0)
           {
           if (b_ball(b->l,&(*a)->m)) 
              e_trap(ALLOCATION,2,E_TMSG,65);
           else
              {
              (*a)->e = b->e;
              (*a)->s = b->s;
              (*a)->l = b->l;
              B_COPY((*a)->m,b->m,b->l)
              }
           }

        (*a)->r = b->r;
 
        if (b->f) l_free(&b);

        E_TPOPP("l_exct")
        return;
        }

