Jump to content

Real constants and functions: Difference between revisions

added c
(added perl and python)
(added c)
Line 20:
x ^ y 'power
'floor, ceiling, e, and pi not available</qbasic>
 
=={{header|C}}==
Most of the following functions take a double; for each of them there are corresponding ones with "f" or "l" appended to the name that take a float or long double, respectively.
<c>#include <math.h>
 
M_E; /* e - not standard but offered by most implementations */
M_PI; /* pi - not standard but offered by most implementations */
sqrt(x); /* square root--cube root also available in C99 (cbrt) */
log(x); /* natural logarithm--log base 10 also available (log10) */
exp(x); /* exponential */
abs(x); /* absolute value (for integers) */
fabs(x); /* absolute value (for doubles) */
floor(x); /* floor */
ceil(x); /* ceiling */
pow(x,y); /* power */</c>
 
=={{header|Java}}==
Anonymous user
Cookies help us deliver our services. By using our services, you agree to our use of cookies.