#include <stdio.h>
#include <stdint.h>
#include <string.h>

#define LONG_DBL_BYTES (80 / 8)

static void dump(void *data, size_t length)
{
    for (size_t i = 0; i < length; i++) {
        printf("%.2x ", ((uint8_t *) data)[i]);
    }
    putchar('\n');
}

int main(void) {
    long double number = 1.0;
    
    printf("sizeof(long double) = %zu (%zu padding bytes)\n",
        sizeof(long double), sizeof(long double) - LONG_DBL_BYTES);
    
    printf("Unmodified representation of %Lf:\n", number);
    dump(&number, sizeof(number));
    
    // Patch unused (padding) bytes.
    memset(((uint8_t *) &number) + LONG_DBL_BYTES, 0xaa,
        sizeof(long double) - LONG_DBL_BYTES);
    
    printf("After patching unused (padding) bytes of %Lf with 0xaa:\n",
        number);
    dump(&number, sizeof(number));

    number += 2.0;
    
    printf("Unused bytes are not touched when doing math on %Lf:\n",
        number);
    dump(&number, sizeof(number));
}
