Hi Kriangkrai,

> > Also, floating point calculations are better done separately (there are C 
> > functions for that)
> 
> Do you mean using FFI, i.e. calling C functions from Lisp? If so, how?
> Could you give me an example for calling C's "double sin(double x)" in
> <math.h>.

Please take a look in "src/ext.c". There is, for example, 'ext:Sin',
that interfaces to scaled integers:

   : (ext:Sin 314159 100000)
   -> 0
   : (ext:Cos 314159 100000)
   -> -100000


If you set '*Scl', you can make it a little more readable:

   : (setq *Scl 5)
   -> 5

   : (ext:Cos 3.14159 1.0)
   -> -100000
   : (ext:Sin 0.5 1.0)
   -> 47943

   : (format (ext:Cos 3.14159 1.0) *Scl)
   -> "-1.00000"
   : (format (ext:Sin 0.5 1.0) *Scl)
   -> "0.47943"

Cheers,
- Alex
-- 
UNSUBSCRIBE: mailto:picol...@software-lab.de?subject=unsubscribe

Reply via email to