ftp.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/05/22/05:44:15

From: Eric Backus <ericb AT lsid DOT hp DOT com>
Subject: bug in tan()
To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp)
Date: Sun, 22 May 94 2:19:46 PDT
Mailer: Elm [revision: 70.85]

I have found a problem with tan().  When given an argument that is too
large (like 1e100), it gives a stack underflow exception.  I expected
to get back a NaN, like I do with sin() and cos().

Below is an excerpt from /djgpp/libsrc/m/src/tan.s:

	.globl	_tan
_tan:
	fldl	4(%esp)
	fptan
	fstsw
	fstp	%st(0)
	sahf
	jnp	L1
	fstp	%st(0)
	fldl	L0
L1:
	ret

Note that in the case of an exception, "fstp" is done twice.  I'm not
fluent in 80x86 assembly, but I'd guess that the second "fstp" should
be removed.  When I did this, my stack underflow went away.
--
				Eric Backus
				ericb AT lsid DOT hp DOT com
				(206) 335-2495

- Raw text -


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