transcendental functions in Gofer 
Author Message
 transcendental functions in Gofer

hi!

has anyone implemented any functions in Gofer to do any of the following on Floats:

sqrt exp log sin atan erf

the sqrt is easy, but the limited support for Floats in Gofer means that the others
are hard to do adequately.

btw, i don't mind if you've use `primitive' to define them in the interpreter itself.
even if you don't have code, hints would be good. i don't have problems with the
numerical analysis, but the absence of functions to return the exponent and mantissa
of a Float is a real problem. (perhaps Mark Jones might consider defining such
functions a la Haskell in the next release?)

many thanks!

        bert.



Sun, 12 Feb 1995 16:07:04 GMT  
 transcendental functions in Gofer

Quote:

>has anyone implemented any functions in Gofer to do any of the following
>on Floats:

>sqrt exp log sin atan erf

>btw, i don't mind if you've use `primitive' to define them in the interpreter
>itself.

Wed Aug 26 23:24:55 EST 1992

I haven't done these ones myself, but it is VERY easy to add new primitives.

Just add lines like
        primitive "primitiveExpFloat" exp :: Float -> Float
to the prelude, add functions like

/* one-argument example */
primFun(primExpFloat) {        /* Float exp primitive      */
    eval(primArg(1));
    updateRoot(mkFloat(sin(whnfFloat)));
                       ^^^ substitute as appropriate

Quote:
}

/* two-argument example */
primFun(primAtan2Float) {             /* Float atan2 primitive     */
    Float x;
    eval(primArg(2));
    x = whnfFloat;
    eval(primArg(1));
    updateRoot(mkFloat(atan2(x,whnfFloat)());
                       ^^^^^ substitute as appropriate

Quote:
}

to "builtin.c", add these functions to the table of builtin functions
in builtin.c, and then just run "make".

P.S. If you have any trouble, I'd be happy to give you a hand.

--

This .signature virus is a self-referential statement that is true - but
you will only be able to consistently believe it if you copy it to your own
.signature file!



Sun, 12 Feb 1995 21:33:53 GMT  
 transcendental functions in Gofer

Quote:

>has anyone implemented any functions in Gofer to do any of the following on Floats:

>sqrt exp log sin atan erf
>many thanks!

>    bert.

I have implemented some of these functions.
I have tested on a sun4.
I started with Gofer version 2.23 and created version 2.23.1 with
modifications to the following files:

.     builtin.c
      added primitive functions and appropriate definitions and table entries
      called a mymath.h to define maths functions

.     main.c
      changed version number

.     Makefile
      to include the maths library

The prelude has also beed appended with the appropriate definitions.
Supported extras are:

.     sin
      cos
      tan
      asn
      acs
      atn

.     erf
      erfc

.     exp
      log

.     sqrt
      cbrt

These functions seem to work, but no proper testing has been
carried out.

Ahh... where do we get it from.....

Using anonymous ftp from ftp.dcs.glasgow.ac.uk
the file
  pub/haskell/gofer/msmith/gofer2.23.1/src.tar.Z
has the new source

If you don't already have the vanilla source for 2.23, it is in
  pub/haskell/gofer/msmith/gofer2.23/src.tar.Z

(For those at Glasgow dcs, the files are in
    ~msmith/pub/gofer2.23/src and ~msmith/pub/gofer2.23.1
)

--Matthew Smith



Fri, 24 Feb 1995 06:00:59 GMT  
 transcendental functions in Gofer

I am looking for papers/documentations/article on (Backus) FP.
I am interested in  a manual of (Backus) FP.
Who can send me a FTP- adress, where I can find a FP system for  Unix or MSDOS.

Thanks

 Michael Prasse



Fri, 28 Jul 1995 19:58:52 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. DSP and Transcendental Functions

2. Out of curiosity: evaluating transcendental functions

3. Need Common Lisp-compatible transcendental functions

4. gofer functions 'n stuff

5. Gofer "atom" function

6. Overloading function application in Gofer

7. VC++ calling fortran function and fortran function calling a c++ function

8. Calling functions from functions from functions ...

9. Numericall Software in Gofer/Haskell/SML

10. Upperbound for typevariables in PC-gofer 2.28?

11. translating gofer into lambda expressions

12. newbie need help on gofer

 

 
Powered by phpBB® Forum Software