• Login
    • Stedi.com

    Question about X12 decimal numbers: leading zero suppression and exponent notation

    General
    3
    2
    72
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      siddharth.sarda last edited by

      In the X12.6 specification, section 3.5.1.2 Decimal Numbers states, "Leading zeros shall be suppressed unless necessary to satisfy a minimum length requirement." I have a few questions about how this instruction is applied in practice:

      1. Given an R element with a minimum length of 1, if the value to be expressed in the document is 1/10, should the value be written as ".1" or "0.1"?

      2. How is the length of the value ".1" in an EDI document determined?

      3. How is the length of the value "0.1" in an EDI document determined?

      4. Is "0.1" technically invalid because the specification advises suppressing leading zeros?
        Additionally, I would like to understand how the length of a value relates to the use of exponents. For example, the number 1000 can be written in EDI as either 1E3 or 1000.

      5. Will the length of this value differ depending on which notation is used (2 and 4, respectively)?

      1 Reply Last reply Reply Quote 1
      • D
        daniel.bauman last edited by

        Hey Siddarth

        1. It should be written as ".1".
        2. As section 3.5.1.2 states [The length of a decimal type data element does not include the optional minus signs, decimal point, or trailing exponent indicator "E".] the length of ".1" is 1.
        3. The length of "0.1" is determined as it is given. In this case an EDI element with value "0.1" is 2.
        4. Answering this question in two parts:
          4.1 According to the spec "0.1" should be written as ".1" in an EDI element unless leading 0s are required to pad the number to meet a minimum length constraint.
          4.2 1000 will have length 4 when written as "1000" and length 2 when written as "1E3".
        5. It will, "0.1" has length 2 and ".1" has length 1 even though the same numeric quantity is being represented by both.

        You can see some of these details discussed in this request for clarification on the x12 website - https://x12.org/resources/requests-for-interpretation/rfi-2596-request-clarification-representation-numeric-types

        1 Reply Last reply Reply Quote 1
        • First post
          Last post
        Powered by NodeBB | Contributors