
--- milena/ChangeLog | 5 +++++ milena/mln/value/builtin/floatings.hh | 17 ++++++++++++++--- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/milena/ChangeLog b/milena/ChangeLog index c8c67db..8696d58 100644 --- a/milena/ChangeLog +++ b/milena/ChangeLog @@ -1,3 +1,8 @@ +2011-11-28 Guillaume Lazzara <z@lrde.epita.fr> + + * mln/value/builtin/floatings.hh: Fix invalid minimum value for + builtin floating types. (ticket #247) + 2011-11-24 Guillaume Lazzara <z@lrde.epita.fr> * mln/fun/v2v/rgb_to_hsl.hh: Fix constructor declaration. diff --git a/milena/mln/value/builtin/floatings.hh b/milena/mln/value/builtin/floatings.hh index e30e949..89e8007 100644 --- a/milena/mln/value/builtin/floatings.hh +++ b/milena/mln/value/builtin/floatings.hh @@ -1,4 +1,5 @@ -// Copyright (C) 2007, 2008, 2009 EPITA Research and Development Laboratory (LRDE) +// Copyright (C) 2007, 2008, 2009, 2011 EPITA Research and Development +// Laboratory (LRDE) // // This file is part of Olena. // @@ -75,7 +76,12 @@ namespace mln static float min() { - static const float min_ = mln::value::internal::limits<float>::min(); + // NOTE: limits<float>::min() returns the minimum positive + // value. However, in Milena, min() means the minimum value of the + // possible range value, i.e., the lowest negative + // value. Since float has a symetric range value, we can + // safely use -MAX. + static const float min_ = - mln::value::internal::limits<float>::max(); return min_; } static float max() @@ -114,7 +120,12 @@ namespace mln static double min() { - static const double min_ = mln::value::internal::limits<double>::min(); + // NOTE: limits<double>::min() returns the minimum positive + // value. However, in Milena, min() means the minimum value of + // the possible range value, i.e., the lowest negative + // value. Since double has a symetric range value, we can + // safely use -MAX. + static const double min_ = - mln::value::internal::limits<double>::max(); return min_; } static double max() -- 1.7.2.5