Thread overview
[Issue 20535] std.format: %b, %o, %x and %X on negative integers gives wrong result
Jan 26, 2020
berni44
Dec 03, 2020
Bolpat
Mar 01, 2021
Berni44
Dec 17, 2022
Iain Buclaw
January 26, 2020
https://issues.dlang.org/show_bug.cgi?id=20535

berni44 <bugzilla@d-ecke.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody@puremagic.com        |bugzilla@d-ecke.de

--
December 03, 2020
https://issues.dlang.org/show_bug.cgi?id=20535

Bolpat <qs.il.paperinik@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |qs.il.paperinik@gmail.com
         Resolution|---                         |INVALID

--- Comment #1 from Bolpat <qs.il.paperinik@gmail.com> ---
Reading https://dlang.org/phobos/std_format.html#formattedWrite section 'b','d','o','x','X':
> [...] If the argument is a signed type and the FormatChar is d it is converted to a signed string of characters, otherwise it is treated as unsigned. [...]

So, clearly, the intended result for negative numbers is not a minus sign and magnitude, but two's complement.

--
March 01, 2021
https://issues.dlang.org/show_bug.cgi?id=20535

Berni44 <bugzilla@bernis-buecher.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |bugzilla@bernis-buecher.de
         Resolution|INVALID                     |---
           Severity|normal                      |enhancement

--- Comment #2 from Berni44 <bugzilla@bernis-buecher.de> ---
Even, if the current specs state it, this is inconsistent behavior and while it's easy for a user to get the current behavior with a changed implementation it is not possible to get the wished for behavior with the current implementation. So I'm reopening this, but changing to enhancement.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=20535

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--
December 01
https://issues.dlang.org/show_bug.cgi?id=20535

--- Comment #3 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/phobos/issues/10404

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--