@@ -1427,10 +1427,28 void floatToChar( float value, unsigned | |||||
1427 | unsigned char* valuePtr; |
|
1427 | unsigned char* valuePtr; | |
1428 |
|
1428 | |||
1429 | valuePtr = (unsigned char*) &value; |
|
1429 | valuePtr = (unsigned char*) &value; | |
|
1430 | ||||
1430 | ptr[BYTE_0] = valuePtr[BYTE_0]; |
|
1431 | ptr[BYTE_0] = valuePtr[BYTE_0]; | |
1431 | ptr[BYTE_1] = valuePtr[BYTE_1]; |
|
1432 | ptr[BYTE_1] = valuePtr[BYTE_1]; | |
1432 | ptr[BYTE_2] = valuePtr[BYTE_2]; |
|
1433 | ptr[BYTE_2] = valuePtr[BYTE_2]; | |
1433 | ptr[BYTE_3] = valuePtr[BYTE_3]; |
|
1434 | ptr[BYTE_3] = valuePtr[BYTE_3]; | |
|
1435 | ||||
|
1436 | // <TEST> | |||
|
1437 | printf("\n\n<TEST>\n"); | |||
|
1438 | ||||
|
1439 | float aux = NAN; | |||
|
1440 | unsigned char* auxPtr; | |||
|
1441 | auxPtr = (unsigned char*) &aux; | |||
|
1442 | ||||
|
1443 | printf("aux = %f, value = %f\n", aux, value); | |||
|
1444 | ||||
|
1445 | auxPtr[BYTE_0] = valuePtr[BYTE_0]; | |||
|
1446 | auxPtr[BYTE_1] = valuePtr[BYTE_1]; | |||
|
1447 | auxPtr[BYTE_2] = valuePtr[BYTE_2]; | |||
|
1448 | auxPtr[BYTE_3] = valuePtr[BYTE_3]; | |||
|
1449 | ||||
|
1450 | printf("aux = %f\n", aux); | |||
|
1451 | // </TEST> | |||
1434 | } |
|
1452 | } | |
1435 |
|
1453 | |||
1436 | //********** |
|
1454 | //********** |
General Comments 0
You need to be logged in to leave comments.
Login now