[metapost] logarithmic?

Taco Hoekwater taco at elvenkind.com
Fri Feb 15 12:48:06 CET 2008


Martin Kaffanke wrote:
> Hi there,
> 
> As I can see we have a ** operator for exponential use, and mlog for
> 256*ln(x), but do we have a simple log function?

No, but it is eay to define one:

   vardef log  primary x =
     (if x=0: 0 else: mlog(x)/mlog(10) fi)
   enddef ;

It is not there as a primitive mostly because the precision is
pretty bad. It is better to use mlog and mexp instead.

Best wishes,
Taco


More information about the metapost mailing list