SAP POWER FUNCTION



Get Example source ABAP code based on a different SAP table
  


• ipow ABAP_FUNCTION
• base ipow function
• exp ipow function

ABAP_NUMFUNC - ipow

ABAP_SYNTAX
... ipow( base = arg exp = n ) ...

What does it do?
This built-in function raises the argument arg passed to base to the exponent n passed to exp. The arguments arg and n are numeric expression positions. Any numeric data object can be specified for arg. n expects the type i and exponents of other types are converted to i. If the argument arg has the value 0, the value of the exponent n must be greater than or equal to 0.
The function ipow is overloaded in such a way that the return value can have different numeric types.
Outside of an arithmetic expression, the data type of the argument arg determines the data type of the return value.
Within an arithmetic expression, the argument arg contributes to the calculation type of the entire expression and the function is calculated using the calculation type.
If the argument arg is a numeric expression, ipow works like an arithmetic operator and the function is handled in its operand position like an arithmetic expression.
This function can be specified in general and numeric expression positions. The calculation type is determined from the argument arg in the same way as with the other numeric functions. The argument n does not have any effect on the data type of the return value.



Latest notes:

The power function ipow can replace arg ** n calculations, if the calculation type f is to be avoided. This makes sense if the type f is not precise enough.
In many cases, the power function ipow has better performance than using the arithmetic operator **.
NON_V5_HINTS
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The results are 1.4399999999999999 for ** and 1.4400 for ipow. The result of ipow is more precise.
ABEXA 01209
ABAP_EXAMPLE_END

ABAP_EXAMPLE_ABEXA
Power Function ipow
ABAP_EXAMPLE_END