You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@daffodil.apache.org by Roger L Costello <co...@mitre.org> on 2021/11/08 14:11:18 UTC

Why do I need to specify the DFDL rounding properties for an integer data item?

Hi Folks,

My input is  a single integer representing the number of students in a classroom, e.g.,

	30

The following  shows the declaration of the element NumStudents. Notice the plethora of DFDL properties. They are the minimum properties - if you omit any of them, you will get an error. I don't understand why the rounding properties are required. There's no rounding with integers, so why do I need to specify those properties? Even if rounding did apply to integers, then it is mighty odd to specify that rounding is not necessary (textNumberRoundingMode="roundUnnecessary") and then be required to specify the rounding increment (textNumberRoundingIncrement) ... doesn't that strike you as a bit odd?

Also, I don't show it, but the fillByte property is required (if I delete it, an error is raised). Huh? Filling is a concept of binary data formats, not text data formats, so why do I need to specify it?  /Roger 
 
<xs:element name="NumStudents" type="xs:integer"
    dfdl:textNumberPattern="#"
    dfdl:textNumberRep="standard"
    dfdl:textStandardBase="10"
    dfdl:textStandardExponentRep="E"
    dfdl:textStandardZeroRep="0"
    dfdl:textNumberRounding="explicit"
    dfdl:textNumberRoundingMode="roundUnnecessary"
    dfdl:textNumberRoundingIncrement="1"
    dfdl:textNumberCheckPolicy="strict"
/>

Re: Why do I need to specify the DFDL rounding properties for an integer data item?

Posted by Mike Beckerle <mb...@apache.org>.
Answer: The dependencies you see are due to bugs in Daffodil. Code sharing
in Daffodil often results in code paths being shared between many simple
types like floats and integers, hence, often the code path needing rounding
specifiers is taken even for ordinary non-rounding situations.

These are bugs. The DFDL spec provides a precedence of properties and that
says which properties are allowed to depend on or require the existence of
others. These unnecessary ones are all just due to code sharing in the
Daffodil implementation.

Because there is a minor workaround in Daffodil - just specify all of these
in a base format - we have not given much priority to fixing such bugs.
However, they're good beginner bugs for new people working on the code
base, so we should start marking them as such.



On Mon, Nov 8, 2021 at 8:36 AM Roger L Costello <co...@mitre.org> wrote:

> I'd like to add to my question. Suppose NumStudents is an ordinary integer
> that every 1st grader understands: base 10, no exponents, 0 means no
> students. In that case, I don't understand why any of the properties shown
> below have to be specified. And yet they must, or an error will be
> generated. It seems to me that DFDL should make it possible to specify
> simple things simply, but this sure looks like an example of having to
> specify all sorts of complex properties to specify a very simple use case.
> Am I mistaken?  /Roger
>
> -----Original Message-----
> From: Roger L Costello <co...@mitre.org>
> Sent: Monday, November 8, 2021 9:11 AM
> To: users@daffodil.apache.org
> Subject: Why do I need to specify the DFDL rounding properties for an
> integer data item?
>
> Hi Folks,
>
> My input is  a single integer representing the number of students in a
> classroom, e.g.,
>
>         30
>
> The following  shows the declaration of the element NumStudents. Notice
> the plethora of DFDL properties. They are the minimum properties - if you
> omit any of them, you will get an error. I don't understand why the
> rounding properties are required. There's no rounding with integers, so why
> do I need to specify those properties? Even if rounding did apply to
> integers, then it is mighty odd to specify that rounding is not necessary
> (textNumberRoundingMode="roundUnnecessary") and then be required to specify
> the rounding increment (textNumberRoundingIncrement) ... doesn't that
> strike you as a bit odd?
>
> Also, I don't show it, but the fillByte property is required (if I delete
> it, an error is raised). Huh? Filling is a concept of binary data formats,
> not text data formats, so why do I need to specify it?  /Roger
>
> <xs:element name="NumStudents" type="xs:integer"
>     dfdl:textNumberPattern="#"
>     dfdl:textNumberRep="standard"
>     dfdl:textStandardBase="10"
>     dfdl:textStandardExponentRep="E"
>     dfdl:textStandardZeroRep="0"
>     dfdl:textNumberRounding="explicit"
>     dfdl:textNumberRoundingMode="roundUnnecessary"
>     dfdl:textNumberRoundingIncrement="1"
>     dfdl:textNumberCheckPolicy="strict"
> />
>

RE: Why do I need to specify the DFDL rounding properties for an integer data item?

Posted by Roger L Costello <co...@mitre.org>.
I'd like to add to my question. Suppose NumStudents is an ordinary integer that every 1st grader understands: base 10, no exponents, 0 means no students. In that case, I don't understand why any of the properties shown below have to be specified. And yet they must, or an error will be generated. It seems to me that DFDL should make it possible to specify simple things simply, but this sure looks like an example of having to specify all sorts of complex properties to specify a very simple use case. Am I mistaken?  /Roger

-----Original Message-----
From: Roger L Costello <co...@mitre.org> 
Sent: Monday, November 8, 2021 9:11 AM
To: users@daffodil.apache.org
Subject: Why do I need to specify the DFDL rounding properties for an integer data item?

Hi Folks,

My input is  a single integer representing the number of students in a classroom, e.g.,

	30

The following  shows the declaration of the element NumStudents. Notice the plethora of DFDL properties. They are the minimum properties - if you omit any of them, you will get an error. I don't understand why the rounding properties are required. There's no rounding with integers, so why do I need to specify those properties? Even if rounding did apply to integers, then it is mighty odd to specify that rounding is not necessary (textNumberRoundingMode="roundUnnecessary") and then be required to specify the rounding increment (textNumberRoundingIncrement) ... doesn't that strike you as a bit odd?

Also, I don't show it, but the fillByte property is required (if I delete it, an error is raised). Huh? Filling is a concept of binary data formats, not text data formats, so why do I need to specify it?  /Roger 
 
<xs:element name="NumStudents" type="xs:integer"
    dfdl:textNumberPattern="#"
    dfdl:textNumberRep="standard"
    dfdl:textStandardBase="10"
    dfdl:textStandardExponentRep="E"
    dfdl:textStandardZeroRep="0"
    dfdl:textNumberRounding="explicit"
    dfdl:textNumberRoundingMode="roundUnnecessary"
    dfdl:textNumberRoundingIncrement="1"
    dfdl:textNumberCheckPolicy="strict"
/>