www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14503] New: BigInt to binary/octal and lower case "%x"

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 puremagic.com
          Reporter: dennis.m.ritchie 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 */
}

--
Apr 26 2015