在USC ++中将USHORT转换为double [英] Converting USHORT to double in c++

查看:262
本文介绍了在USC ++中将USHORT转换为double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在c ++中将无符号短值转换为double?

How to convert a unsigned short value in to double in c++?

推荐答案

由于double的位大于unsigned short',你应该只是能够分配它。例如

Since double''s bit-size is larger than unsigned short''s, you should simply be able to assign it. E.g.
unsigned short x = 5;
double y = x;





这是给你的一个问题?你的代码是什么样的?



问候,

Ian。



Is this giving you a problem? What does your code look like?

Regards,
Ian.


刚刚施展价值:

Just cast the value:
// C style casting
double fDouble = (double)uShort;
// C++ style casting using the static_cast operator
double fDouble = static_cast<double>(uShort);


这篇关于在USC ++中将USHORT转换为double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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