From owner-freebsd-hackers Mon Mar 24 06:31:19 1997 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.5/8.8.5) id GAA10235 for hackers-outgoing; Mon, 24 Mar 1997 06:31:19 -0800 (PST) Received: from quackerjack.cc.vt.edu ([198.82.160.250]) by freefall.freebsd.org (8.8.5/8.8.5) with ESMTP id GAA10230 for ; Mon, 24 Mar 1997 06:31:16 -0800 (PST) Received: from sable.cc.vt.edu (sable.cc.vt.edu [128.173.16.30]) by quackerjack.cc.vt.edu (8.8.4/8.8.4) with ESMTP id JAA14838; Mon, 24 Mar 1997 09:31:15 -0500 (EST) Received: from jandrese.async.vt.edu (jandrese.async.vt.edu [128.173.20.208]) by sable.cc.vt.edu (8.8.5/8.8.5) with SMTP id JAA27177; Mon, 24 Mar 1997 09:31:13 -0500 (EST) Date: Mon, 24 Mar 1997 09:31:33 -0500 (EST) From: Jason Andresen X-Sender: jandrese@jandrese.async.vt.edu To: Obi Wan Oblivion cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Problems with math.h In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-hackers@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk On Mon, 24 Mar 1997, Obi Wan Oblivion wrote: =)To Whom It May Concern: =) =)I am running 2.1.5 and cannot seem to get "sqrt" or "sqrtf" to work. A =)good example would be: =) =)#include =)#include =) =)main() { =) =) unsigned long int number,result; =) =) number = 64; =) =) result = (unsigned long int)sqrt((double)number); =) =) printf("The square root of %d is %d\n", number, result); =) =) return(0); =) =)} =) =)I build this with "cc -g -o" and get an "Undfined symbol _sqrt". Are =)these math functions not in the standard library, or am I doing something =)really bone-headed? Also, is typecasting appropriate in this case or =)will lint shut up and let me do the conversion? =) Ahh, you didn't include the math library. Try: cc -g -o sqrt sqrt.c -lm :::::::::::::::::::::::::::. . . . . ..:::::::::::::::::::::::::::: :: Jason Andresen :. . . . . . . . . : Web and FTP server at :: :: jandrese@vt.edu :.:.:.:.:.:.:.:.:.:: jandrese.async.vt.edu :: :.........................: Quote of the day :..........................: Nothing is more admirable than the fortitude with which millionaires tolerate the disadvantages of their wealth. -- Nero Wolfe :::::::::::.:.:.:.:.:.:.:.........................:.:.:.:.:.:.:.:::::::::::