Pages: 1 [2]   Go Down
Author Topic: Serial.write a float value  (Read 5316 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
Karma: 0
Posts: 246
Code Monkey
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Unions a so cool! Basically the 'byte binary[4]' and 'float floatingPoint' are joined and share the same memory space, so you can access either, and if you change one, you change the other. You can have so much fun changing the byte array, and seeing what its floating point equivalent is smiley-grin

I've done something similar in COBOL, if you can believe it. You can reinterpret all or parts of a display value (backed by any number of binary formats) to do all sorts of unnatural things with it.

I yield() for co-routines.

Pages: 1 [2]   Go Up
Jump to: