Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uwm.edu!ogicse!ucsd!hub.ucsb.edu!ucsbuxa!6600m00n From: 6600m00n@ucsbuxa.ucsb.edu (Steelworker) Newsgroups: comp.sys.intel Subject: Re: 80387 computation (how to question) Message-ID: <12121@hub.ucsb.edu> Date: 19 Jun 91 18:56:41 GMT References: <1991Jun19.023041.25008@metro.ucc.su.OZ.AU> Sender: news@hub.ucsb.edu Lines: 24 In article <1991Jun19.023041.25008@metro.ucc.su.OZ.AU> glenn@suphys.physics.su.OZ.AU (Glenn Geers) writes: ] I've written most of the UNIX math library routines in 386/387 assembler ]in order to get more bang for my buck. However, there is one that has eluded me ]so far (at least efficiently) and thats exp(x)-1. The 387 has an instruction ]for doing 2^x - 1 but I can't see a neat way of scaling the result or ]prescaling ]the input. Anyone know how? ]Thanks in adavnce, ] Glenn One way is to compute 2^( x * log e) -1 , where the log is in base two. That involves only a bit more work. ( precalculating log e of course). one line proof: ln(2^(x * log e)) = x * log e * ln 2 = x Have fun with the math, Rob Blair 6600m00n@ucsbuxa.ucsb.edu ( One other task you might want to do is to make a library that takes high precision 80 bit reals, for that extra accuracy.)