Arithmetic operation function in Delphi
The following content is the result of the propose of the netizens of the program. If you need to reprint, please indicate the source: http://www.togetherdev.com, if you are interested in translation Delphi, you can log in programming website, if What is the meaning of translation?
ABS CEIL Exp Floor Frac Frexp Int IntPower LDEXP MAX MINPIPOLYPOWERROUNDSQRTTRUNCSQR
Function name ABS brief introduction: Returns An Absolute Value. (Take an absolute value) Associated unit: system definition: function abs (x); Detailed explanation: abs returns the absolute value of the argument, xx is an integer-type or real-type x Expression. (ABS function is used to return the absolute value of the variable X, X can be a shaped variable or real-type variable) Return function name CEIL brief description: Rounds Variables Up Toward Positive Infinity. Site: Math Definition: Function CEIL X: Extended: Integer Detailed explanation: Call Ceil To Obtain The Lowest Integer Greater Than Or Equal To X. The Absolute Value of X Must Be Less Than Maxint. For example: ceil (-2.8) = -2ceil (2.8) = 3CEIL (-1.0) = -1 (Call the CEIL function, returning the minimum integer value greater than or equal to X. The absolute value of the x must be less than the maximum integer value. For example: ceil (-2.8) = -2ceil (2.8) = 3CEIL (- 1.0) = -1) Return to function name EXP brief introduction: Returns the exponential of x. (The EXP function returns the X Power of the natural logarithmic substrate E.) The unit: system definition: function exp (x: real): real; Detailed explanation: Exp Returns the value of e rased to the power of x, where e is the base of the Natural Logarithms. (Exp to E 's X Power Values, where E is a natural logarithmic substrate.) Example: Var
E: Real;
String;
Begin
E: = EXP (1.0);
STR (ln (e): 3: 2, s);
S: = 'E =' floattostr (e) '; ln (e) =' S;
Canvas.Textout (10, 10, s);
End; Return Function Name Floor Description: Rounds Variables Toward Negative Infinity. (Take the maximum integer of a given value) belonging: Math Definition: Function Floor (x: Extended): Integer; Detailed explanation: Call floor to Obtain the highest Integer Less Thanlet: floor (-2.8) = -3floor (2.8) = 2floor (-1.0) = -1Note: The Absolute Value of X Must Be Less Than Maxint. (using the FLOOR function to get less than Most of the maximum integer, such as floor (-2.8) = -3floor (2.8) = 2floor (-1.0) = -1 Note: The absolute value of X must be less than the maximum of the shaping number) Return to the function name FRAC brief introduction: RETURNS THE FRACTIONAL PART OF A Real Number (Returns a real number) belonging: system definition: Function Frac (x: extended): Extended; Detailed explanation: The Frac Function Returns the Fractional Part of the argument xx is a real- TYPEE RESSSITIONAL PART OF X; That IS, FRAC (X) = X - INT (X). (FRAC function returns the fractional portion of the parameter X, X is a real number, the function of the function is equivalent Example: VARA, B: REAL;
Begin
A: = 1.54;
B: = FRAC (a);
END;
At this time, a = 1.54, b = 0.54 Return Function name Frexp brief introduction: Separates The Mantissa and Exponent Of X (Decomposing the Monail and Index of X X and Index) Associated Unit: Math Definition: Procedure Frexp (x: Extended; Var Mantissa : Extended; Var Exponent: Integer Register; Detailed explanation: Frexp Returns The Mantissa of X As Mantissa and The Exponent As Exponent. (FREXP function returns the X's mantissa Mantissa and Index Variable Exponent). Return to the function name INT brief introduction: Returns the Integer Part of a real number: (Returns an integer part of a real type) belonging: system definition: function int (x: extended): extended; detailed explanation: int Returns the integer part of X; That IS, X ROUNDED TOWARD ZERO. X is a real-type expression. (INT function returns an integer portion of the parameter X, X is the real type, the function result is X through negative rounding (rounding to 0). Example: var
R: REAL;
Begin
R: = Int (123.456); {123.0}
R: = INT (-123.456); {-123.0}
END;
Return to Functions INTPOWER Description: Calculate The Integral Power of A Base Value. (Calculating the integer power of the base): Math definition: function intpower (base: extended; exponent: integer): Extended Register; detailed explanation: intPower raise Base to the power specified by Exponent (Calculating the integer power. Base) Example: Return Function Name LDEXP Description: Calculates X * (2 ** P) A unit: Math Definition: Function LDEXP (X : Extended; p: integer; extended register; Detailed explanation: LDEXP RETURns X Times (2 to the power of p) (LDEXP calculates x * (2 ** P), returns x (2 P movable) times Power.) Back to function name Max Brief introduction: Returns The Greater of Two Numeric Values. (Take the maximum value in the two numbers) belonging: Math Definition: Function Max (A, B: Integer): Integer; Overload; Function Max (A, B: INT64): INT64; OVERLOAD;
Function Max (a, b: Single): SINGLE; OVERLOAD;
Function Max (a, b: double): double; overload;
Function Max (A, B: Extended): Extended; OverLoad; Detailed explanation: Call Max to Compare Two Numeric Values. Max Returns The Greater Value of The Two. (Returns the maximum value in the two values. Call MAX compare two values It returns a larger value in both.) Return to function name MIN Brief introduction: Returns the lesser of two Numeric Values. (Take the minimum value of two) The unit: Math definition: Function min (A, B: Integer: Integer; OVERLOAD; Function Min (a, b: int64): int64; OverLoad; Function min (a, b: Single): SINGLE; OVERLOAD; Function min (a, b: double): double; OVERLOAD; Function MIN (A, B: Extended): Extended; OverLoad; Detailed explanation: Call min to compare Two Numeric Values. MIN RETURNS The Smaller Value of the Two. (Returns the minimum in the two values. Call MAX compare two values, it returns a value smaller of the two) function returns the name pi brief: returns 3.1415926535897932385 (return 3.1415926535897932385) belongs unit: System definitions: function Pi: Extended; detailed explanation:... Use Pi in mathematical calculations that require pi, the ratio of a circle's circumference to its diameter. Pi is approximated as 3.1415926535897932385. (accurate calculation using the function returns Pi Pi Pi, Pi is a value obtained by dividing the circumference of a circle to its diameter approximates 3.1415926535897932385 .Pi.) function returns the name Poly (this translation is uniform) Brief Introduction: Evaluates a Uniform Polynomial of one variable at the value X. unit belongs: Math defined: function Poly (X: Extended; const Coefficients: array of Double): Extended; Detailed Explanation: Call Poly to evaluate the polynomial represented by the Coefficients parameter at the point where the variable Equals the value of the x parameter. The Coefficients Are Ordered in Increasing Powers of x: Coefficients [0] CoeffInTicients [1] * x ... COEfficInts [n] * (x ** n) (POLY estimated a variable The X value of the same polynomial. Call Poly Evaluation The value of a polynomial that is expressed by the COEfficInts parameter is equivalent to the value of the X parameter.
The parameter is the order of X-shi: COEfficients [0] Coefficients [1] * x ... .. COFFICIENTS [N] * [x ** n]) Return Function Name Power Profile: rases base to any poter. (Take a real power) Associated unit: Math definition: function power (base, exponent: Extended): Extended; Detailed explanation: Power Raises base to any power. For Fractional Exponents or Exponents Greater Than Maxint, Base Must Be Greater Than 0 (Returns a real power. When the index exponent is a decimal or greater than maxint, the base base must be greater than 0.) Return to the function name Rounded: returns the value of x rounded to the nearest Whole Number. (20 rounds to a real number ) The unit: system definition: Function Round (x: extended): int64; Detailed explanation: The Round Function Rounds a real-type value to an integer-type value.x is a real-type expression. Round Returns an Int64 Value That is the value of X rounded to the nearest whole number. If X is exactly halfway between two whole numbers, the result is always the even number.If the rounded value of X is not within the Int64 range, a run-time error is generated Which can be handled using the einvalidop exception. (Round Returns the rounding of the nearest integer value. The function rounds a real value into a full value .x is a real expression .Round returns a long integer The value is the nearest integer value. If x It is the middle of the two integer values, the result is one of the absolute values. If the rounding value of X is not in a long integer range, a runtime error will be generated, you can use the einvalidop exception to handle the example: Vars, T: string;
Begin
STR (1.4: 2: 1, t);
S: = T 'ROUNDS to' INTOSTR (Round (1.4)) # 13 # 10;
STR (1.5: 2: 1, t);
S: = S T 'ROUNDS to' INTSTR (Round (1.5)) # 13 # 10;
STR (-1.4: 2: 1, t);
S: = S T 'ROUNDS to' INTOSTR (Round (-1.4)) # 13 # 10;
STR (-1.5: 2: 1, t);
S: = S T 'ROUNDS to' INTTOSTR (Round (-1.5));
Messagedlg (s, mtinformation, [mbok], 0);
End; return function name SQR brief introduction: returns the Square of a number. (Part of the value) belonging: system definition: function sqr (x: extended): Extended; Detailed explanation: The SQR Function Returns the Square of The argument.x is a floating-point expression. The result, of the same type as x, is the Square of x, or x * x. (SQR returns x to square value, x is a floating point number, return The value of the value is the same, the value is x * x) Example: Var S, Temp: string; Begin Str (SQR (5.0): 3: 1, TEMP); s: = '5 squared is' TEMP # 13 # 10; STR (SQRT (2.0): 5: 4, TEMP); S: = S 'The Square Root of 2 IS' TEMP; Messagedlg (S, Mtinformation, [Mbok], 0); END; Return Function Name SQRT brief introduction: Returns the Square root of x. Configuration: system definition: function sqrt (x: extended): Extended; Detailed explanation: x is a floating-point expression. The result is the square root of x. (Take X is a square root, X is a floating point number, return value is also a floating point number) Example: var s, temp: string; begin Str (SQR (5.0): 3: 1, TEMP); s: = '5 squares is' Temp # 13 # 10; STR (SQRT (2.0): 5: 4, TEMP); s: = S 'The Square Root of 2 IS' TEMP; Messagedlg (S, Mtinformation, [Mbok], 0); End; return function name Trunc brief introduction: truncates a real number to an integer. (intercept one A university integer part) The unit: system definition: function trunc (x: extended): int64; Detailed explanation: The Trunc Function Truncates a real-type value to an integer-type value. X is a real-type expression. Trunc Returns an int64 value this is the value of x runcate value of x is not with the int64 range, an einvalidop exception is ras: var s, t: string; begin Str (1.4: 2: 1 , T); s: = t 'truncs to' INTOSTR (Trunc (1.4)) # 13 # 10; STR (1.5: 2: 1, t); s: = S T 'Truncs to'