Skip to content

Commit

Permalink
Implement LWG-2381 Inconsistency in parsing floating point numbers (#…
Browse files Browse the repository at this point in the history
…3364)

Co-authored-by: nicole mazzuca <[email protected]>
Co-authored-by: statementreply <[email protected]>
Co-authored-by: Casey Carter <[email protected]>
Co-authored-by: Stephan T. Lavavej <[email protected]>
  • Loading branch information
5 people authored May 5, 2023
1 parent 091cad2 commit 368e4b4
Show file tree
Hide file tree
Showing 7 changed files with 992 additions and 310 deletions.
2 changes: 1 addition & 1 deletion stl/inc/xlocmon
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ protected:
const char* _Eb = _Str.c_str();
char* _Ep;
int _Errno = 0;
const long double _Ans = _Stodx_v2(_Eb, &_Ep, 0, &_Errno); // convert and "widen" double to long double
const long double _Ans = _Stodx_v3(_Eb, &_Ep, &_Errno); // convert and "widen" double to long double

if (_Ep == _Eb || _Errno != 0) {
_State |= ios_base::failbit;
Expand Down
553 changes: 254 additions & 299 deletions stl/inc/xlocnum

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions tests/libcxx/expected_results.txt
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ std/language.support/support.limits/support.limits.general/ranges.version.compil
# libc++ is missing various <format> DRs
std/language.support/support.limits/support.limits.general/format.version.compile.pass.cpp FAIL

# libc++ doesn't implement LWG-2381
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp FAIL
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp FAIL

# libc++ doesn't implement LWG-3670
std/ranges/range.factories/range.iota.view/iterator/member_typedefs.compile.pass.cpp FAIL

Expand Down Expand Up @@ -444,11 +448,6 @@ std/containers/sequences/array/array.swap/swap.fail.cpp FAIL
std/algorithms/alg.sorting/alg.merge/inplace_merge_comp.pass.cpp FAIL
std/algorithms/alg.sorting/alg.min.max/minmax_init_list_comp.pass.cpp FAIL

# GH-1259 <locale>: wrong field extraction for hexfloats, or special cases like inf
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_double.pass.cpp FAIL
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_float.pass.cpp FAIL
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp FAIL

# GH-1277 <xlocnum>: We don't match numpunct groups correctly in do_get
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long.pass.cpp FAIL

Expand Down Expand Up @@ -674,6 +673,9 @@ std/time/time.clock/time.clock.file/to_from_sys.pass.cpp FAIL
# libc++'s filesystem::path::iterator models bidirectional_iterator, which is not guaranteed by the Standard
std/input.output/filesystems/class.path/range_concept_conformance.compile.pass.cpp FAIL

# libc++ assumes long double is at least 80-bit; also affected by LWG-2381
std/localization/locale.categories/category.numeric/locale.num.get/facet.num.get.members/get_long_double.pass.cpp FAIL

# MaybePOCCAAllocator doesn't meet the allocator requirements
std/containers/sequences/vector/vector.cons/assign_copy.pass.cpp FAIL

Expand Down
1 change: 1 addition & 0 deletions tests/std/test.lst
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,7 @@ tests\GH_003105_piecewise_densities
tests\GH_003119_error_category_ctor
tests\GH_003246_cmath_narrowing
tests\GH_003617_vectorized_meow_element
tests\LWG2381_num_get_floating_point
tests\LWG2597_complex_branch_cut
tests\LWG3018_shared_ptr_function
tests\LWG3121_constrained_tuple_forwarding_ctor
Expand Down
4 changes: 4 additions & 0 deletions tests/std/tests/LWG2381_num_get_floating_point/env.lst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) Microsoft Corporation.
# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

RUNALL_INCLUDE ..\usual_matrix.lst
Loading

0 comments on commit 368e4b4

Please sign in to comment.