mirror of
https://github.com/dlang/phobos.git
synced 2025-05-01 07:30:33 +03:00
Fix Issue 8424 - Compile time conversions of double/floats to strings
This commit is contained in:
parent
36152d4e2e
commit
c75bd8756d
1 changed files with 8 additions and 0 deletions
|
@ -1033,6 +1033,14 @@ if (is(FloatingPointTypeOf!T) && !is(T == enum) && !hasToString!(T, Char))
|
||||||
assert(format("%#.6g",a) == "-1.00000e+06");
|
assert(format("%#.6g",a) == "-1.00000e+06");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://issues.dlang.org/show_bug.cgi?id=8424
|
||||||
|
@safe pure unittest
|
||||||
|
{
|
||||||
|
static assert(format("%s", 0.6f) == "0.6");
|
||||||
|
static assert(format("%s", 0.6) == "0.6");
|
||||||
|
static assert(format("%s", 0.6L) == "0.6");
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Formatting a `creal` is deprecated but still kept around for a while.
|
Formatting a `creal` is deprecated but still kept around for a while.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue