Changeset 51022e9b in mainline
- Timestamp:
- 2005-09-03T12:56:14Z (19 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 544b4bf
- Parents:
- ffcccf26
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
arch/ia32/src/boot/memmap.S
rffcccf26 r51022e9b 116 116 e801memorysize: 117 117 .long 0 118 118 -
include/print.h
rffcccf26 r51022e9b 37 37 #define INT64 8 38 38 39 static void print_double(double num, __u16 precision) ;39 static void print_double(double num, __u8 modifier, __u16 precision) ; 40 40 static void print_str(const char *str); 41 41 static void print_fixed_hex(const __u64 num, const int width); -
src/debug/print.c
rffcccf26 r51022e9b 42 42 #define DEFAULT_DOUBLE_BUFFER_SIZE 128 43 43 44 void print_double(double num, __u 16 precision)44 void print_double(double num, __u8 modifier, __u16 precision) 45 45 { 46 46 double intval,intval2; … … 49 49 unsigned char buf[DEFAULT_DOUBLE_BUFFER_SIZE]; 50 50 unsigned long in1,in2; 51 51 52 /* 52 53 if (fmath_is_nan(num)) { … … 61 62 62 63 num=fmath_abs(num); 64 65 if ((modifier=='E')||(modifier=='e')) { 66 intval2=fmath_fint(fmath_get_decimal_exponent(num),&intval); 67 exponent=intval; 68 if ((intval2<0.0)&&(exponent<0)) exponent--; 69 num = num / ((fmath_dpow(10.0,exponent))); 70 71 print_double(num,modifier+1,precision); //modifier+1 = E => F or e => f 72 putchar(modifier); 73 if (exponent<0) { 74 putchar('-'); 75 exponent*=-1; 76 } 77 print_number(exponent,10); 78 return; 79 } 80 63 81 64 82 /* … … 233 251 va_list ap; 234 252 char c; 235 253 254 __u16 precision; 255 236 256 va_start(ap, fmt); 237 257 … … 242 262 switch (c) { 243 263 264 265 244 266 /* control character */ 245 267 case '%': 268 269 precision = DEFAULT_DOUBLE_PRECISION; 270 if (fmt[i]=='.') { 271 precision=0; 272 c=fmt[++i]; 273 while((c>='0')&&(c<='9')) { 274 precision = precision*10 + c - '0'; 275 c=fmt[++i]; 276 } 277 278 } 279 246 280 switch (c = fmt[i++]) { 247 281 … … 299 333 300 334 case 'F': 335 print_double(va_arg(ap, double),'F',precision); 336 goto loop; 337 301 338 case 'f': 302 print_double(va_arg(ap, double),DEFAULT_DOUBLE_PRECISION); 303 goto loop; 339 print_double(va_arg(ap, double),'f',precision); 340 goto loop; 341 342 case 'E': 343 print_double(va_arg(ap, double),'E',precision); 344 goto loop; 345 case 'e': 346 print_double(va_arg(ap, double),'e',precision); 347 goto loop; 348 304 349 /* 305 350 * Decimal and hexadecimal conversions. -
test/print/print1/test.c
rffcccf26 r51022e9b 39 39 printf(" F %F %f (123456789.987654321)\n",123456789.987654321,123456789.987654321); 40 40 printf(" F %F %f (-123456789.987654321e-10)\n",-123456789.987654321e-10,-123456789.987654321e-10); 41 printf(" E %E %e (123456789.987654321)\n",123456789.987654321,123456789.987654321); 42 printf(" E %.10E %.8e (-123456789.987654321e-12 for precision 10 & 8)\n",-123456789.987654321e-12,-123456789.987654321e-12); 43 printf(" E %.10E %.8e (-987654321.123456789e-12 for precision 10 & 8)\n",-987654321.123456789e-12,-987654321.123456789e-12); 44 printf(" E %.10E %.8e (123456789.987654321e-12 for precision 10 & 8)\n",123456789.987654321e-12,123456789.987654321e-12); 45 printf(" E %.10E %.8e (987654321.123456789e-12 for precision 10 & 8)\n",987654321.123456789e-12,987654321.123456789e-12); 46 printf(" E %.10E %.8e (-123456789.987654321e12 for precision 10 & 8)\n",-123456789.987654321e12,-123456789.987654321e12); 47 printf(" E %.10E %.8e (-987654321.123456789e12 for precision 10 & 8)\n",-987654321.123456789e12,-987654321.123456789e12); 48 printf(" E %.10E %.8e (123456789.987654321e12 for precision 10 & 8)\n",123456789.987654321e12,123456789.987654321e12); 49 printf(" E %.10E %.8e (987654321.123456789e12 for precision 10 & 8)\n",987654321.123456789e12,987654321.123456789e12); 41 50 return; 42 51 }
Note:
See TracChangeset
for help on using the changeset viewer.