Re: G_MINFLOAT definition?



On Sat, 16 Jun 2001, Erik Walthinsen wrote:

> While porting to GObject, we started to make use of the G_MIN and G_MAX
> macros as default min/max for object parameters.  For a float parameter,
> one would think that the min and max would be +- the largest absolute
> value that the type can store, just like for G_MININT and G_MAXINT.
> However, this doesn't appear to be the case.  G_MINFLOAT is defined as
> FLT_MIN on my machine, which is defined in GCC's float.h as:
>
>    /* Minimum normalised float */
> #undef FLT_MIN
> #define FLT_MIN 1.17549435e-38F
>
> I don't know what a normalized float is, but it looks a lot like epsilon
> to me (but it isn't).
>
> I checked the glib-1.2 documentation, and it simply says that G_MINFLOAT
> is "The minimum value which can be held in a gfloat.".
>
> My opinion here is that either the documentation should be changed to
> reflect that G_MINFLOAT is not quite what it sounds like, or G_MINFLOAT
> really should be -(G_MAXFLOAT).
>
> Thoughts?

The documentation should probably say that G_MINFLOAT is a float of the
smallest magnitude possible, and have a note about using using -G_MAXFLOAT
for the least float.

James.

-- 
Email: james daa com au
WWW:   http://www.daa.com.au/~james/






[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]