Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 6/24/83 (MC840302); site mcvax.UUCP Path: utzoo!linus!philabs!cmcl2!seismo!mcvax!guido From: guido@mcvax.UUCP (Guido van Rossum) Newsgroups: net.lang.c Subject: Re: C language hacking Message-ID: <6171@mcvax.UUCP> Date: Mon, 12-Nov-84 08:17:51 EST Article-I.D.: mcvax.6171 Posted: Mon Nov 12 08:17:51 1984 Date-Received: Tue, 13-Nov-84 01:30:55 EST References: <5715@brl-tgr.ARPA> Reply-To: guido@mcvax.UUCP (Guido van Rossum) Distribution: net Organization: "Stamp Out BASIC" Committee, CWI, Amsterdam Lines: 31 Summary: >It would also be nice if sin( x ) and cos( x ) could be computed >simultaneously with reduced cost. I doubt if this is possible >but would like to know if it is. Can't you use (sin x)**2 + (cos x)**2 = 1 ? This suggests that abs cos x = root(1 - (sin x)**2); surely something can be said about the sign given the range x is in. This assumes computing a square root is faster than computing a sine. This is as close as you can g; the type polynomial approximations used for computing sine/cosine are not symmetrical around pi/4. (I doubt that they are symmetrical around any point, since their precision is only relevant between 0 and pi/2.) Anyway, I wouldn't want to add such a function to the standard library. A specialized numerical library could provide one, however. BTW, does anybody know whether the NAG library of numerical algorithms has been translated into C? This surely would make a great standard! Thesis: a language standard should not incorporate standards for numerical functions. It should only provide the raw material to allow a numerical library to be written. (I believe the ANSI Committee is well aware of this, and only defines the most basic numerical functions. If only compiler writers would provide decent implementations of these... (and of printf %e/%f/%g).) -- Guido van Rossum, "Stamp Out BASIC" Committee, CWI, Amsterdam, Holland guido@mcvax.UUCP "Life is like a sewer. What you get out of it, depends on what you put into it."