delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2009/09/14/16:19:24

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
Date: Mon, 14 Sep 2009 23:19:21 +0300
From: Eli Zaretskii <eliz AT gnu DOT org>
Subject: Re: atan2 bug
In-reply-to: <200909142122.34236.juan.guerrero@gmx.de>
X-012-Sender: halo1 AT inter DOT net DOT il
To: djgpp-workers AT delorie DOT com
Message-id: <83y6ohxos6.fsf@gnu.org>
References: <200909142122 DOT 34236 DOT juan DOT guerrero AT gmx DOT de>
Reply-To: djgpp-workers AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
> Date: Mon, 14 Sep 2009 21:22:34 +0200
> 
> The code of atan2 contains a bug.  As can be seen it is tried to check if
> the double x variable is inf by checking if the mantissa is identical zero.
> On the stack the 64 bit x variable occupies esp + 16 and esp + 12.  It makes
> no sense to check the mantissa high part at esp + 16 that corresponds to
> the x variable and the manstissa low part at esp + 4 that corresponds to
> the y variable.
> 
> |s|exp|man h|  <-- esp + 16 \
> |   man l   |  <-- esp + 12 / (64 bit ieee) double x
> |s|exp|man h|  <-- esp + 8  \
> |   man l   |  <-- esp + 4  / (64 bit ieee) double y
> 
> It seems to be a "copy and paste" error.

Do you have a test that actually trips it?  If so, how about adding it
to tests/libc/ansi/math?

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019