/* --------------------------------------------------------------- File Name: fpbin.c Author: James E. Stine Dept. of EECS Lehigh University Last Revised: 6/13/97 Purpose: This file contains support for display a double-precision number in matlab in Hex, Binary, and Decimal (up to 64 digits) Copyright: Lehigh University 1997, 1998, 1999 Use without express written consent is strictly forbidden. Violators shall be persecuted at the highest extent of the law. -------------------------------------------------------------------*/ #include "mex.h" #include "matrix.h" #include "round.h" #include #include #include #define INPUT_ARRAY prhs[0] /* Function Prototype */ void disp_binary(double, int, int); void disp_dp_counter(int); /* Global Declarations */ double dp_approx; union { unsigned short x[4]; double v; } dp_number; /* Function: disp_dp_counter Description: This function displays the Double-Precision counter and legend associated with the double type. Argument List: int bits Return value: none */ void disp_dp_counter(int bits) { int i; int j; /* Write whether position is s, e, or m */ j = 1; mexPrintf("s"); for(i=0;i<11;i++) { mexPrintf("e"); j++; } for(i=0;i<52;i++) { if (j%16 == 0) mexPrintf(" "); mexPrintf("m"); j++; } /* Line break */ mexPrintf("\n"); /* Write counter on next line */ for(i=0; i