1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Rep Power

    Setting a variable to infinity

    How do i set a variable to minus infinity?
  2. #2
  3. Contributed User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jun 2005
    Rep Power
    For some machines, these constants may equate to floating point infinity.
    Originally Posted by c99_Draft
    3 The macro HUGE_VAL
    expands to a positive double constant expression, not necessarily representable as a float. The macros
    are respectively float and long double analogs of HUGE_VAL.179)

    4 The macro INFINITY
    expands to a constant expression of type float representing positive or unsigned
    infinity, if available; else to a positive constant of type float that overflows at
    translation time.180)

    179) HUGE_VAL, HUGE_VALF, and HUGE_VALL can be positive infinities in an implementation that supports infinities.
    But if your data type is an int, there is no such thing as infinity.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper

IMN logo majestic logo threadwatch logo seochat tools logo