cygwin and pow()

Wei Ku wku1@utk.edu
Fri Apr 10 04:23:00 GMT 1998


Add these two line at the beginning of the file will do the trick.

#include <math.h>
#include <stdio.h>

It is not a good idea to assume that the compiler knows the prototype of the
functions you have in mind even though the function may be built-in.

For some reason, gcc does not complain about it ( a bug ? ). If one tries to
compiles it with g++, the following message clearly shows where the problem
is:

power.c: In function `int main()':
power.c:5: warning: implicit declaration of function `int pow(...)'
power.c:6: warning: implicit declaration of function `int printf(...)'


Wei Ku

-----Original Message-----
From: Axel Riese <Axel.Riese@risc.uni-linz.ac.at>
To: GNU-Win32 <gnu-win32@cygnus.com>
Date: Tuesday, April 07, 1998 2:36 PM
Subject: cygwin and pow()


>Dear all !
>
>Could someone please help me with the following problem. I want to compute
>0.5 ^ 0.75, which should give something close to 0.5946...
>
>/*********************************************************************/
>/*                           test.c                                  */
>/*********************************************************************/
>
>int main()
>{
>  double result;
>
>  result = pow(0.5, 0.75);
>  printf("The result is: %f\n", result);
>
>  return 0;
>}
>
>/*********************************************************************/
>
>
>With Cygnus B19.1, I obtain the following:
>
>> test
>The result is: 16416.000000
>
>
>Mingw32 gives:
>
>> test
>The result is: 32.000000
>
>
>Am I doing something wrong ???????????????????
>
>- Axel
>
>===========================================================================
>Axel Riese
>Research Institute for Symbolic Computation
>J. Kepler University Linz
>Altenbergerstrasse 69                           Phone: +43 (0)732 2468 9981
>A-4040 Linz                          e-Mail: Axel.Riese@risc.uni-linz.ac.at
>Austria             URL: http://www.risc.uni-linz.ac.at/people/ariese/home/
>===========================================================================
>-
>For help on using this list (especially unsubscribing), send a message to
>"gnu-win32-request@cygnus.com" with one line of text: "help".
>

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".



More information about the Cygwin mailing list