Skip to content

[libc++] std::to_chars precision loss for 80-bit long double #56261

Closed as not planned
@alvinhochun

Description

@alvinhochun

std::to_char in libc++ converts long double to double:

to_chars_result to_chars(char* __first, char* __last, long double __value, chars_format __fmt, int __precision) {
return _Floating_to_chars<_Floating_to_chars_overload::_Format_precision>(
__first, __last, static_cast<double>(__value), __fmt, __precision);

Test shows libc++ std::to_char output being different from printf/std::ostream, and compared to libstdc++: https://godbolt.org/z/GsYfTTjq7

Metadata

Metadata

Assignees

Labels

confirmedVerified by a second partylibc++libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions