propose new dfdl:binaryNumberRep "offsetBinary"

We have found a number of places that use offset-binary numeric representation. This is also called excess-K, or biased, but I think offset binary is a better description of it. In this representation you take an unsigned binary, and just subtract an offset. E.g., for a 3-bit number, mostSignificantBitFirst: bits unsigned twos-comp offsetBinary 000 0 0 -4 001 1 1 -3 010 2 2 -2 011 3 3 -1 100 4 -4 0 101 5 -3 1 110 6 -2 2 111 7 -1 3 At the moment, users have to work around this in Daffodil using inputValueCalc and outputValueCalc. This is feasible, but really awkward for such a simple concept. So we suggest that the next revision of DFDL include dfdl:binaryNumberRep="offsetBinary" Thoughts? ...mikeb Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy <http://www.ogf.org/About/abt_policies.php>

Hi Mike If I understand this correctly, it is just a way of being able to encode negative numbers. For a given precision the offset is always fixed, so in your example no of bits is 3 so offset is 4. So the lengthKind must be 'explicit' or 'implicit'. If so then the table in 13.7 becomes: Logical Type Permitted Value Decimal, Integer, NonNegativeInteger packed, bcd, binary, ibm4690Packed Long, Int, Short, Byte, packed, binary, offsetBinary, ibm4690Packed (but not bcd) UnsignedLong, Unsignedint, UnsignedShort, UnsignedByte packed, bcd, binary, ibm4690Packed Any other subtleties? Regards Steve Hanson IBM Hybrid Integration, Hursley, UK Architect, IBM DFDL Co-Chair, OGF DFDL Working Group smh@uk.ibm.com tel:+44-1962-815848 mob:+44-7717-378890 From: Mike Beckerle <mbeckerle.dfdl@gmail.com> To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org> Date: 14/09/2017 01:35 Subject: [DFDL-WG] propose new dfdl:binaryNumberRep "offsetBinary" Sent by: "dfdl-wg" <dfdl-wg-bounces@ogf.org> We have found a number of places that use offset-binary numeric representation. This is also called excess-K, or biased, but I think offset binary is a better description of it. In this representation you take an unsigned binary, and just subtract an offset. E.g., for a 3-bit number, mostSignificantBitFirst: bits unsigned twos-comp offsetBinary 000 0 0 -4 001 1 1 -3 010 2 2 -2 011 3 3 -1 100 4 -4 0 101 5 -3 1 110 6 -2 2 111 7 -1 3 At the moment, users have to work around this in Daffodil using inputValueCalc and outputValueCalc. This is feasible, but really awkward for such a simple concept. So we suggest that the next revision of DFDL include dfdl:binaryNumberRep="offsetBinary" Thoughts? ...mikeb Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy -- dfdl-wg mailing list dfdl-wg@ogf.org https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ogf.org_mailman_listinfo_dfdl-2Dwg&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r=AJa9ThEymJXYnOqu84mJuw&m=0CprgI4LRiiIkD6dh9cisdJtiwY8eKVEU17rB6-QG5c&s=pBqzjiTNl3fsPo49Frk7CrYFB04XSwJg2RqwFBGiHd0&e= Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU

I think you've got it. It's pretty simple really. Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy <http://www.ogf.org/About/abt_policies.php> On Thu, Sep 14, 2017 at 9:49 PM, Steve Hanson <smh@uk.ibm.com> wrote:
Hi Mike
If I understand this correctly, it is just a way of being able to encode negative numbers. For a given precision the offset is always fixed, so in your example no of bits is 3 so offset is 4. So the lengthKind must be 'explicit' or 'implicit'.
If so then the table in 13.7 becomes: *Logical Type* *Permitted Value* Decimal, Integer, NonNegativeInteger packed, bcd, binary, ibm4690Packed Long, Int, Short, Byte, packed, binary, *offsetBinary*, ibm4690Packed (but not bcd) UnsignedLong, Unsignedint, UnsignedShort, UnsignedByte packed, bcd, binary, ibm4690Packed
Any other subtleties?
Regards
Steve Hanson
IBM Hybrid Integration, Hursley, UK Architect, *IBM DFDL* <http://www.ibm.com/developerworks/library/se-dfdl/index.html> Co-Chair, *OGF DFDL Working Group* <http://www.ogf.org/dfdl/> *smh@uk.ibm.com* <smh@uk.ibm.com> tel:+44-1962-815848 <+44%201962%20815848> mob:+44-7717-378890 <+44%207717%20378890>
From: Mike Beckerle <mbeckerle.dfdl@gmail.com> To: "dfdl-wg@ogf.org" <dfdl-wg@ogf.org> Date: 14/09/2017 01:35 Subject: [DFDL-WG] propose new dfdl:binaryNumberRep "offsetBinary" Sent by: "dfdl-wg" <dfdl-wg-bounces@ogf.org> ------------------------------
We have found a number of places that use offset-binary numeric representation. This is also called excess-K, or biased, but I think offset binary is a better description of it.
In this representation you take an unsigned binary, and just subtract an offset. E.g., for a 3-bit number, mostSignificantBitFirst:
bits unsigned twos-comp offsetBinary
000 0 0 -4 001 1 1 -3 010 2 2 -2 011 3 3 -1 100 4 -4 0 101 5 -3 1 110 6 -2 2 111 7 -1 3
At the moment, users have to work around this in Daffodil using inputValueCalc and outputValueCalc. This is feasible, but really awkward for such a simple concept.
So we suggest that the next revision of DFDL include dfdl:binaryNumberRep=" offsetBinary"
Thoughts?
...mikeb
Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | *www.tresys.com* <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.tresys.com&d=DwMFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=AJa9ThEymJXYnOqu84mJuw&m=0CprgI4LRiiIkD6dh9cisdJtiwY8eKVEU17rB6-QG5c&s=Cb2qp9nXI2CvCl3KBnFhGn2clGdyoWHcnub_t7PlI3A&e=> Please note: Contributions to the DFDL Workgroup's email discussions are subject to the *OGF Intellectual Property Policy* <https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ogf.org_About_abt-5Fpolicies.php&d=DwMFaQ&c=jf_iaSHvJObTbx-siA1ZOg&r=AJa9ThEymJXYnOqu84mJuw&m=0CprgI4LRiiIkD6dh9cisdJtiwY8eKVEU17rB6-QG5c&s=Fd6hPqHC7Bzl0hNWWivWlZWSQsvJgJhP9QbE56l1FEE&e=> -- dfdl-wg mailing list dfdl-wg@ogf.org https://urldefense.proofpoint.com/v2/url?u=https-3A__www.ogf.org_mailman_ listinfo_dfdl-2Dwg&d=DwICAg&c=jf_iaSHvJObTbx-siA1ZOg&r= AJa9ThEymJXYnOqu84mJuw&m=0CprgI4LRiiIkD6dh9cisdJtiwY8eKVEU17rB6-QG5c&s= pBqzjiTNl3fsPo49Frk7CrYFB04XSwJg2RqwFBGiHd0&e=
Unless stated otherwise above: IBM United Kingdom Limited - Registered in England and Wales with number 741598. Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
participants (2)
-
Mike Beckerle
-
Steve Hanson