Vb字符串加倍,mfc cstring加倍 [英] Vb string to double vs mfc cstring to double

查看:83
本文介绍了Vb字符串加倍,mfc cstring加倍的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





i有关于VB String的双重转换以及C ++ CString转换为双倍的问题。



i在VB中有一个值:



String - > 2.48365014976068



在VB中他们使用Val函数转换为double时他们在double中得到相同的值,即(2.48365014976068)




$ C $ b in C ++:



String - > 2.48365014976068


$ C $ b在C ++中从CString转换为double的两倍是(即2.4836501497606802)



vb和c ++给出不同的值..请帮助我



我尝试过的事情:



VB:

double d = Val(2.48365014976068)



C ++:

double d = _tsof(2.48365014976068)

Hi,

i had got issue regarding VB String to double conversion and C++ CString to double conversion.

i have a value in VB :

String -> 2.48365014976068

in VB they are using Val function while converting to double they are getting the same value in double as well i.e (2.48365014976068)


in C++:

String -> 2.48365014976068

in C++ while converting from CString to double the value in double is ( i.e 2.4836501497606802)

both vb and c++ giving different values ..please help me

What I have tried:

VB:
double d = Val(2.48365014976068)

C++:
double d = _tsof(2.48365014976068)

推荐答案

不,两者的值都相同。它只是字符串表示不同。请参阅每个计算机科学家应该知道的关于浮点运算的内容 [ ^ ]。
No, the values are both the same. It is only the string representation that is different. See What Every Computer Scientist Should Know About Floating-Point Arithmetic[^].


这篇关于Vb字符串加倍,mfc cstring加倍的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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