Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Simple division operation in SAP sometimes works wrong?

Former Member
0 Kudos

Hi Everyone,

here you are a program, which divides 2 numbers:

---------------------------------
PROGRAM divide.

DATA: pack TYPE p DECIMALS 2,
n TYPE f VALUE '1000.5',
m TYPE f VALUE '10'.

pack = n / m.

WRITE pack.
---------------------------------

Result is 100.05 and this is wrong.
Correct result is 100.50


Where is a catch?

Our version is ECC 617

I do not believe that simple division sometimes does not really work in SAP.

Thanks,
Alex

4 REPLIES 4

ChrisSolomon
Active Contributor
0 Kudos

Do you have "fixed point arithmatic" checked/selected for your program?

Sandra_Rossi
Active Contributor

sorry but 1000.5 / 10 gives 100.05, not 100.50 !

raghug
Active Contributor

Just to double check that Alexander didn't mean the other way around (that SAP is returning 100.50) I just ran his little program in SAP and it did return 100.05 as expected. Pheww - the world is still round!

Former Member
0 Kudos

False alarm, everything works as expected. Sorry!