With GCC you can also use the GCC built-ins:
This will also generate a warning if the current architecture or compiler options do not support 'infinity'.
static const double negative_infinityd = -__builtin_inf();
static const float negative_infinityf = -__builtin_inff();
If you need a fallback, you can use -HUGE_VAL (for doubles) or -HUGE_VALF (for floats) defined in math.h for the smallest possible finite negative value instead. If using GCC, you can also fetch them using the built-ins
For portable code (and when writing highly optimized timing-sensitive code, telling the compiler to relax the IEEE floating-point rules), you can use -HUGE_VAL and HUGE_VAL as sentinels, as long as you make sure all data is within the range (-HUGE_VAL < data && data < HUGE_VAL), when reading or generating the values. That way you also know all your data is finite.
#define HUGE_VAL __builtin_huge_val()
#define HUGE_VALF __builtin_huge_valf()