Real constants and functions: Difference between revisions

Content added Content deleted
m (→‎{{header|TCl}}: fixed spelling)
Line 46: Line 46:


And assorted trig functions: ''sin(x)'', ''arcsin(x)'', ''cos(x)'', ''arccos(x)'', ''tan(x)'', ''arctan(x)'', ''arctan2(x,y)'', ''sinh(x)'', ''arcsinh(x)'', ''cosh(x)'', ''arccosh(x)'', ''tanh(x)'' AND ''arctanh(x)''.
And assorted trig functions: ''sin(x)'', ''arcsin(x)'', ''cos(x)'', ''arccos(x)'', ''tan(x)'', ''arctan(x)'', ''arctan2(x,y)'', ''sinh(x)'', ''arcsinh(x)'', ''cosh(x)'', ''arccosh(x)'', ''tanh(x)'' AND ''arctanh(x)''.

=={{header|AWK}}==
The following scriptlets demonstrate some of the required items. ''abs()'' was trivially implemented. Missing are:
* Pi
* ''floor(), ceil()'' -- could be easily implemented as well
The ''pow()'' example is from [[Exponentiation operator]].
<lang>$ awk 'func abs(x){return(x<0?-x:x)}BEGIN{print exp(1),sqrt(2),log(2),abs(-42)}'
2.71828 1.41421 0.693147 42

$ awk 'func pow(x,n){r=1;for(i=0;i<n;i++)r=r*x;return r}{print pow($1,$2)}'
2.5 2
6.25</lang>


=={{header|BASIC}}==
=={{header|BASIC}}==