Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions changelog/formatting_floats_in_CTFE.dd
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
`float` and `double` values can be formatted at compile time

Example:
------
import std.format : format;
import std.math : sqrt;

enum pi = format!"%s"(3.1415926f);
static assert(pi == "3.14159");

enum golden_ratio = format!"|%+-20.10E|"((1 + sqrt(5.0)) / 2);
static assert(golden_ratio == "|+1.6180339887E+00 |");
------

Note: It doesn't work for reals yet.
Loading