[Kstars-devel] branches/KDE/3.5/kdeedu/kstars/kstars
Heiko Evermann
heiko.evermann at gmx.de
Fri Aug 5 21:26:16 CEST 2005
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
More information about the Kstars-devel
mailing list