Go Down

Topic: Serial.write a float value (Read 6155 times) previous topic - next topic

The Clever Monkey


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 :D


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.

Go Up