Mathematics & taut
MathAbs ()
MathArccos ()
MathArcsin ()
MathArctan ()
MathCeil ()
MathCos ()
MathExp ()
MathFloor ()
MathLog ()
MathMax ()
MathMin ()
MathMod ()
MathPow ()
MathRand ()
MathRound ()
MathSin ()
MathSqrt ()
MathSrand ()
MathTan ()
double MathAbs (double value)
Returns the absolute value (module) of the specified numeric value.
Parameters
value - numeric value.
Sample
double dx =- 3.141593, dy;
/ / Calc MathAbs
dy = MathAbs (DX);
Print ("absolute value", dx, "is", dy);
/ / Output: The absolute value of -3.141593 is 3.141593
MathArccos double (double x)
The function returns the MathArccos arccosine of x ranging from 0 to π radians. If x is less than -1 or greater than 1, MathArccos returns an indefinite (same as quiet Nan).
Parameters
x - value between -1 and 1 whose arccosine to calculate.
Sample
double x = 0,32696, y;
y = asin (x);
Print ("Arcsine the" X "=", y);
y = acos (x);
Print ("Arccosine the" X "=", y);
/ / Output: Arcsine of 0.326960 = 0.333085
/ / Output: Arccosine of 0.326960 = 1.237711
MathArcsin double (double x)
The function returns MathArcsin arcsine of x in the range-π / 2 π / 2 radians. If x is less than -1 or greater than 1, asin returns an indefinite (same as quiet Nan).
Parameters
x - value whose arcsine is to calculate
Sample
double x = 0,32696, y;
y = MathArcsin (x);
Print ("Arcsine the" X "=", y);
y = acos (x);
Print ("Arccosine the" X "=", y);
/ / Output: Arcsine of 0.326960 = 0.333085
/ / Output: Arccosine of 0.326960 = 1.237711
MathArctan double (double x)
The MathArctan returns arctangent of x. If x is 0, MathArctan returns 0th MathArctan returns in the range of-π / 2 π / 2 radians.
Parameters
x - Many a tangent.
Sample
double x =- 862,42, y;
y = MathArctan (x);
Print ("Arctangent of" x "is", y);
/ / Output: Arctangent of -862.42 is -1.5696
MathCeil double (double x)
MathCeil function returns a numeric value represents the smallest integer that is greater than or equal to X.
Parameters
x - a numeric value.
Sample
double y;
y = MathCeil (2,8);
Print ("The ceil of 2.8 is", y);
y = MathCeil (-2.8);
Print ("The ceil of -2.8 is", y);
/ * Output:
The ceil of 2.8 is 3
The ceil of -2.8 is -2 * /
double MathCos (double value)
Returns the cosine of the specified angle.
Parameters
value - Angle, measured in radians.
Sample
double pi = 3.1415926535;
double x, y;
x = pi / 2;
y = MathSin (x);
Print ("MathSin (" x ") =", y);
y = MathCos (x);
Print ("MathCos (" x ") =", y);
/ / Output: MathSin (1,5708) = 1
/ / MathCos (1,5708) = 0
MathExp double (double d)
Returns value of number is increased power D. On overflow, the function returns INF (infinite) and the underflow, MathExp returns 0th
Parameters
d - A number determines power.
Sample
double x = 2,302585093, y;
y = MathExp (x);
Print ("MathExp (" x ") =", y);
/ / Output: MathExp (2,3026) = 10
MathFloor double (double x)
MathFloor The function returns a numeric value represents the largest number that is less than or equal to x.
Parameters
x - a numeric value.
Sample
double y;
y = MathFloor (2,8);
Print ("The floor is 2,8", y);
y = MathFloor (-2.8);
Print ("The floor of -2.8 is", y);
/ * Output:
The floor is of 2.8 2
The floor of -2.8 is -3 * /
MathLog double (double x)
The functions return MathLog logarithm of x if successful. If x is negative, these functions return an indefinite (same as quiet Nan). If x is 0, they return INF (infinite).
Parameters
x - value whose logarithm can be found.
Sample
double x = 9000,0, y;
y = MathLog (x);
Print ("MathLog (" x ") =", y);
/ / Output: MathLog (9000) = 9.10498
MathMax double (double value1, double value2)
Returns the maximum value of two numerics values.
Parameters
value1 - first numeric value.
value2 - second numeric value.
Sample
double result;
result = MathMax (1.08, bid);
MathMin double (double value1, double value2)
Returns the minimum value of two numeric values.
Parameters
value1 - first numeric value.
value2 - second numeric value.
Sample
double result;
result = MathMin (1.08, Sell);
double MathMod (double value, double value2)
Divide two numbers and returns only the remainder.
Parameters
value - Dividend value.
value2 - divider value.
Sample
double x =- 10.0, y = 3,0, z;
z = MathMod (x, y);
Print ("The rest of the" X "/", y, "is", z);
/ / Output: Rest of -10 / 3 is -1
double MathPow (double base, double exponent)
Returns the value of the base expression taken to a particular force.
Parameters
base - Base value.
exponent - Exponent value.
Sample
double x = 2,0, y = 3,0, z;
z = MathPow (x, y);
Printf (x ", the power of", y, "is", z);
/ / Output: 2 to the power 3 is 8
int MathRand ()
MathRand function returns pseudorandom number in the range of 0 to 0x7fff (32.767). MathSrand use the function to seed the pseudorandom-number generator before calling border.
Sample
MathSrand (LocalTime ());
/ / Display 10 numbers.
for (int i = 0; i <10; i + +)
Print ("random value", MathRand ());
double MathRound (double value)
Returns value rounded to the nearest whole number of the specified numeric value.
Parameters
value - Numeric value of the round.
Sample
double y;
y = MathRound (2,8);
Print ("The round of 2.8 is", y);
y = MathRound (2.4);
Print ("The circle of -2.4 is", y);
/ / Output: The round of 2.8 is 3
/ / Circle is 2 to 2.4
double MathSin (double value)
Returns the sine of the specified angle.
Parameters
value - Angle, measured in radians.
Sample
double pi = 3.1415926535;
double x, y;
x = pi / 2;
y = MathSin (x);
Print ("MathSin (" x ") =", y);
y = MathCos (x);
Print ("MathCos (" x ") =", y);
/ / Output: MathSin (1,5708) = 1
/ / MathCos (1,5708) = 0
MathSqrt double (double x)
MathSqrt function returns the square root of x. If x is negative, returns MathSqrt indefinite (same as quiet Nan).
Parameters
x - Positive numeric value.
Sample
double question = 45.35, responses;
Answer = sqrt (question);
if (question <0)
Print ("Error: MathSqrt returns," response ", response);
elsewhere
Print ("square root" issue "is", answer);
/ / Output: The square root of 45.35 is 6.73
void MathSrand (int seed)
The MathSrand () function sets the starting point for generating a series of pseudorandom integers. To reinitialize the generator, use 1 as the seed argument. Any other value for seed sets the generator to a random starting point. MathRand vomit pseudorandom numbers are generated. Calling mathRand front MathSrand calls to generate the same sequence as calling MathSrand with seed passed as the first
Parameters
seed - Seed for random-number generation.
Sample
MathSrand (LocalTime ());
/ / Display 10 numbers.
for (int i = 0; i <10; i + +)
Print ("random value", MathRand ());
MathTan double (double x)
MathTan returns tangent of x. If x is greater than or equal to 263, or less than or equal to -263, loss of meaning in the result occurs, in which case the function returns an indefinite (same as quiet Nan).
Parameters
x - angle in radians.
Sample
double pi = 3.1415926535;
double x, y;
x = MathTan (pi / 4);
Print ("MathTan (" pi / 4, "=" x);
/ / Output: MathTan (0,7856) = 1
Friday, May 27, 2011
Subscribe to:
Post Comments (Atom)
Popular Posts
Powered by Blogger.
No comments:
Post a Comment