Main Page   Data Structures   File List   Data Fields   Globals  

print_scs.c

00001 /*
00002  * Author  : Defour David
00003  * Contact : David.Defour@ens-lyon.fr
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU Lesser General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or 
00008  * (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU Lesser General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  
00018  */
00019 #include <stdio.h>
00020 #include "scs.h"
00021 #include "scs_private.h"
00022 
00023 
00024 /*
00025  * used by the next function to write
00026  * bit of the integer in the right order ....
00027  */
00028 void print_order(unsigned int x, int nb, int b){
00029   if (nb<=0)
00030     return;
00031   print_order(x/b, nb-1, b);
00032   printf("%d",x%b);
00033   return;
00034 }
00035 /*
00036  * print nb digits of the chain x in base "b"
00037  * b must be between 1 and 10
00038  */ 
00039 void print_integer(unsigned int x, int b, int nb){
00040    
00041   if ((b < 2)||(b>16)){
00042     fprintf(stderr," ERROR: You musn't print number with a base larger than 10 or less than 2 \n");
00043     return;
00044   }
00045   print_order(x, nb, b);
00046   return;
00047 }
00048 
00049 
00050 /*
00051  * Convert a double precision number in it scs multiprecision
00052  * representation
00053  *
00054  * Rem. : We haven't tested all special cases yet.
00055  */
00056 
00057 /*
00058  */
00059 void scs_get_std( scs_ptr x){
00060   int i; 
00061   scs_db_number d;
00062 
00063   scs_get_d(&d.d, x);
00064   printf("Exception : %e \n", X_EXP);
00065   printf("Index= %d   \n Sign=  %d \n Double value= %.30e   \n Hex mantissa= %x %x\n", 
00066          X_IND, X_SGN, d.d, d.i[HI_ENDIAN], d.i[LO_ENDIAN]);
00067   for(i=0;i<SCS_NB_WORDS;i++){
00068     printf("  D %d :  %8x %20d \n",i, X_HW[i], X_HW[i]);
00069   }
00070 }
00071 
00072 
00073 

Generated on Tue Jun 17 10:15:51 2003 for SCSLib by doxygen1.2.15