Hi ,
I have 2 large float numbers. I want to perform mathematical mod operation on these 2 numbers but i keep getting a blank value.
Is this because SAP Abap does not handle these large numbers? I used float data type because I figured this data type would be the best to handle large numbers.
data: lv_n type f,
lv_temp type f,
result type f.
lv_temp = 1.1417981541647679E+46.
lv_n = 2.7730000000000000E+03.
RESULT = lv_temp mod lv_n.
Value of variable RESULT should be 1278 or 1.2780000000000000E+03. I keep getting a blank on this statement. (this is the actual mathematical statement that I am trying to achieve via ABAP , 512^17 mod 2773).
Does anyone know why this is happening or if I am doing something wrong or just that SAP ABAP doesn't handle large numbers?
Thanks.
Hi,
Thank you for your replies. Manish was right SAP ABAP doesn't handle large numbers.
This is the information from the ABAPDOCU.
The ABAP runtime environment always calculates commercially and not numerically like the underlying machine arithmetic.
The ABAP runtime environment always calculates commercially and not numerically like the underlying machine arithmetic. According to the rounding algorithm of the latter, the end digit 5 must always be rounded to the nearest even number (not the next largest number), that is, from 2.5 to 2, 3.5 to 4.
You should also note that multiplication using powers of 10 (positive or negative) is not an exact operation.
- For example, although it can be represented exactly in two parts, a floating point number F of value 100.5, after the operation
F = F / 100 * 100.
it has the value 100.49999999999999.As well as rounding errors, the restricted number of decimal places for the mantissa can lead to the loss of trailing digits.
- For example, 1 - 1,0000000000000001 results in zero.
This means you cannot rely on the last digits in floating point arithmetic. In particular, you should not usually test two floating point numbers a and b for equality; instead, you should check whether the relative difference abs((a - b)/a) is less than a predefined limit, such as 10**(-7).
I was trying to implement the RSA algorithm. Got thru 80% of the way. Now I have to scrap it all. Such a pity.ðŸ˜¢ðŸ˜¢ðŸ˜”
Thanks again.
Add a comment