NetBSD Problem Report #153

From gnats  Thu Mar  3 15:07:34 1994
Received: from idefix.laas.fr (idefix.laas.fr [140.93.160.12]) by sun-lamp.cs.berkeley.edu (8.6.5/8.6.5) with SMTP id PAA22389 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Thu, 3 Mar 1994 15:07:30 -0800
Message-Id: <9403032307.AA02021@elwood.RIA>
Date: Fri, 4 Mar 1994 00:07:35 --100
From: matthieu@laas.fr (Matthieu Herrb)
Reply-To: matthieu@laas.fr
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: hypot(3) gives incorrect results when compiled with -O
X-Send-Pr-Version: 3.2

>Number:         153
>Category:       lib
>Synopsis:       hypot(3) gives incorrect results when compiled with -O
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          duplicate
>Submitter-Id:   net
>Arrival-Date:   Thu Mar 03 15:20:04 +0000 1994
>Closed-Date:    Fri Mar 04 16:06:34 +0000 1994
>Last-Modified:  Thu Jan 02 18:11:40 +0000 2014
>Originator:     Matthieu Herrb
>Release:        current of 26/02
>Organization:
 CNRS - LAAS 
 7, avenue du Colonel Roche
 31077 Toulouse Cedex - France
>Environment:
	486DX33 16M memory
System: NetBSD cougar 0.9a COUGAR#8 i386


>Description:
	the __ieee754_hypot function returns the wrong answer in almost every 
	case when compiled with -O.
>How-To-Repeat:
The following program should print h = 1.00 for every i:
#include <stdio.h>
#include <math.h>

main()
{
    double a, s, c, h,;
    int i;

    printf("  i        a       h\n");
    for (i = 0; i <= 360; i++) {
	a = M_PI*i/180;
	s = sin(a1);
	c = cos(a1);
	h = hypot(s, c);

	printf("%3d %7.4f %7.4f\n", 
	       i, a, h);
    }
}
>Fix:
	Workaround: compile e_hypot.c without -O




>Release-Note:
>Audit-Trail:

From: "J.T. Conklin" <jtc>
To: GNATS administrator <gnats-admin>
Subject: Re: lib/153: hypot(3) gives incorrect results when compiled with -O
Date: Thu, 3 Mar 1994 18:35:18 -0800


 	`J.T. Conklin' made changes to this PR.

 --- /var/tmp/gnats024831	Thu Mar  3 18:33:53 1994
 +++ /var/tmp/gnatsa24831	Thu Mar  3 18:34:42 1994
 @@ -19,7 +19,7 @@
  >Priority:       medium
  >Responsible:    gnats-admin
  >State:          open
 ->Class:          sw-bug
 +>Class:          duplicate (145)
  >Submitter-Id:   net
  >Arrival-Date:   Thu Mar  3 15:20:04 1994
  >Originator:     Matthieu Herrb

State-Changed-From-To: open->closed
State-Changed-By: jtc
State-Changed-When: Fri Mar  4 16:06:34 1994
State-Changed-Why:
Duplicate of bug #145, which has been fixed.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.