This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Description: libstdc++ does not conform to the C++ (draft) standard n3225 22.4.2.2.2??? num_put virtual functions??? [facet.num.put.virtuals] ??? Table 88 - Floating-Point Conversions Currently the %a and %A conversion are not supported. They are supposed to be used when the ostream flags ios_base::fixed and ios_base::scientific are both set. This patch adds that functionality. 22.4.2.1.2??? num_get virtual functions??? [facet.num.get.virtuals] ???? For conversions to a floating type the specifier is %g and the conversion function is strtold() Based on the definition of strtold() from the C standard n1124 7.20.1.3 The strtod, strtof, and strtold functions This indicates that hexadecimal values are converted based on the syntax of section 6.4.4.2 Basically the format is the same as defined for normal floating point literals in C++ except: 1) The value is prefixed with 0x or 0X 2) use 'p' or 'P' rather than 'e' or 'E' 3) The top fractional part uses hex digits (the exponent is still base 10 digits) This functionality has been added. TestCase changes: The following files have additional test ?????? testsuite/22_locale/num_get/get/char/2.cc ?????? testsuite/22_locale/num_get/get/wchar_t/2.cc ?????? testsuite/22_locale/num_put/put/char/6.cc ?????? testsuite/22_locale/num_put/put/wchar_t/6.cc GNU Style checks: I ran the command? contrib/check_GNU_style.sh on the patch file. It showed difference for: ?????? There should be exactly one space between function name and parentheses. ??????????? In all these situations the style matched the surrounding code so maintain consistency ??????????? with the current code I did not change it. ?????? There should be no space before closing parentheses. ??????????? In all these situations the code was using the macro VERIFY() and matched the ??????????? usage of the surrounding code. Thus to maintain consistency it was not corrected. Change Log Entry 2010-01-26 Martin York <Martin.AmazonYork@gmail.com> * num_put facet Floating-Point Conversions. When both the fixed and scientific flags are set on a ostream floating point numbers will be output using the format specifier %a or %A (depending n the state of the ostreams uppercase flag). This mean the floating point values are output hex encoded into a text stream. If the float radix of your compiler is a power of two then this representation is loss-less if you output the number with enough precision. -> std::numeric_limits<FLOAT Type>::digits /4 * num_get facet Floating-Point Conversions. Compliments the changes to num_put so that float values in a hexadecimal representation can be retrieved from a formatted text stream. Bootstrapping and testing Changes were done on Max. > uname -a Darwin Alpha.local 10.6.0 Darwin Kernel Version 10.6.0: Wed Nov 10 18:13:17 PST 2010; root:xnu-1504.9.26~3/RELEASE_I386 i386 With: > x-g++ --version x-g++ (GCC) 4.6.0 20110120 (experimental) Note: I use the prefix 'x-' to distinguish this compiler from the system default. See attached file `test.result.txt` for test result run Patch: Please find the patch file attached. floathex.patch.txt
Attachment:
test.result.txt
Description: Text document
Attachment:
floathex.patch.txt
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |