Mathematical function

xiaoxiao2021-03-06  82

Mathematical function

Mathematical functions typically return the results of the numerical data for mathematical operations. The form of mathematics functions:

Function_name (arguments)

Integer_expr can be any integer data type: int, smallint or tinyint;

FLOAT_EXPR can be any integer or floating point type;

Numeric_expr can be any integer, floating point, or Money type.

Function Name Parameters Returns the absolute value of the ABS (NuMeric) expression. The return result is the same as the digital expression type, the accuracy and scales are the same acOS (Approx_Numeric) Returns the anti-cosord function value (radians) (Approx_NuMeric) Returns an ATAN (Approx_NuMeric) Returns the annectant cleaning function (radia) ATN2 (Approx_Numeric1, Approx_Numeric2) Returns the annectable function (radians) CEILING (NuMeric_expr) equals the minimum integer equal to the specified value. The return result is the same as the digital expression type. For Numeric and Decimal type expressions, the accuracy of the return result is the same as the expression, the scales are different, and the cos (Approx_NuMeric) returns a cosord function value of the specified angle (radia) Returns the remainder of the specified angle (radia) Degress (numeric_expr) turns the arc value into an angle value. The return result is the same as the digital expression type. For the expression of Numeric and Decimal types, the accuracy of the return result is 77 and the scale is the same as the scale of the expression. When using the Money data type, internal conversion to FLOAT and throw away accuracy. Exp (FLOAT_EXPR) Specified value FLOR (NuMeric_expr) is less than or equal to the maximum integer of the specified value. The return result is the same as the digital expression type. When the data type of the expression is Numeric or Decimal, the accuracy of the result is the same as the expression of the target 0 log (FLOAT_EXPR) specified value, the value of the value of 10 is 10, the value PI of 10 ) Return the value of 3.1415926 Returns Numerci and Power Power. The return result is the same as the digital expression type. For the expression of Numeric and Decimal types, the accuracy of the return result is 77 and the scale is the same as the scale of the expression. When using the Money data type, internal conversion to FLOAT and throw away accuracy. Radians (Numeric_expr) turns the angular value to the arc value. The return result is the same as the numerical expression type. For the expression of Numeric and Decimal types, the accuracy of the return result is 77 and the scale is the same as the scale of the expression. When the Money data type is used, the internal conversion to FLOAT and the accuracy is lost. RAND ([Integer]) returns a random floating point between 0 or 1. Optional INTEGER_EXPR is the seed. Round (Numeric, Integer) puts a numerical expression from the specified Integer bit. If Integer is a positive, determine the number of valid bits on the right side of the decimal point. If Integer is a negative number, determine the valid bit on the left side of the decimal point. The return data is the same as the data type of the expression. For the expression of the Numeric and Decimal data types, the accuracy of the return result is the first parameter of the first parameter, and the scale is the same as the indication of the same SIGN (Numeric), the symbol of the value: positive ( 1), Zero (0), or negative numbers (-1). The return result is the same as the digital expression type, and the accuracy and scales are also the same. SIN (NUMERIC) Returns a Stroveful Functional Value Tan (NuMeric) returns a specified angle (radians) of the square (rad_expr) returns the square root of the specified value. The return value must be positive or 0

Mathematical internal functions are used to calculate numerical data. Some functions require integer data and approximate numeric type data. Many functions are used to operate exact numerical types, approximate numeric types, Money and Float data types. The internal function is used to exact numerical types, approximate numeric types, Money and Float data types. The default accuracy of the internal function to the Float type operation is 6 decimal. The error trap is used to process the value domain of the math function or return an error. Users can use the set command to set the ArITHABORT or ARITHORE option. By default, both of the two suspensions of Arithabort are set to ON. When the option arithabort arch_overflow is set to ON, if there is an except, an explicit or implicit data type occurs? When the conversion is lost, the accuracy is lost, and the entire transaction or batch command is rolled back. If the option arithabort arch_overflow is set to Off, Adaptive Server will give up the wrong command, but continue to process transactions or commands.

Options AriThabort Arith_Truncation Processes the loss scale when the implicit data type is converted. When the option is set to ON, the error command will be abandoned and the subsequent commands in the event or batch command will be given. If the option is set to OFF, Adaptive Server automatically truncates the query results and proceeds.

By default, Arithignore Arith_Overflow is set to OFF. At this point, the Adaptive Server display information is displayed when an error or unpleasant occurs occurs. When this option is set to ON, the warning message is ignored after an error occurs.

example

SELECT FLOOR (123.45) 123

SELECT FLOOR (-123.45) -124

SELECT FLOOR ($ 123.45) 123.00

Select CEILING (123.45) 124

SELECT CEILING (-123.45) -123

SELECT CEILING ($ 123.45) 124.00

SELECT ROUND (123.4545, 2) 123.4500

SELECT ROUND (123.45, -2) 100.00

The Round function always returns a value, even if its length is illegal. If the specified length is a positive value and longer than the number of points after the decimal point, the zero is added after the deciglation. Round will return 0.00 if the length is negative and greater than or equal to the number of digits before the decimal point.

转载请注明原文地址:https://www.9cbs.com/read-120456.html

New Post(0)