<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"> <title>print_scs.c Source File</title> <link href="doxygen.css" rel="stylesheet" type="text/css"> </head><body> <!-- Generated by Doxygen 1.2.15 --> <center> <a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="annotated.html">Data Structures</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Data Fields</a> <a class="qindex" href="globals.html">Globals</a> </center> <hr><h1>print_scs.c</h1><div class="fragment"><pre>00001 <font class="comment">/*</font> 00002 <font class="comment"> * Author : Defour David</font> 00003 <font class="comment"> * Contact : David.Defour@ens-lyon.fr</font> 00004 <font class="comment"> *</font> 00005 <font class="comment"> * This program is free software; you can redistribute it and/or modify</font> 00006 <font class="comment"> * it under the terms of the GNU Lesser General Public License as published by</font> 00007 <font class="comment"> * the Free Software Foundation; either version 2 of the License, or </font> 00008 <font class="comment"> * (at your option) any later version.</font> 00009 <font class="comment"> * </font> 00010 <font class="comment"> * This program is distributed in the hope that it will be useful,</font> 00011 <font class="comment"> * but WITHOUT ANY WARRANTY; without even the implied warranty of</font> 00012 <font class="comment"> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the</font> 00013 <font class="comment"> * GNU General Public License for more details.</font> 00014 <font class="comment"> *</font> 00015 <font class="comment"> * You should have received a copy of the GNU Lesser General Public License</font> 00016 <font class="comment"> * along with this program; if not, write to the Free Software</font> 00017 <font class="comment"> * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. </font> 00018 <font class="comment"> */</font> 00019 <font class="preprocessor">#include <stdio.h></font> 00020 <font class="preprocessor">#include "<a class="code" href="scs_8h.html">scs.h</a>"</font> 00021 <font class="preprocessor">#include "<a class="code" href="scs__private_8h.html">scs_private.h</a>"</font> 00022 00023 00024 <font class="comment">/*</font> 00025 <font class="comment"> * used by the next function to write</font> 00026 <font class="comment"> * bit of the integer in the right order ....</font> 00027 <font class="comment"> */</font> 00028 <font class="keywordtype">void</font> print_order(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> x, <font class="keywordtype">int</font> nb, <font class="keywordtype">int</font> b){ 00029 <font class="keywordflow">if</font> (nb<=0) 00030 <font class="keywordflow">return</font>; 00031 print_order(x/b, nb-1, b); 00032 printf(<font class="stringliteral">"%d"</font>,x%b); 00033 <font class="keywordflow">return</font>; 00034 } 00035 <font class="comment">/*</font> 00036 <font class="comment"> * print nb digits of the chain x in base "b"</font> 00037 <font class="comment"> * b must be between 1 and 10</font> 00038 <font class="comment"> */</font> 00039 <font class="keywordtype">void</font> print_integer(<font class="keywordtype">unsigned</font> <font class="keywordtype">int</font> x, <font class="keywordtype">int</font> b, <font class="keywordtype">int</font> nb){ 00040 00041 <font class="keywordflow">if</font> ((b < 2)||(b>16)){ 00042 fprintf(stderr,<font class="stringliteral">" ERROR: You musn't print number with a base larger than 10 or less than 2 \n"</font>); 00043 <font class="keywordflow">return</font>; 00044 } 00045 print_order(x, nb, b); 00046 <font class="keywordflow">return</font>; 00047 } 00048 00049 00050 <font class="comment">/*</font> 00051 <font class="comment"> * Convert a double precision number in it scs multiprecision</font> 00052 <font class="comment"> * representation</font> 00053 <font class="comment"> *</font> 00054 <font class="comment"> * Rem. : We haven't tested all special cases yet.</font> 00055 <font class="comment"> */</font> 00056 00057 <font class="comment">/*</font> 00058 <font class="comment"> */</font> 00059 <font class="keywordtype">void</font> scs_get_std( <a class="code" href="structscs.html">scs_ptr</a> x){ 00060 <font class="keywordtype">int</font> i; 00061 scs_db_number d; 00062 00063 <a class="code" href="scs2double_8c.html#a0">scs_get_d</a>(&d.d, x); 00064 printf(<font class="stringliteral">"Exception : %e \n"</font>, X_EXP); 00065 printf(<font class="stringliteral">"Index= %d \n Sign= %d \n Double value= %.30e \n Hex mantissa= %x %x\n"</font>, 00066 X_IND, X_SGN, d.d, d.i[HI_ENDIAN], d.i[LO_ENDIAN]); 00067 <font class="keywordflow">for</font>(i=0;i<SCS_NB_WORDS;i++){ 00068 printf(<font class="stringliteral">" D %d : %8x %20d \n"</font>,i, X_HW[i], X_HW[i]); 00069 } 00070 } 00071 00072 00073 </pre></div><hr><address align="right"><small>Generated on Tue Jun 17 10:15:51 2003 for SCSLib by <a href="http://www.doxygen.org/index.html"> <img src="doxygen.png" alt="doxygen" align="middle" border=0 width=110 height=53></a>1.2.15 </small></address> </body> </html>