Date: Fri, 14 Sep 2012 02:41:14 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Stephen Montgomery-Smith <stephen@missouri.edu> Cc: freebsd-numerics@FreeBSD.org Subject: Re: Complex arg-trig functions Message-ID: <20120914014208.I2862@besplex.bde.org> In-Reply-To: <5051F59C.6000603@missouri.edu> References: <5017111E.6060003@missouri.edu> <501D9C36.2040207@missouri.edu> <20120805175106.X3574@besplex.bde.org> <501EC015.3000808@missouri.edu> <20120805191954.GA50379@troutmask.apl.washington.edu> <20120807205725.GA10572@server.rulingia.com> <20120809025220.N4114@besplex.bde.org> <5027F07E.9060409@missouri.edu> <20120814003614.H3692@besplex.bde.org> <50295F5C.6010800@missouri.edu> <20120814072946.S5260@besplex.bde.org> <50297CA5.5010900@missouri.edu> <50297E43.7090309@missouri.edu> <20120814201105.T934@besplex.bde.org> <502A780B.2010106@missouri.edu> <20120815223631.N1751@besplex.bde.org> <502C0CF8.8040003@missouri.edu> <20120906221028.O1542@besplex.bde.org> <5048D00B.8010401@missouri.edu> <504D3CCD.2050006@missouri.edu> <504FF726.9060001@missouri.edu> <20120912191556.F1078@besplex.bde.org> <20120912225847.J1771@besplex.bde.org> <50511B40.3070009@missouri.edu> <20120913204808.T1964@besplex.bde.org> <5051F59C.6000603@missouri.edu>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 13 Sep 2012, Stephen Montgomery-Smith wrote: > On 09/13/2012 07:55 AM, Bruce Evans wrote: > >> % - /* casinh(NaN + I*inf) = inf + I*NaN */ >> % + /* casinh(NaN + I*+-Inf) = +-Inf + I*NaN (sign optional) */ > > How much do you want the "sign optional" put into the comments. This will > have to be done in lots of places. Eventually, always, but I'd like to have a convention to keep the comment short. Possible conventions: - use inf for the simple case where signs interact unsurprisingly. inf for an input operand combined with inf for an output operand means that the input operand is copied unchanged; add '-' to the output operand to indicate a sign change. - use +-Inf particular signs and/or surprising sign rules - combinations with 2 input infinities probably need to spell them as inf1 and inf2 or +-Inf1 and +-Inf2 so as to express combinations of them in output - write options using something like opt(<option taken>) where the presense of opt() indicates that an option exists. In casinh() this gives: My previous version: /* casinh(+-Inf + I*NaN) = +-Inf + I*NaN */ /* casinh(NaN + I*+-Inf) = +-Inf + I*NaN (sign optional) */ With the above, and also with (null) NaN annotation: /* casinh(inf + I*NaN) = inf + I*NaN */ /* casinh(NaN + I*inf) = opt(inf) + I*NaN */ Here inf ... = ... opt(inf) says that: - the input infinity can be +-Inf - the ouptut infinity can by optionally either +Inf or -Inf - but we choose to make it the same inf as the input infinity. I first wrote the NaN annotation as d(NaN) but then saw that a convention works for NaNs too -- the usual case where a single NaN is replaced by the default conversion of the same NaN doesn't need special description. We try not to change the signs for NaNs, but when we change them intentionally, this needs special description. It is always an option to clobber the sign or other bits of NaNs, so the opt() markup is not needed for NaNs to document that there is an option, but it could be used to indicate that we make a choice. Bruce
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120914014208.I2862>