How would you set a variable to equal infinity (or any guaranteed largest number value) in C?
Normally this is done by 1.0/0.0
, but you may get a compile warning on that. I am not aware of other portable ways of doing it in C89, but C99 has macro FP_INFINITE
in math.h
.
EDIT: Apparently Sam didn't actually want infinity, but integer limits, which can be found in limits.h
like others have stated.