HPGCC3 Documentation 3.0 R003
|
00001 //& *** (c) 2006-2011 The HPGCC3 Team *** 00002 //& Claudio Lapilli 00003 //& Ingo Blank 00004 //& 00005 //& This file is licensed under the terms and conditions of the 00006 //& HPGCC3 license that is included with the source distribution. 00007 //& *** (c) 2006-2011 The HPGCC3 Team *** 00008 00009 00010 // TYPE DEFINITIONS 00011 00012 // EXTENDED REAL FORMAT: 00013 // BASE-2: 00014 // * LEFT-JUSTIFIED MANTISSA, BASE-2 EXPONENT 00015 // BASE-10: 00016 // * INTEGER BASE-10 MANTISSA, BASE-10 EXPONENT 00017 00018 #ifndef _XREAL_H 00019 00020 #define _XREAL_H 00021 00036 typedef struct { 00040 unsigned long long Mant; // 64-BIT MANTISSA, LEFT OR RIGHT JUSTIFIED 00044 signed Exp:31; // 31-BIT SIGNED EXPONENT 00048 unsigned Sign:1; // 1-BIT SIGN 00049 } XREAL; 00050 00051 // MACRO REPLACEMENT FOR TRIVIAL FUNCTIONS 00052 00053 #define xr_xr2uint(num) ((unsigned int)xr_xr2ullong(num)) 00054 00055 // GENERAL STRING CONVERSION ROUTINES REPLACED BY MACROS 00056 00064 struct conversion_data { 00078 unsigned int flags; 00082 int width; 00086 int precision; 00090 int base; 00100 int type; 00101 }; 00102 00113 void xr_10pow(int exp10,XREAL *value); 00125 char *xr_atoxr(const char *str,XREAL *res); 00126 00140 char *xr_xrtoa(XREAL *number, struct conversion_data *data); 00141 00142 00143 00155 void xr_base2(XREAL *base10,XREAL *res); 00168 void xr_base10(XREAL *base2,XREAL *res); 00180 void xr_div(XREAL *num,XREAL *div,XREAL *result); 00193 void xr_mul(XREAL *num1,XREAL *num2,XREAL *result); 00206 void xr_add(XREAL *num1,XREAL *num2,XREAL *result); 00219 void xr_sub(XREAL *num1,XREAL *num2,XREAL *result); 00230 void xr_double2xr(double val,XREAL *num); 00242 void xr_int2xr(int val,XREAL *num); 00254 void xr_llong2xr(long long val,XREAL *num); 00266 void xr_uint2xr(unsigned int val,XREAL *num); 00278 void xr_ullong2xr(unsigned long long val,XREAL *num); 00289 double xr_xr2double(XREAL *num); 00300 long long xr_xr2llong(XREAL *num); 00311 int xr_xr2int(XREAL *num); 00321 unsigned long long xr_xr2ullong(XREAL *num); 00322 00327 int xr_getbasedigit(char num,int base); 00332 unsigned long long xr_getbaselimit(int base); 00337 int xr_getdigits10(XREAL *xr,char *buffer); 00341 int xr_getdigits(XREAL *num,char *buffer,int base); 00345 int xr_getnumbits(int number); 00346 00350 #define LN2_LN10 1292913987LL 00351 00352 #endif 00353 00354 00355