
In the definition of 'done' in QuickCheck, there is the following definition:
percentage n m = show ((100 * n) `div` m) ++ "%"
There may be specific reasons for wanting to round downwards, but failing that, a more accurate function would be
percentage n m = show ((200 * n + m) `div` (2 * m)) ++ "%"
--Dylan Thurston

ons 2002-07-03 klockan 15.50 skrev Dylan Thurston:
In the definition of 'done' in QuickCheck, there is the following definition:
percentage n m = show ((100 * n) `div` m) ++ "%"
There may be specific reasons for wanting to round downwards, but failing that, a more accurate function would be
percentage n m = show ((200 * n + m) `div` (2 * m)) ++ "%"
I would say there are good reasons for rounding down. You don't want it to say 100% until is completely done, for instance. Regards, Martin -- Martin Norbäck d95mback@dtek.chalmers.se Kapplandsgatan 40 +46 (0)708 26 33 60 S-414 78 GÖTEBORG http://www.dtek.chalmers.se/~d95mback/ SWEDEN OpenPGP ID: 3FA8580B

On Thu, Jul 04, 2002 at 02:31:47PM +0200, Martin Norb?ck wrote:
ons 2002-07-03 klockan 15.50 skrev Dylan Thurston:
In the definition of 'done' in QuickCheck, there is the following definition:
percentage n m = show ((100 * n) `div` m) ++ "%"
There may be specific reasons for wanting to round downwards, but failing that, a more accurate function would be
percentage n m = show ((200 * n + m) `div` (2 * m)) ++ "%"
I would say there are good reasons for rounding down. You don't want it to say 100% until is completely done, for instance.
As it happens, this function is only called for the grouping of the data (like 66% trivial, 33% interesting), where I might argue that you do want rounding. Not a big deal either way. --Dylan
participants (2)
-
Dylan Thurston
-
Martin Norbäck