Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我通常打印具有特定数量的十进制数字的数字,但我现在需要打印具有指定数量的有效数字的数字。数字需要像“1.23”而不是“1.2 E0”。我看到 Delphi 将使用 G 格式执行后者,但我看不到如何以前一种格式执行此操作。
使用格式:
Format('%.3g',[Value]));
'g' 指定有效数字,我会让你弄清楚 3 的含义......
FormatFloat('0.000', YourFloatNumber)
使用尽可能多的零来表示数字。