最近在项目中遇到一个与PC位宽有关的问题:
用C#做了一个软件,处理数据,在xp、win7(都是32位的)下运行一切正常;但是在64为的win7下运行,则会出错,代码如下:
public const float const_times= 18.02f;
private const float standardtimes = 1000.0f;//主机指血值放大倍数
private const float bsvaluetimes = 1000.0f;//主机血糖值放大倍数
//Decode()返回int型数据
record.iValue = (float)Decode(bBuffer, curPos, 5, 2) / 10.00f;
record.uValue = (double)Decode(bBuffer, curPos, 7, 2) / 1000.00f;
record.activity = Decode(bBuffer, curPos, 9, 1);
record.standard = (float)Decode(bBuffer, curPos, 10, 2) * const_times /standardtimes;
record.iValue、record.uvalue均正常,但是record.standard被放大了100倍
Eidolem
11 years, 7 months ago