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.84e-308作为输出。
我正在打印printf("Time: %4.3g\n",tm.getTime());
printf("Time: %4.3g\n",tm.getTime());
你试过使用%f吗?
%f
printf("Time: %4.3f\n",tm.getTime())
printf("Time: %400.399f\n",tm.getTime())
是的?
在这里,您必须将数据类型格式更改为双精度。编写代码如下所述:
printf("时间: %4.3g\n",tm.getTime(double_variable))
你可以从上面的编码中得到 1.84e-308。