public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/110749] New: wrong show float
@ 2023-07-20  6:46 alexsyrezerv at mail dot ru
  2023-07-20  7:31 ` [Bug c++/110749] " schwab@linux-m68k.org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: alexsyrezerv at mail dot ru @ 2023-07-20  6:46 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110749

            Bug ID: 110749
           Summary: wrong show float
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: alexsyrezerv at mail dot ru
  Target Milestone: ---

Created attachment 55586
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55586&action=edit
To try on different compillers

Code:
```
#include <iostream>
#include <iomanip>

void func_float_point(std::ostream& os, const double& value, const std::size_t&
size) {
  os << (0.0 > value ? '-' : '0') << std::setw(size - 1) << std::setfill('0')
<< std::abs(value);
}

int main(int, char**) {
  const double a[] = {90.8425, 101.9225};
  for(std::size_t i = 0; i < 2; ++i){
    func_float_point(std::cout, a[i], 17);
    std::cout << std::endl;
  }

  return 0;
}
```
result
```
butiaev@butiaev-VirtualBox:~/tmp$ make bug
g++     bug.cpp   -o bug
butiaev@butiaev-VirtualBox:~/tmp$ ./bug
000000000090.8425
0000000000101.922
butiaev@butiaev-VirtualBox:~/tmp$

```

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2023-07-20 12:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-20  6:46 [Bug c++/110749] New: wrong show float alexsyrezerv at mail dot ru
2023-07-20  7:31 ` [Bug c++/110749] " schwab@linux-m68k.org
2023-07-20  9:09 ` alexsyrezerv at mail dot ru
2023-07-20 10:03 ` redi at gcc dot gnu.org
2023-07-20 10:58 ` alexsyrezerv at mail dot ru
2023-07-20 11:08 ` alexsyrezerv at mail dot ru
2023-07-20 12:10 ` redi at gcc dot gnu.org
2023-07-20 12:10 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).