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

List:       kstars-devel
Subject:    Re: [Kstars-devel] branches/KDE/3.5/kdeedu/kstars/kstars
From:       Heiko Evermann <heiko.evermann () gmx ! de>
Date:       2005-08-05 19:26:16
Message-ID: 200508052126.16845.heiko.evermann () gmx ! de
[Download RAW message or body]

Hi Jason,
>   double d = 10.000000000;
>   int i = int(d);  // i == 9 !! >:(
>
> I tried several ways of massaging the code, but in the end, this is
> the only thing I could get to work:
>
>   double d = 10.000000000;
>   int i = int( float(d) );  // i == 10 !! :D
>
> So, it works, but maybe it's a kludge and maybe someone knows a better
> way.
Try something like round(), there should be a function like this somewhere in 
the math-library. If there is none: try int(d+0.5), in order to implement 
round.

Your way
>   int i = int( float(d) );  // i == 10 !! :D
does not solve the underlying problem. 

Kind regards,

Heiko
_______________________________________________
Kstars-devel mailing list
Kstars-devel@kde.org
https://mail.kde.org/mailman/listinfo/kstars-devel

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

Configure | About | News | Add a list | Sponsored by KoreLogic