delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2003/11/27/10:56:01

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Message-ID: <33105.193.194.133.3.1069948551.squirrel@arlette.freesurf.fr>
Date: Thu, 27 Nov 2003 16:55:51 +0100 (CET)
Subject: Re: pow math function pb.
From: <ycollet AT freesurf DOT fr>
To: <cygwin AT cygwin DOT com>
X-Priority: 3
In-Reply-To: <20031127150630.GO26514@cygbert.vinschen.de>
References: <20031127150630 DOT GO26514 AT cygbert DOT vinschen DOT de>
Importance: Normal
X-MSMail-Priority: Normal
MIME-Version: 1.0

------=_20031127165551_30206
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit

Hello,

Sorry, I forgot to say that I'm using the latest cygwin.
gcc version is 3.3.1.
I have tried again the little example and now it works.
But my main program which ends by these two lines.
I have cleaned my program and I attach it to this mail.

Your sincerely,

Yann COLLETTE
> On Thu, Nov 27, 2003 at 03:39:51PM +0100, ycollet AT freesurf DOT fr wrote:
>> Hello,
>>
>> I've tried this program under cygwin:
>>
>> #include <math.h>
>>
>> int main()
>> {
>>   printf("%lf\n", pow(2,8));
>>   return 0;
>> }
>>
>> This program returns 8 instead of 256.
>> I've tried pow(2.0,8), pow(2.0, 8.0), etc ... Seems to me that I've
>> found a bug ?
>
> Works for me with Cygwin 1.5.5 and recent developer snapshots.  You
> didn't tell anything about the version you're using.
>
> Corinna
>
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin
> to Cygwin Developer
> mailto:cygwin AT cygwin DOT com Red Hat, Inc.
>
> --
> Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
> Problem reports:       http://cygwin.com/problems.html
> Documentation:         http://cygwin.com/docs.html
> FAQ:                   http://cygwin.com/faq/



------=_20031127165551_30206
Content-Type: text/plain; name="ess.c"
Content-Disposition: attachment; filename="ess.c"

#define N 8

#define POW(A,B) (exp((double)(B)*log((double)(A))))

int main()
{
  int i, j, Value, res;
  int * Code;

  Code = (int *)malloc(N*sizeof(int));

  for(i=0; i<POW(2,N)+1; i++)
    {
      res = i;
      /* conversion int -> binaire */
      for(j=0; j<N; j++)
	{
	  if (POW(2,j)<=res)
	    {
	      res -= POW(2,j);
	      Code[j] = 1;
	    } /* End If */
	  else
	    {
	      Code[j] = 0;
	    } /* End Else */
	} /* End For j */
      printf("%d %f\n", i, 1.2);
    } /* End For i */

  free(Code);

  printf("\n\n%f\n", pow(2.0,8.0));

  return 0;
}


------=_20031127165551_30206
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
------=_20031127165551_30206--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019