Changeset 328
- Timestamp:
- 03/04/05 23:55:11 (4 years ago)
- Files:
-
- trunk/mango/test/unittest.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/mango/test/unittest.d
r324 r328 2405 2405 2406 2406 *******************************************************************************/ 2407 /+ 2407 /+ 2408 2408 extern (C) 2409 2409 { 2410 double strtod (char *s00, char **se);2411 char *dtoa (double d, int mode, int ndigits, int *decpt, int *sign, char **rve);2412 2413 void* __dToaMalloc (uint size)2414 {2415 throw new Exception ("unhandled request from dtoa");2416 return null;2417 }2418 2419 2410 int printf (char *format, ...) 2420 2411 { … … 2423 2414 } 2424 2415 } 2425 2426 /******************************************************************************* 2427 2428 2429 *******************************************************************************/ 2416 +/ 2417 2418 /******************************************************************************* 2419 2420 2421 *******************************************************************************/ 2422 /+ 2423 private import mango.format.DGDouble; 2430 2424 2431 2425 void testConvert () … … 2435 2429 char *zz; 2436 2430 static uint[] ff = [1, 2, 3, 4]; 2437 char[] num = "0. 30103010301030103001030103e-3";2431 char[] num = "0.12345678+1"; 2438 2432 2439 2433 2440 2434 double x = Double.parse (num); 2441 2435 double y = std.c.stdlib.strtold (num, &zz); 2442 double z = strtod (num, &zz); 2443 2444 char *end; 2445 int dec, 2446 sign; 2447 char* ss = dtoa (x, 0, 20, &dec, &sign, &end); 2448 2436 double z = DGDouble.parse (num); 2437 2438 2449 2439 Stdout (Double.format (s, x, 20)) (CR); 2450 2440 Stdout (Double.format (s, y, 20)) (CR); … … 2453 2443 printf ("%.20lf\n", y); 2454 2444 printf ("%.20lf\n", z); 2455 printf ("%s\n", ss); 2445 printf ("%.*s\n", DGDouble.format (s, x, 4)); 2446 printf ("%.*s\n", DGDouble.format (s, z, 6, true, 0)); 2456 2447 } 2457 2448 +/
