Skip to content

Instantly share code, notes, and snippets.

cormacltighe / ieedouble.c
Created April 12, 2017 01:37
A c program that will decompose an IEEE-754 Double Precision Floating Point number into its constituent parts. ONLY WORKS ON LITTLE-ENDIAN SYSTEMS.
View ieedouble.c
#include <stdint.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
//NOTE: only works on little-endian systems
union dub
double real;
uint64_t whole;
uint32_t half[2];