Return-Path: william@bourbon.usc.edu Delivery-Date: Thu Sep 25 17:59:40 2008 X-Spam-Checker-Version: SpamAssassin 3.2.3 (2007-08-08) on merlot.usc.edu X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.3 Received: from bourbon.usc.edu (bourbon.usc.edu [128.125.9.75]) by merlot.usc.edu (8.14.1/8.14.1) with ESMTP id m8Q0xeAu020326 for ; Thu, 25 Sep 2008 17:59:40 -0700 Received: from bourbon.usc.edu (localhost.localdomain [127.0.0.1]) by bourbon.usc.edu (8.14.2/8.14.1) with ESMTP id m8Q12rNU030568 for ; Thu, 25 Sep 2008 18:02:53 -0700 Message-Id: <200809260102.m8Q12rNU030568@bourbon.usc.edu> To: cs551@merlot.usc.edu Subject: Re: Unit for std deviation Date: Thu, 25 Sep 2008 18:02:53 -0700 From: Bill Cheng Someone wrote: > Suppose I've got 1 customer dropped out of 50. (Yes, I am testing f2.txt.) > > The drop probability should be 1/50 = 0.02. > > However my printf using %.6g always prints out 0.0204082 > printf(" customer drop probability = %.6g \n", > double(gNumDropped) / double(gNumSeved)); > > where gNumDropped and gNumServed are integer. > > Do I need to fix my program? I just wrote a program with your code above and I get 0.02. I have no idea why you are getting that weird number. -- Bill Cheng // bill.cheng@usc.edu