delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1998/04/10/09:42:08

From: Bob_McGowan AT xstor DOT com (Bob McGowan)
Subject: RE: cygwin and pow()
10 Apr 1998 09:42:08 -0700 :
Message-ID: <8B40B8756FA1D111BCB900A02495E24F015503.cygnus.gnu-win32@neptune.xstor.com>
Mime-Version: 1.0
To: Axel Riese <Axel DOT Riese AT risc DOT uni-linz DOT ac DOT at>
Cc: gnu-win32 AT cygnus DOT com

Axel,

Add an inlcude for math.h to your source file and compile with:

	gcc whatever.c -lm

to get the math library routines.  With gcc ver 2.7.2.3 on a Solaris
system, your program fails to link due to unresolved externals.  I have
no idea where "pow()" is comming from when the -lm is NOT used, but this
works for me, using Cygnus B19.1.

When I tried the same with mingw32 it gave me an error from ld about not
finding -lm.  So I removed the -lm, it compiled and ran correctly.

So I went back to Cygnus B19.1 and recompiled without the -lm.  It
compiled and ran correctly.

So I think all you need to do is have the #include for math.h in your
source file.

----
Bob McGowan
i'm bobmcgow at xstor dot com
Storage Dimensions, Inc.

-----Original Message-----
From: Axel Riese [mailto:Axel DOT Riese AT risc DOT uni-linz DOT ac DOT at]
Sent: Monday, March 30, 1998 10:55 PM
To: gnu-win32 AT cygnus DOT com
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 DOT Riese AT risc DOT uni-linz DOT ac DOT 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 AT cygnus DOT com" with one line of text: "help".
-
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