Boost logo

Boost :

Subject: Re: [boost] [numeric_limits] min() for floating point versus integers
From: DE (satan66613_at_[hidden])
Date: 2010-05-04 10:59:08


on 04.05.2010 at 18:49
 Stewart, Robert wrote :

> DE wrote:
>> Stewart, Robert wrote :
>> > DE wrote:
>> >> Stewart, Robert wrote :
>> >> > DE wrote:
>> >> >>
>> >> >> typedef std::numeric_limits<type> traits;
>> >> >> const type realy_min = traits::is_integer ? traits::min() :
>> >> >> -traits::max();
>> >>
>> >> > That only works for unsigned types.
>> >>
>> >> it does work for bounded signed and unsigned integers, unbounded
>> >> unsigned integers and also for floating point values (with
>> >> denormalization)
>>
>> > Signed integer types use two's complement, so the absolute value of
>> > the largest positive and largest negative value differs.
>>
>> so what?
>> honestly i don't catch your point

> -traits::max() != largest negative

'-traits::max()' part is used for floating point numbers only so i
guess it does equal the largest (in magnitude) representable negative
number

-- 
Pavel
P.S.
if you notice a grammar mistake or weird phrasing in my message
please point it out

Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk