UCUM: Ticket #172: Grammar allows zero
https://ucum.org/trac/ticket/172
<p>
The UCUM 1.9 grammar (I'm not sure where to find any work-in-progress newer version, so I apologize if this has already been addressed) allows 0 to appear as a <digits>, and therefore as a <factor>.
</p>
<p>
It shouldn't be permitted as a <factor> because it doesn't have a multiplicative inverse. It's inclusion ruins the algebraic property noted in section 18 that "For each unit u ∈ U there is an inverse unit u-1 such that u · u-1 = 1. Thus, (U, ·) is an Abelian group."
</p>
en-usUCUMhttps://ucum.org/trac/chrome/site/UCUM-logo-100.png
https://ucum.org/trac/ticket/172
Trac 1.2Gunther SchadowWed, 15 Jul 2015 23:35:07 GMT
https://ucum.org/trac/ticket/172#comment:1
https://ucum.org/trac/ticket/172#comment:1
<p>
Yes, floating point number has an assumed definition as decimal with optional scientific notation. There are additional consideration that relate to the implicit specification of the number of significant digits. These issues have been discussed in another work (the HL7 v3 Data Types standard). We have tried to keep this outside the UCUM specification, because we might have to include standardization of real numbers in computer notation into UCUM.
</p>
<p>
You may use the Java floating point notation for an example. Most other languages, e.g., SQL are quite similar and differences occur only in edge cases.
</p>
<p>
In the writing of numbers internally we use some rules:
</p>
<ul><li>if the number is precise, write the digits without any decimal point, and use the "e" exponent to scale it back. E.g. G = 9.80665 m/s2 (exact) we write as 980665e-5.
</li><li>if the number is estimated, write with decimal point, e.g., even if 100 is an estimate, we would write 100. or 1.00e2
</li></ul><p>
But this is of interest only in the internal notation we might use in any formal data tables. The UCUM standard as published in text does not make that distinction.
</p>
<p>
Perhaps we should speak about this, but for us floating point number is a primitive.
</p>
TicketGunther SchadowWed, 15 Jul 2015 23:36:16 GMT
https://ucum.org/trac/ticket/172#comment:2
https://ucum.org/trac/ticket/172#comment:2
<p>
oops, wrong ticket. this was for <a class="assigned ticket" href="https://ucum.org/trac/ticket/162" title="#162: question: *§23.1 does not define "<floating-point-number>" (assigned)">#162</a>
</p>
TicketGunther SchadowWed, 15 Jul 2015 23:36:32 GMT
https://ucum.org/trac/ticket/172#comment:3
https://ucum.org/trac/ticket/172#comment:3
<p>
oops, wrong ticket. this was for <a class="assigned ticket" href="https://ucum.org/trac/ticket/162" title="#162: question: *§23.1 does not define "<floating-point-number>" (assigned)">#162</a>
</p>
TicketGunther SchadowWed, 15 Jul 2015 23:39:01 GMT
https://ucum.org/trac/ticket/172#comment:4
https://ucum.org/trac/ticket/172#comment:4
<p>
True, factor should be defined by a regex, perhaps, as <a class="missing source" title="No permission to view change log">[1-9]</a><a class="missing source" title="No permission to view change log">[0-9]</a>*.
</p>
TicketBrenée MitchellFri, 15 Jan 2021 20:23:48 GMTstatus changed; owner, component set
https://ucum.org/trac/ticket/172#comment:5
https://ucum.org/trac/ticket/172#comment:5
<ul>
<li><strong>owner</strong>
set to <em>Simon Cox</em>
</li>
<li><strong>status</strong>
changed from <em>new</em> to <em>assigned</em>
</li>
<li><strong>component</strong>
set to <em>help</em>
</li>
</ul>
TicketSimon CoxSun, 17 Jan 2021 23:05:28 GMT
https://ucum.org/trac/ticket/172#comment:6
https://ucum.org/trac/ticket/172#comment:6
<p>
Indeed, in version 2.1 <a href="https://ucum.org/ucum.html#section-Syntax-Rules">https://ucum.org/ucum.html#section-Syntax-Rules</a> it is still the case that the grammar allows for the factor to be zero. Here are the relevant pieces:
</p>
<pre class="wiki"><digit> ::= “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9”
<digits> ::= <digit><digits> | <digit>
<factor> ::= <digits>
</pre><p>
In order to suppress this problem, it would be necessary to replace the above, with something like like
</p>
<pre class="wiki"><digit> ::= “0” | “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9”
<digits> ::= <digit><digits> | <digit>
<non-zero-digit> ::= “1” | “2” | “3” | “4” | “5” | “6” | “7” | “8” | “9”
<non-zero-digits> ::= <non-zero-digit><digits> | <digit><non-zero-digit><digits> | <digit><digits><non-zero-digit> | <non-zero-digit>
<factor> ::= <non-zero-digits>
</pre>
TicketBrenée MitchellTue, 25 May 2021 18:40:34 GMTmilestone set
https://ucum.org/trac/ticket/172#comment:7
https://ucum.org/trac/ticket/172#comment:7
<ul>
<li><strong>milestone</strong>
set to <em>Version 2.2</em>
</li>
</ul>
Ticket