双数据类型错误 [英] Double data type error

查看:61
本文介绍了双数据类型错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

T_Hours=4;
T_Minutes= 55
T_Sec=19
T_Milli=471
T_Micro= 338.

double TimeInMilliSeconds= (T_Hours*60*60*1000)+(T_Minutes*60*1000)+(T_Sec*1000)+T_Milli+(T_Micro/1000);
TimeInMilliSeconds= 17719471.388;





显示为1.77195e + 07但是我希望保持这种格式17719471.388以保持简单可读。



it displayed as 1.77195e+07 but i want to keep this format 17719471.388 to keep it easy readable.

推荐答案

您没有告诉我们如何显示值(用于将值打印到字符串或显示的函数)。根据您的定义,您可以定义如何打印浮点值。



大多数这些函数(除了C ++流)都使用 printf [ ^ ]格式。对于浮点值,'f'格式应该做你想要的。您的示例输出看起来像是使用了'g'或'e'格式。



要获得更多有效数字,请同时指定精度。
You did not show us how the value is displayed (which function is used to print the value to a string or display). Depending on that you can define how floating point values are printed.

Most of these functions (besides C++ streams) use the printf[^] formatting. For floating point values the 'f' format should do what you want. Your example output looks like the 'g' or 'e' format has been used.

To get more significand digits, specify also the precision.


这篇关于双数据类型错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆