/**************************************************************************/
/*                                                                        */
/*                                 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_flot.c,v 1.2 1997/09/25 17:35:33 ae59 Exp $ */
/*
$Log: l_flot.c,v $
 * Revision 1.2  1997/09/25  17:35:33  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:23:19  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : l_flot.c                              */
/*                                                              */
/*      Entries         : multiprecision l_flot(n)              */
/*                        a_intg n;                             */
/*                                                              */
/*      Description     : Generate multiprecision value from    */
/*                        integer value.                        */
/*                                                              */
/*      Date            : 1991-02-14                            */
/*      1991-02-14 : mark temporary result / reset z flag       */
/*      1990-11-15 : E_TPUSH+E_TPOPP                            */
/*      1990-08-06 : assignment sequence changed ->e = ->r = 0  */
/****************************************************************/

#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 multiprecision l_flot(a_intg n)
#else
local multiprecision l_flot(n)

a_intg n;
#endif
        {
        multiprecision res;

        E_TPUSH("l_flot")

        l_init(&res);

        if (res==NULL)
           e_trap(ALLOCATION,2,E_TMSG,65);
        else
           {
           res->f = 1;
           if (n==0)
              res->z = 1;
           else if (b_ball(1,&res->m))
              e_trap(ALLOCATION,2,E_TMSG,65);
           else
              {
              res->e = res->z = res->r = 0;
              res->l = 1;
              if (n>0)
                 {
                 res->m[0] = n;
                 res->s = 0;
                 }
              else
                 {
                 res->m[0] = (n==MININT) ? MSB : -n;
                 res->s = 1;
                 }
              }
           }

        E_TPOPP("l_flot")
        return(res);
        }
