*BSD News Article 20603


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!spool.mu.edu!howland.reston.ans.net!vixen.cso.uiuc.edu!newsrelay.iastate.edu!news.iastate.edu!ponderous.cc.iastate.edu!michaelv
From: michaelv@iastate.edu (Michael L. VanLoon)
Subject: Re: Serious bug in NetBSD 0.9 floating-point emulator
Message-ID: <michaelv.747505404@ponderous.cc.iastate.edu>
Sender: news@news.iastate.edu (USENET News System)
Organization: Iowa State University, Ames IA
References: <26jrb8$89i@mudos.pc.cc.cmu.edu> <1993Sep8.131632.14169@news.weeg.uiowa.edu>
Date: Wed, 8 Sep 1993 16:23:24 GMT
Lines: 30

In <1993Sep8.131632.14169@news.weeg.uiowa.edu> jboggs@umaxc.weeg.uiowa.edu (John D. Boggs) writes:

>From article <26jrb8$89i@mudos.pc.cc.cmu.edu>, by mju@mudos.pc.cc.cmu.edu (Marc Unangst):
>> The following program produces incorrect output on my NetBSD 0.9
>> machine using floating-point emulation:
>> 
>> #include <stdio.h>
>> #include <math.h>
>> 
>> main() {
>> 	printf("sqrt(2) = %lf\n", sqrt(2));
>> }
>> 
>> On NetBSD 0.9 with the MATH_EMULATE option, it prints "sqrt(2) = 2".

>On *my* machine it prints

> "/var/tmp/cc0001971.o: Undefined symbol _sqrt referenced from text segment"

>Go figure.

You forgot to link in the math libraries:

	cc -o program program.c -lm

-- 
------------------------------------------------------------------------------
  Michael L. VanLoon                           Project Vincent Systems Staff
  michaelv@iastate.edu              Iowa State University Computation Center
------------------------------------------------------------------------------