29.11.2012 Views

MetaFun - Pragma ADE

MetaFun - Pragma ADE

MetaFun - Pragma ADE

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

212<br />

decr(x,n) decrement x by n<br />

incr(x,n) increment x by n<br />

max(a,b,..) return the maximum value in the list<br />

min(a,b,..) return the minimum value in the list<br />

The min and max funtions can be applied to numerics as well as strings.<br />

The following functions are related to strings:<br />

oct s string representation of an octal number<br />

hex s string representation of a hexadecimal number<br />

str s string representation for a suffix<br />

ASCII s ASCII value of the first character<br />

char x character of the given ASCII code<br />

decimal x decimal representation of a numeric<br />

With substring (i,j) of s you can filter the substring bounded by the given indices from the<br />

given string.<br />

In METAFUN we provide a few more functions (you can take a look in mp-tool.mp to see how they<br />

are defined. You need to be aware of very subtle rounding errors. Normally these only show up<br />

when you reverse an operation. This is a result from mapping to and from internal quantities.<br />

sqr(x) x 2<br />

log(x) log(x)<br />

ln(x) ln(x)<br />

exp(x) e x<br />

pow(x, p) x p<br />

inv(x) 1/x<br />

The following sine and cosine functions take radians instead of angles in degrees.<br />

sin(x) asin(x) invsin(x)<br />

cos(x) acos(x) invcos(x)<br />

There are no tangent functions, so we provide both the radian and degrees versions:<br />

tan(x) tand(x)<br />

cot(x) cotd(x)<br />

Here are a couple of hyperbolic functions.<br />

sinh(x) asinh(x)<br />

cosh(x) acosh(x)<br />

We end with a few additional string converters.<br />

ddecimal x decimal representation of a pair<br />

dddecimal x decimal representation of a color<br />

condition x string representation of a boolean<br />

Functions Overview

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!