/**************************************************************************/
/*                                                                        */
/*                                 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: b_bldx.c,v 1.2 1997/09/25 16:58:40 ae59 Exp $ */
/*
$Log: b_bldx.c,v $
 * Revision 1.2  1997/09/25  16:58:40  ae59
 * Copyright-message
 *
 * Revision 1.1  1994/01/27  13:21:08  ae59
 * Put under RCS control
 *
 */
/****************************************************************/
/*                                                              */
/*      Filename        : b_bldx.c                              */
/*                                                              */
/*      Entries         : a_btyp b_bldx(a,res)                  */
/*                        a_real a;                             */
/*                        a_real res;                           */
/*                                                              */
/*      Arguments       : a = real argument of function         */
/*                      : res = real result of function         */
/*                                                              */
/*      Description     : logarithm to base 2 (exact)           */
/*                                                              */
/*      Date            : 1991-04-22                            */
/*      1991-04-22 : real assignment replaced by R_ASSIGN()     */
/*      1990-11-22 : E_TPUSH+E_TPOPP                            */
/*      1990-10-18 : real operations                            */
/****************************************************************/

#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 a_btyp b_bldx(a_real a,a_real *res)
#else
local a_btyp b_bldx(a,res)
a_real a;
a_real *res;
#endif

{
        a_intg expo;
        a_bool vz;
        a_btyp mant[D_U_RATIO];

        E_TPUSH("b_bldx")

        (void)b_deko(a,&expo,mant,&vz);

        if (mant[0]==HIDDEN_BIT && mant[1]==ZERO)
           {
           R_ASSIGN(*res,r_flot(expo));
           E_TPOPP("b_bldx")
           return(1);
           }

        E_TPOPP("b_bldx")
        return(0);
        }
