Real constants and functions: Difference between revisions
Content added Content deleted
(added c#) |
(metafont) |
||
Line 221: | Line 221: | ||
Math.ceil(x) |
Math.ceil(x) |
||
Math.pow(x,y) |
Math.pow(x,y) |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|MAXScript}}== |
=={{header|MAXScript}}== |
||
Line 234: | Line 244: | ||
pow x y -- power |
pow x y -- power |
||
</pre> |
</pre> |
||
=={{header|Metafont}}== |
|||
<lang metafont> |
|||
show mexp(256); % outputs e; since MF uses mexp(x) = exp(x/256) |
|||
show 3.14159; % no pi constant built in; of course we can define it |
|||
% in several ways... even computing |
|||
% C/2r (which would be funny since MF handles paths, |
|||
% and a circle is a path...) |
|||
show sqrt2; % 1.41422, or in general sqrt(a) |
|||
show mexp(256*x); % see e. |
|||
show abs(x); % returns |x| (the absolute value of the number x, or |
|||
% the length of the vector x); it is the same as |
|||
% length(x); plain Metafont in fact says: |
|||
% let abs = length; |
|||
show floor(x); % floor |
|||
show ceiling(x); % ceiling |
|||
show x**y; % ** is not a built in: it is defined in the basic macros |
|||
% set for Metafont (plain Metafont) as a primarydef |
|||
</lang> |
|||
=={{header|Modula-3}}== |
=={{header|Modula-3}}== |
||
Line 249: | Line 279: | ||
Math.pow(x, y); |
Math.pow(x, y); |
||
</pre> |
</pre> |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
=={{header|OCaml}}== |
=={{header|OCaml}}== |