Skip to content

Instantly share code, notes, and snippets.

@gerdr
Last active September 27, 2015 23:27
Show Gist options
  • Save gerdr/1348574 to your computer and use it in GitHub Desktop.
Save gerdr/1348574 to your computer and use it in GitHub Desktop.
single-precision infinity in C
#include <math.h>
/* ANSI fallback, *might* fail on exotic platforms */
#ifndef INFINITY
#define INFINITY ((float)HUGE_VAL)
#endif
#ifndef NAN
#define NAN (INFINITY - INFINITY)
#endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment