[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: Re: KDE/kdebase/workspace/ksysguard/ksysguardd
From: André_Wöbbeking <Woebbeking () onlinehome ! de>
Date: 2006-05-17 15:51:10
Message-ID: 200605171751.10974.Woebbeking () onlinehome ! de
[Download RAW message or body]
On Wednesday 17 May 2006 03:00, John Tapsell wrote:
> SVN commit 541696 by johnflux:
>
> It's better to do a*100/b instead of a/b *100 because the former
> introduces less rounding errors
>
>
> M +1 -2 FreeBSD/diskstat.c
> M +1 -2 Linux/diskstat.c
>
>
> ---
> trunk/KDE/kdebase/workspace/ksysguard/ksysguardd/FreeBSD/diskstat.c
> #541695:541696 @@ -147,8 +147,7 @@
> if (strcmp(fs.f_fstypename, "procfs") && strcmp(fs.f_fstypename,
> "devfs") && strcmp(fs.f_fstypename, "devfs")) { if ( fs.f_blocks != 0
> )
> {
> - percent = (((float)fs.f_blocks -
> (float)fs.f_bfree)/(float)fs.f_blocks);
> - percent = percent *
> 100;
> + percent = (((float)fs.f_blocks -
> (float)fs.f_bfree)*100.0/(float)fs.f_blocks); }
<nitpicking>
It's also better not to mix types, in this case floats and doubles. You
could use 100.0f or just
percent = ((fs.f_blocks - fs.f_bfree) *100.0) / fs.f_blocks;
</nitpicking>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic