develooper Front page | perl.perl6.language | Postings from September 2001

Re: Math functions? (Particularly transcendental ones)

Thread Previous | Thread Next
From:
Bryan C . Warnock
Date:
September 8, 2001 10:43
Subject:
Re: Math functions? (Particularly transcendental ones)
Message ID:
01090813385412.32512@wakko.idiocity.nut
On Saturday 08 September 2001 12:00 pm, Dan Sugalski wrote:
> Okay, I'm whipping together the "fancy math" section of the interpreter
> assembly language. I've got:
>
> sin, cos, tan		: Plain ones
> asin, acos, atan	: arc-whatevers
> shinh, cosh, tanh	: Hyperbolic whatevers
> log2, log10, log	: Base 2, base 10, and explicit base logarithms
> pow			: Raise x to the y power
>
> Can anyone think of things I've forgotten? It's been a while since I've
> done numeric work.
>

1/x is often handy, although maybe not enough to justify its own opcode.  
(It is often used in other calculations, however, so perhaps one opcode 
would be better than 3.)

sqrt has traditionally been provided in languages, although it (and all 
other roots) could simply be an power (inverse x). 

atan2 is also often traditionally provided in a language, since it 
identifies the proper quadrant.

Others would include abs, floor, ceil, round, mod - don't know if those are 
basic or "fancy" to you.  I suspect you may have those already....

The question arises what do you do as its opcode, and what languages 
features can be a series of opcodes.


-- 
Bryan C. Warnock
bwarnock@gtemail.net

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About