C ++
unsigned char lbytes[] = { 0x0A, 0x01, 0x02 };
unsigned char bytes[10];
double dbl = sin((double)i) * 10;
i+=5; if (i == 360) i = 0;
memcpy(&bytes, &lbytes, 3);
cout << dbl << endl;
memcpy(&bytes[3], &dbl, sizeof(double));
C#
switch (m[1]) {
case 0x01: {
if (m.Length > 5) {
double myval = Math.Round( BitConverter.ToDouble(m, 3), 2 );
しかし、ここで問題が発生しています。myvalは常に非常に小さい値であり、rountでは常に0です。
質問は次のとおりです。私の間違いはどこにありますか、coutで有効な値を確認できます、10バイトを送信します、何が問題になっていますか?