Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!rpi!batcomputer!munnari.oz.au!metro!news From: glenn@suphys.physics.su.OZ.AU (Glenn Geers) Newsgroups: comp.unix.sysv386 Subject: 386 math library - bug fix Message-ID: <1990Nov18.215521.10762@metro.ucc.su.OZ.AU> Date: 18 Nov 90 21:55:21 GMT Reply-To: glenn@suphys.physics.su.OZ.AU (Glenn Geers) Organization: School of Physics, Uni of Sydney, Australia. Lines: 75 Nntp-Posting-Host: suphys.physics.su.oz.au Well there was bound to be at least one... Priority: Urgent Symptoms: acos crashes with a zero argument and returns incorrect results for arguments less than 0. Fix: Replace the previous version with the one below ---------------------------CUT HERE------------------------------------------- /* ** This file is part of the alternative 80386 math library and is ** covered by the GNU General Public license. */ .align 4 .Lhalfpi: .double 1.57079632679489661923 .align 4 .globl acos acos: pushl %ebp movl %esp,%ebp fldl 8(%ebp) ftst fstsw %ax sahf jz .Lzero fst %st(1) fst %st(2) fmulp fld1 fsubp fsqrt fdivp fld1 fpatan jnc .Ldone /* carry set if result of test (above) was -ve */ fldpi faddp jmp .Ldone .Lzero: fldl .Lhalfpi .Ldone: leave ret ---------------------------CUT HERE------------------------------------------- Further Comments ---------------- I have coded copysign, cosh, sinh and tanh in assembler. The inverse hyperbolics will be done soon. Question -------- The standard math library returns HUGE (about 1e38) when any of the functions go over range. Cosh and sinh in particular, do not give any warning when this happens. My versions give `Floating point exceptions' and crash. Which is the better behaviour? Cheers, Glenn -- Glenn Geers | "So when it's over, we're back to people. Department of Theoretical Physics | Just to prove that human touch can have The University of Sydney | no equal." Sydney NSW 2006 Australia | - Basia Trzetrzelewska, 'Prime Time TV'