Issue 3581: Incorrect use of negative fixed scale (orb_revision) Source: Cisco Systems (Mr. Paul Kyzivat, nobody) Nature: Uncategorized Issue Severity: Summary: In section 3.9.2 (of ptc/99-12-07) on semantics of constants, an example is given showing 3000.00D being of type fixed<1,-3>. This is inconsistent with statements elsewhere that fixed scale is a non-negative quantity. Also, the preceding explanation states: "... leading and trailing zeros are factored out, INCLUDING NON-SIGNIFICANT ZEROS BEFORE THE DECIMAL POINT." This rule of course leads to negative scale factors, so it must also be incorrect. Suggested Revision: Change the following text: "A fixed-point literal has the apparent number of total and fractional digits, except leading and trailing zeros are factored out, including non-significant zeros before the decimal point. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." to: "A fixed-point literal has the apparent number of total and fractional digits, except leading zeros before the decimal point and trailing zeros after the decimal point are factored out. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<4,0>." Resolution: Remove the specification for stripping leading and trailing zeros, and fix the examples accordingly Revised Text: Change the following text in section 3.9.2 page 3-31 of orbrev/00-09-01:: "A fixed-point literal has the apparent number of total and fractional digits, except leading and trailing zeros are factored out, including non-significant zeros before the decimal point. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." to: "A fixed-point literal has the apparent number of total and fractional digits. For example, 0123.450d is considered to be fixed<7,3> and 3000.00d is fixed<6,2>." Actions taken: April 25, 2000: received issue February 27, 2001: closed issue Discussion: End of Annotations:===== From: Paul Kyzivat To: "'issues@omg.org'" , "'Core RTF'" Subject: Incorrect use of negative fixed scale Date: Tue, 25 Apr 2000 16:04:28 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2448.0) Content-Type: text/plain; charset="iso-8859-1" X-UIDL: ^==!![^ld92=7e9LGLe9 In section 3.9.2 (of ptc/99-12-07) on semantics of constants, an example is given showing 3000.00D being of type fixed<1,-3>. This is inconsistent with statements elsewhere that fixed scale is a non-negative quantity. Also, the preceding explanation states: "... leading and trailing zeros are factored out, INCLUDING NON-SIGNIFICANT ZEROS BEFORE THE DECIMAL POINT." This rule of course leads to negative scale factors, so it must also be incorrect. Suggested Revision: Change the following text: "A fixed-point literal has the apparent number of total and fractional digits, except leading and trailing zeros are factored out, including non-significant zeros before the decimal point. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." to: "A fixed-point literal has the apparent number of total and fractional digits, except leading zeros before the decimal point and trailing zeros after the decimal point are factored out. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<4,0>." Paul Date: Wed, 26 Apr 2000 06:37:51 +1000 (EST) From: Michi Henning To: Paul Kyzivat cc: "'issues@omg.org'" , "'Core RTF'" Subject: Re: Incorrect use of negative fixed scale In-Reply-To: <9B164B713EE9D211B6DC0090273CEEA926BE31@bos1.noblenet.com> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: ?&-e9@9&!!9*'"![bZd9 On Tue, 25 Apr 2000, Paul Kyzivat wrote: > In section 3.9.2 (of ptc/99-12-07) on semantics of constants, > an example is given showing 3000.00D being of type fixed<1,-3>. > This is inconsistent with statements elsewhere that fixed scale is a > non-negative quantity. Yes. We made negative scales illegal quite some time ago. This is an editorial glitch that slipped through the cracks. > Change the following text: > > "A fixed-point literal has the apparent number of total and > fractional > digits, except leading and trailing zeros are factored out, > including > non-significant zeros before the decimal point. For example, > 0123.450d is > considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." > > to: > > "A fixed-point literal has the apparent number of total and > fractional > digits, except leading zeros before the decimal point and trailing > zeros > after the decimal point are factored out. For example, 0123.450d is > considered to be fixed<5,2> and 3000.00d is fixed<4,0>." I agree with the fix. I'm still not sure that throwing leading and trailing zeros away is the right thing to do however. It means that, for example, I cannot specify a constant of type fixed<5,2> unless that constants is non-zero in the first and last digit. For example, there is no way to have 10.00 as type fixed<5,2> because it always will be fixed<2,0>, even if I write it as 010.00... Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Sender: jbiggar@corvette.floorboard.com Message-ID: <390627AF.7E686D5D@floorboard.com> Date: Tue, 25 Apr 2000 16:18:07 -0700 From: Jonathan Biggar X-Mailer: Mozilla 4.7 [en] (X11; U; SunOS 5.6 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Michi Henning CC: Paul Kyzivat , "'issues@omg.org'" , "'Core RTF'" Subject: Re: Incorrect use of negative fixed scale References: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: 6l,e9*P`d9k_G!!,\F!! Michi Henning wrote: > > Change the following text: > > > > "A fixed-point literal has the apparent number of total and fractional > > digits, except leading and trailing zeros are factored out, including > > non-significant zeros before the decimal point. For example, 0123.450d is > > considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." > > > > to: > > > > "A fixed-point literal has the apparent number of total and fractional > > digits, except leading zeros before the decimal point and trailing zeros > > after the decimal point are factored out. For example, 0123.450d is > > considered to be fixed<5,2> and 3000.00d is fixed<4,0>." > > I agree with the fix. I'm still not sure that throwing leading and trailing > zeros away is the right thing to do however. It means that, for example, > I cannot specify a constant of type fixed<5,2> unless that constants > is non-zero in the first and last digit. For example, there is no way > to have 10.00 as type fixed<5,2> because it always will be fixed<2,0>, even > if I write it as 010.00... Agreed, but the intent is to make sure that the language bindings are defined in such a way that the inability to define "10.00" as fixed<4,2> does not cause problems. I'm not aware of any languages (with the possible exception of Ada, which might require a cast, however my Ada is rusty) where this is a difficulty. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Date: Thu, 28 Sep 2000 17:13:30 -0400 From: Jishnu Mukerji Reply-To: jis@fpk.hp.com Organization: Hewlett-Packard EIAL, Florham Park NJ USA X-Mailer: Mozilla 4.73 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: orb_revision@omg.org Subject: Issue 3581: Incorrect use of negative fixed scale Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: Ud;e9\Z5!!'kfd9+d>!! Issue 3581: Incorrect use of negative fixed scale (orb_revision) Source: Rogue Wave Software (Mr. Paul Kyzivat, paulk@roguewave.com) Nature: Uncategorized Issue Severity: Summary: In section 3.9.2 (of ptc/99-12-07) on semantics of constants, an example is given showing 3000.00D being of type fixed<1,-3>. This is inconsistent with statements elsewhere that fixed scale is a non-negative quantity. Also, the preceding explanation states: "... leading and trailing zeros are factored out, INCLUDING NON-SIGNIFICANT ZEROS BEFORE THE DECIMAL POINT." This rule of course leads to negative scale factors, so it must also be incorrect. Suggested Revision: Change the following text: "A fixed-point literal has the apparent number of total and fractional digits, except leading and trailing zeros are factored out, including non-significant zeros before the decimal point. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." to: "A fixed-point literal has the apparent number of total and fractional digits, except leading zeros before the decimal point and trailing zeros after the decimal point are factored out. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<4,0>." Comments? Thanks, Jishnu. -- Jishnu Mukerji Senior Systems Architect, EIAL Hewlett-Packard Company 300 Campus Drive, MS 2E-62 Florham Park NJ 07932, USA +1 973 443 7528 jis@fpk.hp.com Date: Fri, 29 Sep 2000 11:08:27 +1000 (EST) From: Michi Henning To: Jishnu Mukerji cc: orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale In-Reply-To: <39D3B47A.8D8DC7C@fpk.hp.com> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: VWE!!O@`!!B~dd91W2!! On Thu, 28 Sep 2000, Jishnu Mukerji wrote: > Change the following text: > > "A fixed-point literal has the apparent number of total and > fractional > digits, except leading and trailing zeros are factored out, > including > non-significant zeros before the decimal point. For example, > 0123.450d > is > considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." > > to: > > "A fixed-point literal has the apparent number of total and > fractional > digits, except leading zeros before the decimal point and trailing > zeros > after the decimal point are factored out. For example, 0123.450d is > considered to be fixed<5,2> and 3000.00d is fixed<4,0>." > > Comments? I have never been happy with this idea of stripping leading and trailing zeros. Doing this means that, for example, the constant 0 can only have the type fixed<1,0> (or should that be fixed<0,0>? ;-) I would have preferred to preserve all the digits, regardless of their value. That would make a lot more sense to me. For example: 0.00d would be fixed<3,2> 01.99d woudl be fixed<4,2> Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Date: Fri, 29 Sep 2000 12:28:58 +1000 (EST) From: Michi Henning To: Jonathan Biggar cc: Jishnu Mukerji , orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale In-Reply-To: <39D3FCC1.1063375E@floorboard.com> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: ;jGe9HIb!!D"O!!MSe!! On Thu, 28 Sep 2000, Jonathan Biggar wrote: > > I have never been happy with this idea of stripping leading and trailing > > zeros. Doing this means that, for example, the constant 0 can only have > > the type fixed<1,0> (or should that be fixed<0,0>? ;-) > > > > I would have preferred to preserve all the digits, regardless of their > > value. That would make a lot more sense to me. For example: > > > > 0.00d would be fixed<3,2> > > 01.99d woudl be fixed<4,2> > > I don't see that this actually makes any practical difference. The > language mappings that I am aware of allow mixed fixed/fixed > arithmetic anyway. If I insert a fixed constant into an any, I get whatever type popped out of the constant literal definition, which discards the zeros. It seems a lot more intuitive (to me) to retain the leading and trailing zeros. Most certainly, in engineering at least, 1.0 and 1.0000 are very different numbers. I'm not going to harp on this -- it's simply that retaining the zero digits seems more consistent to me. Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Sender: jon@corvette.floorboard.com Message-ID: <39D3FCC1.1063375E@floorboard.com> Date: Thu, 28 Sep 2000 19:21:53 -0700 From: Jonathan Biggar X-Mailer: Mozilla 4.73 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Michi Henning CC: Jishnu Mukerji , orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale References: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: IZ(!!g]:e9)]H!!h)#e9 Michi Henning wrote: > > On Thu, 28 Sep 2000, Jishnu Mukerji wrote: > > > Change the following text: > > > > "A fixed-point literal has the apparent number of total and fractional > > digits, except leading and trailing zeros are factored out, including > > non-significant zeros before the decimal point. For example, 0123.450d > > is > > considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." > > > > to: > > > > "A fixed-point literal has the apparent number of total and fractional > > digits, except leading zeros before the decimal point and trailing zeros > > after the decimal point are factored out. For example, 0123.450d is > > considered to be fixed<5,2> and 3000.00d is fixed<4,0>." > > > > Comments? > > I have never been happy with this idea of stripping leading and trailing > zeros. Doing this means that, for example, the constant 0 can only have > the type fixed<1,0> (or should that be fixed<0,0>? ;-) > > I would have preferred to preserve all the digits, regardless of their > value. That would make a lot more sense to me. For example: > > 0.00d would be fixed<3,2> > 01.99d woudl be fixed<4,2> I don't see that this actually makes any practical difference. The language mappings that I am aware of allow mixed fixed/fixed arithmetic anyway. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Sender: jon@corvette.floorboard.com Message-ID: <39D40970.44F7B8B6@floorboard.com> Date: Thu, 28 Sep 2000 20:16:00 -0700 From: Jonathan Biggar X-Mailer: Mozilla 4.73 [en] (X11; U; SunOS 5.7 sun4u) X-Accept-Language: en MIME-Version: 1.0 To: Michi Henning CC: Jishnu Mukerji , orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale References: Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: Z9>!!AOBe9aN~!!'aDe9 Michi Henning wrote: > > I don't see that this actually makes any practical difference. The > > language mappings that I am aware of allow mixed fixed/fixed > > arithmetic anyway. > > If I insert a fixed constant into an any, I get whatever type popped > out of the constant literal definition, which discards the zeros. It seems > a lot more intuitive (to me) to retain the leading and trailing zeros. > Most certainly, in engineering at least, 1.0 and 1.0000 are very different > numbers. In the C++ mapping, you can't insert a fixed into an any without using from_fixed, which specifies the digits and scale to use. -- Jon Biggar Floorboard Software jon@floorboard.com jon@biggar.org Date: Fri, 29 Sep 2000 14:46:37 +1000 (EST) From: Michi Henning To: Jonathan Biggar cc: Jishnu Mukerji , orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale In-Reply-To: <39D40970.44F7B8B6@floorboard.com> Message-ID: Organization: Object Oriented Concepts MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-UIDL: Al&e9\kdd9N]$e9NYo!! On Thu, 28 Sep 2000, Jonathan Biggar wrote: > Michi Henning wrote: > > > I don't see that this actually makes any practical difference. The > > > language mappings that I am aware of allow mixed fixed/fixed > > > arithmetic anyway. > > > > If I insert a fixed constant into an any, I get whatever type popped > > out of the constant literal definition, which discards the zeros. It seems > > a lot more intuitive (to me) to retain the leading and trailing zeros. > > Most certainly, in engineering at least, 1.0 and 1.0000 are very different > > numbers. > > In the C++ mapping, you can't insert a fixed into an any without using > from_fixed, which specifies the digits and scale to use. Yes, I know. But this issue spans language mappings. I really don't understand why if the type of 10.01 is fixed<4,2>, the type of 10.00 suddenly should be fixed<2,0>. What's so special about the leading zeros? After all, if I explicitly wrote them into my literal, presumably I did that for a reason! Cheers, Michi. -- Michi Henning +61 7 3891 5744 Object Oriented Concepts +61 4 1118 2700 (mobile) Suite 4, 904 Stanley St +61 7 3891 5009 (fax) East Brisbane 4169 michi@ooc.com.au AUSTRALIA http://www.ooc.com.au/staff/michi-henning.html Reply-To: From: "Nick Sharman" To: "Michi Henning" , "Jonathan Biggar" Cc: "Jishnu Mukerji" , Subject: RE: Issue 3581: Incorrect use of negative fixed scale Date: Fri, 29 Sep 2000 13:16:06 +0100 Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2314.1300 In-Reply-To: Content-Type: text/plain; charset="iso-8859-1" X-UIDL: GY9!!PA:!!\~Ne9\K$e9 All, > -----Original Message----- > From: Michi Henning [mailto:michi@ooc.com.au] > Sent: Friday, September 29, 2000 5:47 AM > To: Jonathan Biggar > Cc: Jishnu Mukerji; orb_revision@omg.org > Subject: Re: Issue 3581: Incorrect use of negative fixed scale > > > On Thu, 28 Sep 2000, Jonathan Biggar wrote: > > > Michi Henning wrote: > > > > I don't see that this actually makes any practical difference. The > > > > language mappings that I am aware of allow mixed > fixed/fixed > > > > arithmetic anyway. > > > > > > If I insert a fixed constant into an any, I get whatever type popped > > > out of the constant literal definition, which discards the > zeros. It seems > > > a lot more intuitive (to me) to retain the leading and trailing zeros. > > > Most certainly, in engineering at least, 1.0 and 1.0000 are > very different > > > numbers. > > > > In the C++ mapping, you can't insert a fixed into an any without using > > from_fixed, which specifies the digits and scale to use. > > Yes, I know. But this issue spans language mappings. I really > don't understand > why if the type of 10.01 is fixed<4,2>, the type of 10.00 suddenly should > be fixed<2,0>. What's so special about the leading zeros? After all, if > I explicitly wrote them into my literal, presumably I did that > for a reason! > > Cheers, > > Michi. This problem arises because the exact type of a fixed constant has to be inferred from the literal on the right-hand side of the "=" sign. If developers had to write: const fixed <4,2> tenPointOhOne = 10.01; const fixed <4,2> tenExactly = 10; there wouldn't be a problem. Then we could have an interesting discussion about truncating vs. rounding vs. forbidding excess digits and mixed-mode arithmetic and ... :-) But if that's a step too far, then I agree with Michi that we should preserve leading and trailing zeroes as indicators of scale & precision. Regards Nick Date: Fri, 29 Sep 2000 14:56:18 -0400 From: Jishnu Mukerji Reply-To: jis@fpk.hp.com Organization: Hewlett-Packard EIAL, Florham Park NJ USA X-Mailer: Mozilla 4.73 [en] (WinNT; U) X-Accept-Language: en MIME-Version: 1.0 To: orb_revision@omg.org Subject: Re: Issue 3581: Incorrect use of negative fixed scale References: <39D3B47A.8D8DC7C@fpk.hp.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii X-UIDL: ^94!!E*He90nT!!1]D!! Issue 3581: Incorrect use of negative fixed scale Here is a modified proposed resolution taking into account the sentiments expressed by some regarding non-dropping of leading and trailing zeros. (orb_revision) Source: Rogue Wave Software (Mr. Paul Kyzivat, paulk@roguewave.com) Nature: Uncategorized Issue Severity: Summary: In section 3.9.2 (of ptc/99-12-07) on semantics of constants, an example is given showing 3000.00D being of type fixed<1,-3>. This is inconsistent with statements elsewhere that fixed scale is a non-negative quantity. Also, the preceding explanation states: "... leading and trailing zeros are factored out, INCLUDING NON-SIGNIFICANT ZEROS BEFORE THE DECIMAL POINT." This rule of course leads to negative scale factors, so it must also be incorrect. Suggested Revision: Change the following text: "A fixed-point literal has the apparent number of total and fractional digits, except leading and trailing zeros are factored out, including non-significant zeros before the decimal point. For example, 0123.450d is considered to be fixed<5,2> and 3000.00d is fixed<3,-1>." to: "A fixed-point literal has the apparent number of total and fractional digits. For example, 0123.450d is considered to be fixed<7,3> and 3000.00d is fixed<6,2>." Comments? Thanks, Jishnu. -- Jishnu Mukerji Senior Systems Architect, EIAL Hewlett-Packard Company 300 Campus Drive, MS 2E-62 Florham Park NJ 07932, USA +1 973 443 7528 jis@fpk.hp.com