[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-devel
Subject:    Re: can not compile kpdf due to missing lrint
From:       Adriaan de Groot <adridg () cs ! kun ! nl>
Date:       2003-09-15 20:29:42
[Download RAW message or body]

Hi Nick,

Let's not forget what this thread originally was about: kpdf using lrint(). 
While your rounding routines keep getting better, like:

On Monday 15 September 2003 16:24, Nicolas Goutte wrote:
> double d;
> long int l=(long int)((d>0.0)?(d-0.5):(d+0.5));
>
> That puts -5.5 to -6. I am not sure if this is wanted or not.

the point is twofold:

1) the only portable library function for rounding a double to an int while 
respecting the current (system wide?) rounding direction is rint().

2) application authors that use rounding need to decide for themselves what 
suitable rounding is. If they happen to _know_ that all values are positive 
and need to be rounded to the nearest integer, then one of your macro 
solutions is fine as well. But what is suitable rounding depends critically 
on the application. Authors need to be aware of that as well.


-- 
pub  1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <groot@kde.org>
     Key fingerprint = 934E 31AA 80A7 723F 54F9  50ED 76AC EE01 FEA2 A3FE

 
>> 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