r/shittyprogramming • • Jun 28 '15

Embedded developer adventures

Post image
297 Upvotes

55 comments sorted by

View all comments

35

u/say_wot_again Jun 28 '15

But.... That's not what they meant when they said double! And how would you tell 1, 10, and 100 apart? I call shenanigans.

1

u/oddark Jun 28 '15

Why has no one considered that the numbers are padded on the left with zeros?

If you want to store 0xF01 and 0x42, the result would be 0xF01.0042. Just take the decimal part and multiply it by 0x10000.