[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-devel
Subject: [OFFTOPIC] std::numeric_limits<double>::min() question.
From: Dmitry Suzdalev <dimsuz () gmail ! com>
Date: 2006-04-26 20:03:13
Message-ID: 200604270003.13980.dimsuz () gmail ! com
[Download RAW message or body]
Hello!
Please, sorry for offtopic, I write here in hope that this question will be
quickly answered as it seems to be simple (and I lack some knowledge).
I have a C++ code like this:
double d = 0;
double maxd = std::numeric_limits<double>::min();
....
while(...)
{
d = ....;
if( d > maxd)
{
maxd = d;
.....
}
}
I.e., i want 'if' to _always_ evaluate to true on _first_ iteration.
But it doesn't work!
Gdb shows me that after initialisation 'maxd' is a _positive_ (and of course
huge) value!
Isn't it meant to be negative (despite of how it's internally stored in
"internals")? :)
Note, that if I change the second line to
double maxd = - std::numeric_limits<double>::max();
then all works as I expect!
But I'd rather do without such tricks and write the code that's straitforward
and less messy ;).
What am I getting wrong?
Thanks in advance! :)
Dmitry.
>> Visit http://mail.kde.org/mailman/listinfo/kde-devel#unsub to unsubscribe <<
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic