SAP NetWeaver AS ABAP Release 740, ©Copyright 2014 SAP AG. All rights reserved.
ABAP Keyword Documentation → ABAP − Reference → Processing Internal Data → Numeric Calculations → Numerical Functions →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 |
acos | arccosine | [-1,1], no decfloat34 |
asin | arcsine | [-1,1], no decfloat34 |
atan | arctangent | -, no decfloat34 |
cos | cosine | -, no decfloat34 |
sin | sine | -, no decfloat34 |
tan | tangent | -, no decfloat34 |
cosh | hyperbolic cosine | -, no decfloat34 |
sinh | hyperbolic sine | -, no decfloat34 |
tanh | hyperbolic tangent | -, no decfloat34 |
exp | Exponential function for base e | [-709, 709] for type f and [-14144, 14149] for type decfloat34 |
log | Natural logarithm | > 0 |
log10 | Logarithm to base 10 | > 0 |
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:
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
Catchable Exceptions
CX_SY_ARG_OUT_OF_DOMAIN