From 5516a03e6839f5b22e0facce219de8061df24e2c Mon Sep 17 00:00:00 2001 From: Bernhard Seckinger Date: Sun, 17 Nov 2019 13:56:14 +0100 Subject: [PATCH] Fix partially Issue 20371 - std.format limited to 500 characters for floats --- std/format.d | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/std/format.d b/std/format.d index cae32ff21..5d07ab07e 100644 --- a/std/format.d +++ b/std/format.d @@ -2882,6 +2882,25 @@ useSnprintf: assert(format!"%a"(nextUp(0.0)) == "0x0.0000000000001p-1022"); } +// issue 20371 +@safe unittest +{ + assert(format!"%.1000a"(1.0) == + "0x1.000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"000000000000000000000000000000000000000000000000000000000000000000000000000000" + ~"0000000000000000000000000000000000000000000000000000000000000000000p+0"); +} + /* Formatting a `creal` is deprecated but still kept around for a while. */