[Mingw-msys] [mingw - MSYS] RE: bash empty for-loop
- Date: Fri, 7 Sep 2007 17:38:37 -0500
- From: "Michael Chen" <vancouver.michael@xxxxxxxxx>
- Subject: Re: [Mingw-msys] pow(5,2)=24 ?????!!!!!
So I should always add 0.5 to pow() and modf() as shown, when my input
parameters and output are all integers?
double modf(double, double *);
Michael Chen
On 9/7/07, Norman Vine <nhv@xxxxxxxx> wrote:
> Michael Chen writes:
> > Sent: Friday, September 07, 2007 4:38 PM
> > To: MSYS Discussion List
> > Subject: Re: [Mingw-msys] pow(5,2)=24 ?????!!!!!
> >
> > int s = (int) pow(l,d);
> > printf("%d\t%d\t%d\n",l,d,s);
> >
> >
> > And I tried several (l,d), results are:
> > 2 2 4
> > 3 2 9
> > 4 2 16
> > 5 2 24 <= this one is wrong
> > 6 2 36
> > ....
> >
> > What shall I use then? my variable s, l, and d are integers!
>
>
> int s = (int)( pow(l,d) + 0.5);
>
> More then you will probably ever need to know
> http://docs.sun.com/source/806-3568/ncg_goldberg.html
>
> HTH
>
> Norman
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Splunk Inc.
> Still grepping through log files to find problems? Stop.
> Now Search log events and configuration files using AJAX and a browser.
> Download your FREE copy of Splunk now >> http://get.splunk.com/
> _______________________________________________
> Mingw-msys mailing list
> Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
> https://lists.sourceforge.net/lists/listinfo/mingw-msys
>
--
Michael Chen
PhD Candidate
Northwestern University
2145 Sheridan Road IEMS
Evanston, IL 60208-3119
Phone: 847.467.2043
Fax: 847.491.8005
Web: http://users.iems.northwestern.edu/~mchen/
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Mingw-msys mailing list
Mingw-msys@xxxxxxxxxxxxxxxxxxxxx
https://lists.sourceforge.net/lists/listinfo/mingw-msys