Skip to Content
author's profile photo Former Member
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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Dec 02, 2005 at 06:25 AM

    Hi,

    do like this

    write : field DECIMALS d .

    regards,

    srinivasarao.o

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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

    ( instead of displaying)

    Hope it helps.

    regards,

    amit m.

    Add a comment
    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.

    Add a comment
    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

  • author's profile photo Former Member
    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..

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    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

    Add a comment
    10|10000 characters needed characters exceeded

    • 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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.