*BSD News Article 20608


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!munnari.oz.au!news.Hawaii.Edu!ames!agate!howland.reston.ans.net!sol.ctr.columbia.edu!news.kei.com!yeshua.marcam.com!zip.eecs.umich.edu!destroyer!mudos.pc.cc.cmu.edu!mudos.pc.cc.cmu.edu!not-for-mail
From: mju@mudos.pc.cc.cmu.edu (Marc Unangst)
Newsgroups: comp.os.386bsd.bugs
Subject: Serious bug in NetBSD 0.9 floating-point emulator
Date: 8 Sep 1993 01:42:00 -0400
Organization: The Programmers' Pit Stop, Ann Arbor MI
Lines: 18
Message-ID: <26jrb8$89i@mudos.pc.cc.cmu.edu>
NNTP-Posting-Host: localhost.pc.cc.cmu.edu

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 SVR4 machine (486DX hardware floating-point), it prints the
correct answer ("sqrt(2) = 1.414214").  What's going on here?

-- 
Marc Unangst, N8VRH         | "Free software is NOT the same thing as
mju@mudos.pc.cc.cmu.edu     |  free beer."
                            |     -Philip Knapp in comp.os.linux