From nobody@FreeBSD.org  Sun Feb 27 20:38:23 2000
Return-Path: <nobody@FreeBSD.org>
Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21])
	by hub.freebsd.org (Postfix) with ESMTP id 250AC37B83A
	for <freebsd-gnats-submit@FreeBSD.org>; Sun, 27 Feb 2000 20:38:23 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Received: (from nobody@localhost)
	by freefall.freebsd.org (8.9.3/8.9.2) id UAA89470;
	Sun, 27 Feb 2000 20:38:22 -0800 (PST)
	(envelope-from nobody@FreeBSD.org)
Message-Id: <200002280438.UAA89470@freefall.freebsd.org>
Date: Sun, 27 Feb 2000 20:38:22 -0800 (PST)
From: nobu@rd.isac.co.jp
Sender: nobody@FreeBSD.org
To: freebsd-gnats-submit@FreeBSD.org
Subject: strtod(3) floating exception
X-Send-Pr-Version: www-1.0

>Number:         17032
>Category:       alpha
>Synopsis:       strtod(3) floating exception
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    robert
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sun Feb 27 20:40:01 PST 2000
>Closed-Date:    Sun Jul 13 12:44:49 PDT 2003
>Last-Modified:  Sun Jul 13 12:44:49 PDT 2003
>Originator:     Nobuhiro Yasutomi
>Release:        4.0-20000208-CURRENT
>Organization:
ISAC, Inc.
>Environment:
FreeBSD andy.rd.isac.co.jp 4.0-20000208-CURRENT FreeBSD 4.0-20000208-CURRENT #0: Tue Feb  8 12:09:59 GMT 2000     jkh@beast.freebsd.org:/usr/src/sys/compile/GENERIC  alpha

>Description:
strtod(3) make floating exception when smallest value convert.

>How-To-Repeat:
try following saple:

#include <stdlib.h>
main(){
   double a=strtod("2.2250738585072014e-308", NULL);
   printf("%g\n", a);
}

>Fix:


>Release-Note:
>Audit-Trail:

From: Nobuhiro Yasutomi <nobu@rd.isac.co.jp>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: alpha/17032: strtod(3) floating exception
Date: Tue, 29 Feb 2000 16:27:37 +0900

   I checked my send-pr alpha/17032 problem.
 
   The problem live in src/lib/libc/stdlib/strtod.c source code.
 The source code assume sizeof(long)==4, then bounded value make
 to be exception.
 
   Well, There is need fix to mach. Then I tried import from NetBSD
 source code and hacked that. It seem to work.
 
 Based NetBSD-current source as
     $NetBSD: strtod.c,v 1.33 1999/11/26 07:39:45 msaitoh Exp $
 
 and patched for FreeBSD are:
 --- /tmp/strtod.c	Tue Feb 29 15:49:07 2000
 +++ strtod.c	Tue Feb 29 16:11:36 2000
 @@ -108,6 +108,9 @@
  #endif
  #endif
  
 +#if defined(__FreeBSD__) && defined(__alpha__)
 +#define IEEE_LITTLE_ENDIAN
 +#endif
  #ifdef __arm32__
  /*
   * Although the CPU is little endian the FP has different
 @@ -142,8 +145,13 @@
  #include "memory.h"
  #endif
  #endif
 +#if defined(__FreeBSD__)
 +#define mutex_lock(x)
 +#define mutex_unlock(x)
 +#else
  #include "extern.h"
  #include "reentrant.h"
 +#endif
  
  #ifdef MALLOC
  #ifdef KR_headers
 @@ -283,8 +291,13 @@
  #define LSB 1
  #define Sign_bit 0x80000000
  #define Log2P 1
 +#if defined(__FreeBSD__) && defined(__alpha__)
 +#define Tiny0 0x100000
 +#define Tiny1 0
 +#else  /* !FreeBSD/alpha */
  #define Tiny0 0
  #define Tiny1 1
 +#endif /* FreeBSD/alpha */
  #define Quick_max 14
  #define Int_max 14
  #define Infinite(x) (word0(x) == 0x7ff00000) /* sufficient test for here */
 
 ---
 Nobuhiro Yasutomi  ISAC, Inc.
 http://www.isac.co.jp/
 
State-Changed-From-To: open->patched 
State-Changed-By: robert 
State-Changed-When: Sun Nov 17 08:50:40 PST 2002 
State-Changed-Why:  
A fix was committed to -CURRENT. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17032 
Responsible-Changed-From-To: freebsd-alpha->robert 
Responsible-Changed-By: kris 
Responsible-Changed-When: Sat Jul 12 16:37:45 PDT 2003 
Responsible-Changed-Why:  
Robert reported that a patch was committed 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17032 
State-Changed-From-To: patched->closed 
State-Changed-By: robert 
State-Changed-When: Sun Jul 13 12:44:07 PDT 2003 
State-Changed-Why:  
Describes the same bug as PR #12623 and #43567, 
further status updates will occur as follow-ups to 
the latter. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=17032 
>Unformatted:
