Changeset 244335b
- Timestamp:
- May 4, 2026, 12:11:43 PM (2 days ago)
- Branches:
- master
- Children:
- 9375148
- Parents:
- bb1eabc
- Files:
-
- 5 edited
-
doc/user/user.tex (modified) (3 diffs)
-
libcfa/src/iostream.cfa (modified) (6 diffs)
-
tests/io/.expect/manipulatorsOutput2.arm64.txt (modified) (1 diff)
-
tests/io/.expect/manipulatorsOutput2.x64.txt (modified) (1 diff)
-
tests/io/.expect/manipulatorsOutput2.x86.txt (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
doc/user/user.tex
rbb1eabc r244335b 11 11 %% Created On : Wed Apr 6 14:53:29 2016 12 12 %% Last Modified By : Peter A. Buhr 13 %% Last Modified On : Mon May 4 07:19:24 202614 %% Update Count : 74 3613 %% Last Modified On : Mon May 4 12:09:44 2026 14 %% Update Count : 7440 15 15 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 16 16 … … 5405 5405 5406 5406 \item 5407 \Indexc{hex}( integer / floating-point / character / string )\index{manipulator!hex@©hex©} print value in base 16 preceded by ©0x©/©0X©.5407 \Indexc{hex}( integer / floating-point / character / string )\index{manipulator!hex@©hex©} print value in base 16 preceded by ©0x©/©0X©. 5408 5408 \begin{cfa}[belowskip=0pt] 5409 5409 sout | hex( 0 ) | hex( 27HH ) | hex( 27H ) | hex( 27 ) | hex( 27L ); … … 5412 5412 0xe5 0xffe5 0xffffffe5 0xffffffffffffffe5 5413 5413 sout | hex( 0.0 ) | hex( 27.5F ) | hex( 27.5 ) | hex( 27.5L ); 5414 0x0 p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+15414 0x0.p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+1 5415 5415 sout | hex( -27.5F ) | hex( -27.5 ) | hex( -27.5L ); 5416 5416 -0x1.b8p+4 -0x1.b8p+4 -0xd.cp+1 -
libcfa/src/iostream.cfa
rbb1eabc r244335b 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun May 3 22:02:37202613 // Update Count : 2 27112 // Last Modified On : Mon May 4 12:00:48 2026 13 // Update Count : 2310 14 14 // 15 15 … … 599 599 #define SUFFIXES_END (SUFFIXES_START + (int)((sizeof(suffixes) / sizeof(char *) - 1) * 3)) 600 600 601 // Float-point numbers without a fraction are always printed with a decimal point to reflect the constant type. 602 // Programmers must explicitly disable printing the decimal point for values with no fraction using manipulator nodp. 603 // printf supports printing the decimal point using flag #. However specifier g is broken with #. 604 // 605 // printf( "%g %#g %g %#g\n", 4., 4., 4.5, 4.5 ); 606 // 4 4.00000 4.5 4.50000 607 // 608 // when # is specified, g incorrectly prints 6 significant digits. As a result, # cannot be used to force printing of 609 // the decimal point. Instead, any missing decimal point is manually added. 610 601 611 #define PRINT_WITH_DP2( os, format, ... ) \ 602 612 { \ … … 605 615 if ( isfinite( f.val ) && ! f.flags.nobsdp ) { /* if number, print decimal point when no fraction or exponent */ \ 606 616 for ( i = 0; i < len && buf[i] != '.' && buf[i] != 'e' && buf[i] != 'E' && \ 607 buf[i] != 'p' && buf[i] != 'P'; i += 1 ); /* decimal point or scientific ? */ \617 buf[i] != 'p' && buf[i] != 'P'; i += 1 ); /* decimal point or scientific ? */ \ 608 618 if ( i == len ) { \ 609 619 if ( ! f.flags.left ) { \ … … 619 629 } else { \ 620 630 int exp10, len2; \ 621 eng( f.val, f.pc, exp10 ); /* changes arguments */ \631 eng( f.val, f.pc, exp10 ); /* changes arguments */ \ 622 632 /* printf( "%g %d %d %d %s\n", f.val, f.wd, f.pc, exp10, format ); */ \ 623 633 if ( ! f.flags.left && f.wd > 1 ) { \ … … 657 667 \ 658 668 if ( sepPrt$( os ) ) fmt( os, "%s", sepGetCur$( os ) ); \ 659 char fmtstr[sizeof(DFMTP) + 8]; /* sizeof includes '\0' */ \669 char fmtstr[sizeof(DFMTP) + 8]; /* sizeof includes '\0' */ \ 660 670 if ( ! f.flags.pc ) memcpy( &fmtstr, DFMTNP, sizeof(DFMTNP) ); \ 661 671 else memcpy( &fmtstr, DFMTP, sizeof(DFMTP) ); \ 662 int star = 5; /* position before first '*' */ \672 int star = 5; /* position before first '*' */ \ 663 673 \ 664 674 /* Insert flags into spaces before '*', from right to left. */ \ … … 666 676 if ( f.flags.sign ) { fmtstr[star] = '+'; star -= 1; } \ 667 677 if ( f.flags.pad0 ) { fmtstr[star] = '0'; star -= 1; } \ 668 fmtstr[star] = '\''; star -= 1; /* locale */ \ 678 if ( f.base == 'f' && f.base == 'F' && f.base == 'g' && f.base == 'G' ) { fmtstr[star] = '\''; star -= 1; } /* locale only for f andg */ \ 679 else if ( ! f.flags.nobsdp && (f.base == 'a' || f.base == 'A') ) { fmtstr[star] = '#'; star -= 1; } /* hex special case to get decimal point */ \ 669 680 fmtstr[star] = '%'; \ 670 681 \ 671 if ( ! f.flags.pc ) { /* no precision */ \672 fmtstr[sizeof(DFMTNP)-2] = f.base; /* sizeof includes '\0' */ \673 /* printf( " %g %d %s\n", f.val, f.wd, &fmtstr[star] ); */ \682 if ( ! f.flags.pc ) { /* no precision */ \ 683 fmtstr[sizeof(DFMTNP)-2] = f.base; /* sizeof includes '\0' */ \ 684 /* printf( "[%g %c %d %s]\n", f.val, f.base, f.wd, &fmtstr[star] ); */ \ 674 685 PRINT_WITH_DP2( os, &fmtstr[star], f.wd, f.val ) \ 675 } else { /* precision */ \676 fmtstr[sizeof(DFMTP)-2] = f.base; /* sizeof includes '\0' */ \677 /* printf( " %g %d %d %s\n", f.val, f.wd, f.pc, &fmtstr[star] ); */ \686 } else { /* precision */ \ 687 fmtstr[sizeof(DFMTP)-2] = f.base; /* sizeof includes '\0' */ \ 688 /* printf( "[%g %c %d %d %s]\n", f.val, f.base, f.wd, f.pc, &fmtstr[star] ); */ \ 678 689 PRINT_WITH_DP2( os, &fmtstr[star], f.wd, f.pc, f.val ) \ 679 690 } /* if */ \ -
tests/io/.expect/manipulatorsOutput2.arm64.txt
rbb1eabc r244335b 6 6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffffffffffe5 8 0x0 p+0 0x1.b8p+4 0x1.b8p+4 0x1.b8p+48 0x0.p+0 0x1.b8p+4 0x1.b8p+4 0x1.b8p+4 9 9 -0x1.b8p+4 -0x1.b8p+4 -0x1.b8p+4 10 10 0.000000e+00 2.750000e+01 -2.750000e+01 -
tests/io/.expect/manipulatorsOutput2.x64.txt
rbb1eabc r244335b 6 6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffffffffffe5 8 0x0 p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+18 0x0.p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+1 9 9 -0x1.b8p+4 -0x1.b8p+4 -0xd.cp+1 10 10 0.000000e+00 2.750000e+01 -2.750000e+01 -
tests/io/.expect/manipulatorsOutput2.x86.txt
rbb1eabc r244335b 6 6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffe5 8 0x0 p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+18 0x0.p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+1 9 9 -0x1.b8p+4 -0x1.b8p+4 -0xd.cp+1 10 10 0.000000e+00 2.750000e+01 -2.750000e+01
Note:
See TracChangeset
for help on using the changeset viewer.