0
Former Member
Sep 13, 2010 at 01:18 PM

# Large numbers calculation problem (determinant calculation)

89 Views

Hello experts,

I have really interesting problem. I am calculatig determinant in ABAP with a large numbers (in CRM 5.0 system).

My formula for determinant is :

FORM calculate_determinant USING det TYPE zsppo_determinant

CHANGING value TYPE f .

value =

( 1 * det-a11 * det-a22 * det-a33 * det-a44 ) + ( -1 * det-a11 * det-a22 * det-a34 * det-a43 ) +

( -1 * det-a11 * det-a23 * det-a32 * det-a44 ) + ( 1 * det-a11 * det-a23 * det-a34 * det-a42 ) +

( -1 * det-a11 * det-a24 * det-a33 * det-a42 ) + ( 1 * det-a11 * det-a24 * det-a32 * det-a43 ) +

( -1 * det-a12 * det-a21 * det-a33 * det-a44 ) + ( 1 * det-a12 * det-a21 * det-a34 * det-a43 ) +

( 1 * det-a12 * det-a23 * det-a31 * det-a44 ) + ( -1 * det-a12 * det-a23 * det-a34 * det-a41 ) +

( -1 * det-a12 * det-a24 * det-a31 * det-a43 ) + ( 1 * det-a12 * det-a24 * det-a33 * det-a41 ) +

( 1 * det-a13 * det-a21 * det-a32 * det-a44 ) + ( -1 * det-a13 * det-a21 * det-a34 * det-a42 ) +

( -1 * det-a13 * det-a22 * det-a31 * det-a44 ) + ( 1 * det-a13 * det-a22 * det-a34 * det-a41 ) +

( 1 * det-a13 * det-a24 * det-a31 * det-a42 ) + ( -1 * det-a13 * det-a24 * det-a32 * det-a41 ) +

( -1 * det-a14 * det-a21 * det-a32 * det-a43 ) + ( 1 * det-a14 * det-a21 * det-a33 * det-a42 ) +

( 1 * det-a14 * det-a22 * det-a31 * det-a43 ) + ( -1 * det-a14 * det-a22 * det-a33 * det-a41 ) +

( -1 * det-a14 * det-a23 * det-a31 * det-a42 ) + ( 1 * det-a14 * det-a23 * det-a32 * det-a41 )

.

ENDFORM.

Det values are also f type. Problem is, that for several numbers I got the right values and for another det values I got wrong values... I also try to retype variable value on type p, but without success. Maybe I used wrong types or there is some ABAP rounding of numbers which cause wrong result.

Any good ideas of solutions. <text removed>. Thanks for your time.

Edited by: Matt on Sep 14, 2010 9:17 AM