[metapost] Built-in functions

Mojca Miklavec mojca.miklavec.lists at gmail.com
Fri Sep 29 00:54:17 CEST 2006


On 9/29/06, Dan Luecking wrote:
> On 9/28/06, Robert Jerrard wrote:
>
> >Also, is there a built-in log function of any base, can not see one
> >in any documentation?
>
> Where did you look?
>
> There is mlog, a log function with base e**(1/256) (that is, mlog x is
> 256 times the natural log of x). You can get the log for any base B
> by (mlog x)/(mlog B). The purpose of the 256 factor is in the inverse
> function: mexp x = e**(x/256). One can do pretty much anything with
> mexp that one could with exp, but with less chance of arithmetic
> overflow (e**x produces overflow with x as small as 11).

Metafun also has "ln" and "log":

input mp-tool;
beginfig(1) ;
   label(decimal log(200),origin);
endfig ;
end .

See http://www.pragma-ade.com/general/manuals/metafun-s.pdf

Mojca


More information about the metapost mailing list