12-02-2005 6:20 AM
Hi,
Anybody know the rounding down decimals without using functional module.If you know means tell me pls.
Thanks
Regards,
Nandha
12-02-2005 6:25 AM
Hi,
do like this
write : field DECIMALS d .
regards,
srinivasarao.o
12-02-2005 6:47 AM
12-02-2005 6:49 AM
while declaring write
data : decimals type p round n
where n is the no of decimals u want to round
12-02-2005 6: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
( instead of displaying)
Hope it helps.
regards,
amit m.
12-02-2005 6:48 AM
Hi,
This one is rounding up .I want rounding down. Decimals default rounding up.
Thanks
Regards,
Nandha
12-02-2005 8:47 PM
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
12-02-2005 9: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.
12-02-2005 9:46 PM
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
12-05-2005 1:34 AM
Hi,
Rounding down means
1.267
rounding down 2 parameters
1.26
That it. for this i need format.
Thanks.
Regards
Nandha..
12-05-2005 3:47 AM
Hi,
Try to use
data: Num type p decimals 2.
This will give u nearest two places of decimal.
If this works out pelase reward points.
Regards,
Irfan Hussain
12-05-2005 4:56 AM
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.
12-05-2005 5:02 AM
Hi,
I want to rounding down
1.266
means
1.25
like this
Regards,
nandha
12-05-2005 5:11 AM
I am not sure I understood this. Earlier you said, if the value is 1.267, then the result should be 1.26 and now you say if the value is 1.266, then it should be 1.25. Which one is correct?
Then what will be the rounded down value for 1.20? Or will you just leave it as it is because it is already two decimal number? How about 1.2001, will it be 1.20 or 1.19? Are you always rounding down from and three decimal number to a two decimal number?
Srinivas