Bug in Tanh[x] (summary and speculation)

*To*: mathgroup at yoda.ncsa.uiuc.edu*Subject*: Bug in Tanh[x] (summary and speculation)*From*: CAMERON at midd.cc.middlebury.edu*Date*: Sat, 2 Mar 91 15:18 EST

Summary: Barry Merriman (barry at math.ucla.edu) said that he had found a bug with Tanh[x] in Mma version 1.2 on the NeXT. He said that Plot[Tanh[x],{x,-3,3}] produced an incorrect plot, but defining tanh[x] := ((Exp[x] - Exp[-x])/(Exp[x] + Exp[-x]) and plotting that produced a correct one. He also said that one specific value that was computed incorrectly was Tanh[-1.8], which his setup (computer+software) computes as -1.053193987153732 but which ought to be -0.946806. He didn't say which version of the operating system he was using, nor did he say which processor ('030 or '040). Alfred Gray (gray at athena.umd.edu) reported reproducing Barry's results under NeXT OS version 2.0 with both Mma version 1.2 and beta-test version 2.0. He didn't say which processor, though. Dave Seaman (ags at seaman.cc.purdue.edu) reported that Tanh worked *correctly* with NeXT Mma version 1.2 running under OS version 1.0 (necessarily on an '030, since version 1.0 of the OS doesn't run on the '040). Now I have both Mma version 1.2 and Mma version 2.0 beta on my NeXT with OS version 2.0, and Tanh works *correctly* under both versions on my machine. Tanh[-1.8] gives the right value, and plots of Tanh[x] and tanh[x] (as defined above) both give the same (correct) graph. BUT I have an '030 NeXT (I upgraded the software but not the processor). My conclusion: If Alfred and Barry both have '040 boards in their NeXTs, then the data say that (1) version 1.2 or 2.0beta of Mma doesn't matter, and (2) version 1.0 or 2.0 of the NeXT operating system doesn't matter, but (3) '030 or '040 processor DOES matter. This leads me to accuse the NeXT '040 board as the culprit in this affair. Other data: I have no idea how Ken Yip's (yip-ken at CS.YALE.EDU) report (that plotting Tanh[x] or Sinh[x] from -3 to 3 caused his Sparc 330 running Mma 1.2 to crash) or Steve Christensen's report (that his Sun-4/110 and Sparcstation 1 both work correctly with Mma 1.2) should be weighed in drawing conclusions. --Cameron Smith Baffled Mathematica consultant cameron at midd.cc.middlebury.edu