Former Member

# Rounding down

Hi,

Anybody know the rounding down decimals without using functional module.If you know means tell me pls.

Thanks

Regards,

Nandha

10|10000 characters needed characters exceeded

### Related questions

• Former Member
Posted on Dec 02, 2005 at 06:25 AM

Hi,

do like this

write : field DECIMALS d .

regards,

srinivasarao.o

10|10000 characters needed characters exceeded
• Former Member Former Member

while declaring write

data : decimals type p round n

where n is the no of decimals u want to round

• Former Member
Posted on Dec 02, 2005 at 06:41 AM

Hi nandha,

1.one way is to use decimal.

2. see code (just copy paste)

REPORT abc NO STANDARD PAGE HEADING.

DATA: X TYPE P DECIMALS 3 VALUE '1.267',

Y TYPE F VALUE '125.456E2'.

WRITE: / X DECIMALS 0, "output: 1

/ X DECIMALS 2, "output: 1.27

/ X DECIMALS 5, "output: 1.26700

/ Y DECIMALS 1, "output: 1.3E+04

/ Y DECIMALS 5, "output: 1.25456E+04

/ Y DECIMALS 20. "output: 1.25456000000000E+04

3. u can also use write to WRITE TO a FIELD

Hope it helps.

regards,

amit m.

10|10000 characters needed characters exceeded
• Former Member Former Member

Hi,

maybe 'floor' can help:

REPORT ztest NO STANDARD PAGE HEADING.

DATA: x TYPE p DECIMALS 3 VALUE '1.267',

z TYPE p DECIMALS 3.

z = floor( x * 100 ) / 100. " DECIMALS 2

WRITE:

/ x DECIMALS 3,

/ x DECIMALS 2,

/ z DECIMALS 2.

regards,

Johann

• Posted on Dec 02, 2005 at 09:05 PM

rounding down is nothing but truncating the decimals part, isn't it? So if the value is 11.2, you want 11 and if the value is 11.9, even then you want 11, correct?

Use TRUNC for the purpose.

10|10000 characters needed characters exceeded
• Former Member

Floor function returns next smallest whole number(rounds down),Ceil function returns next largest whole number(rounds up).are you looking for the same?

I = 3.5

I = CEIL( P ). " 4 - next largest whole number,

I = FLOOR( P ). " 3 - next smallest whole number

thanks,

vamshi

• Former Member
Posted on Dec 05, 2005 at 01:34 AM

Hi,

Rounding down means

1.267

rounding down 2 parameters

1.26

That it. for this i need format.

Thanks.

Regards

Nandha..

10|10000 characters needed characters exceeded
• Here is the logic.

Multiply your number by 100. Use TRUNC command to remove everything after the decimal point. Divide the number again with 100, you should get your version rounded number.

• Former Member
Posted on Dec 05, 2005 at 05:02 AM

Hi,

I want to rounding down

1.266

means

1.25

like this

Regards,

nandha