delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/04/08/21:28:39

From: mb38421 AT bamse DOT swip DOT net (Sune Falck)
Subject: Re: cygwin and pow()
8 Apr 1998 21:28:39 -0700 :
Message-ID: <199804071844.UAA19497.cygnus.gnu-win32@mb05.swip.net>
References: <199803310655 DOT AA27868 AT jade DOT risc DOT uni-linz DOT ac DOT at>
Reply-To: Sune DOT Fack AT swipnet DOT se
Mime-Version: 1.0
To: gnu-win32 AT cygnus DOT com (GNU-Win32),
"Axel Riese" <Axel DOT Riese AT risc DOT uni-linz DOT ac DOT at>

On 31 Mar 98 at 8:55, Axel Riese wrote:

> 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...
> 

You must include math.h to get the prototype for the
pow function. If you dont include math.h the compiler
believes that the function returns an int that then
gets converted to a double with dubious value.

#include <stdlib.h>
#include <math.h>

int main(int argc, char **argv)
{
   double result;
   result = pow (0.5, 0.75);
   printf ("The result is %f\n", result);
   return EXIT_SUCCESS;
}

C:\users\default>gcc -o pow.exe pow.c

C:\users\default>pow
The result is 0.594604


	Sune Falck

> 
--
Sune Falck <Sune DOT Falck AT swipnet DOT se>
Stavshaellsvaegen 5, S-146 54 Tullinge, Sweden
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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