On Thursday, 14 September 2023 at 03:23:48 UTC, An Pham wrote:
import std.stdio;void main() { float f = 6394763.345f; import std.format : sformat; char[80] vBuffer = void;writeln("6394763.345 = ", sformat(vBuffer[], "%.4f", f));} Output 6394763.345 = 6394763.5000
Classic question. The float literal `6394763.345f` is not representable as IEEE-754 floating point number.
Try https://www.h-schmidt.net/FloatConverter/IEEE754.html for a short introduction to the issue.