[Issue 14503] New: BigInt to binary/octal and lower case "%x" (hexadecimal format)

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Apr 26 05:05:36 PDT 2015


https://issues.dlang.org/show_bug.cgi?id=14503

          Issue ID: 14503
           Summary: BigInt to binary/octal and lower case "%x"
                    (hexadecimal format)
           Product: D
           Version: future
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: Phobos
          Assignee: nobody at puremagic.com
          Reporter: dennis.m.ritchie at mail.ru

I believe that we need to add new format specifiers for the data type BigInt
also need to fix the uppercase letters to lowercase hexadecimal specifier "%x":

-----
import std.bigint : BigInt;
import std.string : format;
import std.stdio : writeln, writefln;

void main() {

    BigInt n = 15;

    string s = format("%x", n); // does not work properly

    writeln(s);
    writefln("%x", n); // prints F is a bug
    // and to print a lower case

    /*string t = format("%b", n); // Format specifier not understood: %b

    writeln(t); // does not work
    writefln("%b", t); // does not work */

    /*string test = format("%o", n); // Format specifier not understood: %o

    writeln(test); // does not work
    writefln("%o", test); // does not work */
}

--


More information about the Digitalmars-d-bugs mailing list