ARTICLE
acos , sin , tanh , exp , log , sqrt
- Floating Point Functions
The following table shows the floating point functions that expect a
floating point number as an
unnamed argument. Floating point functions are overloaded so that the
return code can have the type decfloat34 or f .
Decimal floating point numbers are still
only possible as arguments of exp , log , log10 , and
sqrt .
Syntax
... func( arg ) ...
Effect
The argument of a floating point function must be a single data object
outside an arithmetic expression and can be an arithmetic expression
itself within an arithmetic expression.
Effect of the floating point functions:
Function func Meaning Definition Range
ABAP_KEY acos arccosine[-1,1], no decfloat34
ABAP_KEY asin arcsine[-1,1], no decfloat34
ABAP_KEY atan arctangent-, no decfloat34
ABAP_KEY cos cosine -, no decfloat34
ABAP_KEY sin sine -, no decfloat34
ABAP_KEY tan tangent -, no decfloat34
ABAP_KEY cosh hyperbolic cosine -, no decfloat34
ABAP_KEY sinh hyperbolic sine -, no decfloat34
ABAP_KEY tanh hyperbolic tangent -, no decfloat34
ABAP_KEY exp Exponential function for base e[-709, 709] for
type f and [-14144, 14149] for type decfloat34
ABAP_KEY log Natural logarithm 0
ABAP_KEY log10 Logarithm to base 10 0
ABAP_KEY sqrt Square root = 0
Functions that specify "no decfloat34 " cannot currently have the
calculation type decfloat34 .
If one of these functions is specified in an expression with this
calculation type, a syntax error occurs or the exception
CX_SY_UNSUPPORTED_FUNCTION is raised.
The following applies to the
floating point arithmetic in which a floating point function is
calculated, and to the data type of the return code:
If the argument has the type decfloat16 or decfloat34 , a
floating point function is calculated in decimal floating point
arithmetic and the return code has the type decfloat34 .
If a floating point function is used in an
arithmetic expression whose
calculation type is decfloat34
, or that contains a numeric
expression of type decfloat34 as an argument, it also
calculates a return code with the type decfloat34 and the
argument is first converted to the data type decfloat34 , if
necessary.
In all other cases, floating point functions use binary floating point
arithmetic to calculate a return code with type f and the
argument is first converted to the data type f , if necessary.
Functions with a definition range require the value of arg to be
within the specified limits. Arguments within the definition ranges are
guaranteed to be error-free for the exponential function exp ,
since the results are then within the value
ranges for binary or
decimal
floating point numbers in
accordance with IEEE-754 . For arguments less than -709, the
result for binary floating point numbers is (depending on the platform)
a subnormal number, 0, or a handleable exception of the class
CX_SY_ARITHMETIC_OVERFLOW is raised from a specific value.
The trigonometric functions sin , cos , and tan are
defined for any arguments but the results become imprecise if the
argument is greater than approximately 100,000,000.
Notes
The atan function is undefined for odd-number multiples of pi/2,
but the definition range of atan is nevertheless restricted since
an argument of this function can never contain the precise value of
pi/2.
The functions described here are some of the functions that can be used
in the obsolete extended
functional operand positions , even if their argument is a single data
object.
Runtime Exceptions
Catchable Exceptions
CX_SY_ARG_OUT_OF_DOMAIN
Reason for error: Invalid call of acos
Runtime error: COMPUTE_ACOS_DOMAIN
Reason for error: Invalid call of asin
Runtime error: COMPUTE_ASIN_DOMAIN
Reason for error: Unzul�ssiger Aufruf von atan
Laufzeitfehler: COMPUTE_ATAN_DOMAIN
Reason for error: Unzul�ssiger Aufruf von cosh
Laufzeitfehler: COMPUTE_COSH_DOMAIN
Reason for error: Invalid call of cos
Runtime error: COMPUTE_COS_DOMAIN
Reason for error: Unzul�ssiger Aufruf von exp
Laufzeitfehler: COMPUTE_EXP_DOMAIN
Reason for error: Invalid call of log10
Runtime error: COMPUTE_LOG10_ERROR
Reason for error: Invalid call of log
Runtime error: COMPUTE_LOG_ERROR
Reason for error: Unzul�ssiger Aufruf von sinh
Runtime error: COMPUTE_SINH_DOMAIN
Reason for error: Invalid call of sin
Runtime error: COMPUTE_SIN_DOMAIN
Reason for error: Invalid call of sqrt
Runtime error: COMPUTE_SQRT_DOMAIN
Reason for error: Unzul�ssiger Aufruf von tanh
Runtime error: COMPUTE_TANH_DOMAIN
Reason for error: Invalid call of tan
Runtime error: COMPUTE_TAN_DOMAIN
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved