Skip to content

Instantly share code, notes, and snippets.

@DocBohn
Last active June 18, 2024 13:33
Show Gist options
  • Select an option

  • Save DocBohn/aaa9b5318cd50babe007b5ca327cef77 to your computer and use it in GitHub Desktop.

Select an option

Save DocBohn/aaa9b5318cd50babe007b5ca327cef77 to your computer and use it in GitHub Desktop.
Demonstration of IEEE 754's decimal floating point type.
#include <stdio.h>
#include <unistd.h>
#define MS_PER_uS 1000
void terminating_loop(void) {
_Decimal32 x;
int duration = 100 * MS_PER_uS;
for (x = 0.0df; x != 10.0df; x += 0.1df) {
printf("x = %Ha\n", x);
usleep(duration);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment