www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - BigInt to binary

reply "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
Hi,
Is there a way to apply a function "format" with BigInt?

-----
import std.stdio, std.bigint, std.string;

void main() {

	BigInt n = -10;

	string s = format("%b", n); // error

	writeln(s);
}
Apr 25 2015
parent reply "Marc =?UTF-8?B?U2Now7x0eiI=?= <schuetzm gmx.net> writes:
On Saturday, 25 April 2015 at 13:13:10 UTC, Dennis Ritchie wrote:
 Hi,
 Is there a way to apply a function "format" with BigInt?

 -----
 import std.stdio, std.bigint, std.string;

 void main() {

 	BigInt n = -10;

 	string s = format("%b", n); // error

 	writeln(s);
 }
BigInt only supports %d, %x, %X and %s: The missing %o and %b were probably an oversight, feel free to file an enhancement request or submit a PR.
Apr 25 2015
parent reply "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Saturday, 25 April 2015 at 18:58:50 UTC, Marc Schütz wrote:
 BigInt only supports %d, %x, %X and %s:


 The missing %o and %b were probably an oversight, feel free to 
 file an enhancement request or submit a PR.
All right. I will file a request. Just tell me, please, in which section should apply similar requests? https://issues.dlang.org/
Apr 25 2015
parent reply =?UTF-8?B?QWxpIMOHZWhyZWxp?= <acehreli yahoo.com> writes:
On 04/25/2015 01:23 PM, Dennis Ritchie wrote:
 which section should apply similar requests?
 https://issues.dlang.org/
After clicking "File and Issue": Component: Phobos Severity: Enhancement Ali
Apr 25 2015
parent "Dennis Ritchie" <dennis.ritchie mail.ru> writes:
On Saturday, 25 April 2015 at 21:13:29 UTC, Ali Çehreli wrote:
 On 04/25/2015 01:23 PM, Dennis Ritchie wrote:
 which section should apply similar requests?
 https://issues.dlang.org/
After clicking "File and Issue": Component: Phobos Severity: Enhancement Ali
Thanks. I reported this: ----- https://issues.dlang.org/show_bug.cgi?id=14503
Apr 26 2015