At 01:38 PM 9/8/2001 -0400, Bryan C. Warnock wrote:
>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.

Fair enough. Those are all going into the transcendental section, I think. 
(Though my very vague memories of trig makes me think they're not, strictly 
speaking, transcendental functions)

>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....

Basic. No polynomial expansions under the hood means basic. :) I added mod, 
I forgot the rest.

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

Well, it looks like perl's angling to make things easier for the math 
folks, so it makes sense to have these as single opcodes. (If anyone can 
think of things that'd help out the bioperl people, let me know--we can add 
a set of "bioperl ops" )

I'm beginning to think that Uri's right, and the transcendental bits should 
be in a separate module. No need to yank in the math libraries ('specially 
the system math libraries) if you're just doing text processing.

Of course, that means I need to define the ops to load in op modules...

                                        Dan

--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to