delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1994/01/10/07:15:20

Date: Mon, 10 Jan 94 11:18 GMT
From: mjo AT mrao DOT cam DOT ac DOT uk (Martin Oldfield)
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Subject: tanh

I've found a problem with the tanh function in djgpp 1.11. As x gets
bigger, tanh(x) should approach 1.0. e.g. running a trivial program on
a Sun yields:

tanh(2.71828) =     0.991329
tanh(7.38906) =     0.999999
tanh(20.0855) =            1
tanh(54.5982) =            1
tanh(148.413) =            1
tanh(403.429) =            1
tanh(1096.63) =            1
tanh(2980.96) =            1
tanh(8103.08) =            1
tanh(22026.5) =            1

Running the same problem on djgpp generates a fp exception as it
calculates the last line. 

I have two questions:

1) Where should I look for a fix or the source of the tanh function.

2) Under what circumstances will a fp exception be generated ? Are
   there any options which control the severity of such an event ?
   i.e. can I make it non-fatal ?

Thanks in advance,
M.

- Raw text -


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