All, There is a class called Decimal
in ObjectStudio 7 and 8. This class uses integers as value and scale. Division
and multiplication give interesting results, e.g. 1.00D / 3 * 3 =
0.999999999999D (12 times 9). Georg Georg Heeg eK, Dortmund
und Köthen, HR Dortmund A 12812 Tel. +49-3496-214328,
Fax +49-3496-214712 Von:
[hidden email] [mailto:[hidden email]] Im Auftrag von Alan Knight It seems to me that the
entire discussion here boils down to the VisualWorks FixedPoint class being
poorly named. What it does is useful functionality, but it's not really fixed
point, and there isn't anything in VisualWorks that does do real fixed point as
far as I know. As John Brant said, one can just use fractions for indefinite
precision, and that's really all that class is - a wrapper around fractions. To
do real fixed point, you just use integers, so a wrapper around integers
would accompish the same sort of thing. And then the only worry would be all
the people using the existing class who weren't expecting it to go from
essentially infinite precision to extremely limited precision. Or we could name
it ReallyFixedPoint :-) --
Alan Knight [|], Engineering Manager, Cincom Smalltalk
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Dennis smith-4
I agree that it does something useful, I just don't think
that what it does is fixed point.
At 06:02 PM 2009-12-16, Dennis Smith wrote: I disagree -- if you actually USE FixedPoint (I don't care what you call it) -- it does exactly what is _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- Dennis Smith --
Alan Knight [|], Engineering Manager, Cincom Smalltalk
_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Alan Knight-2
I disagree.
The result of a computation is some value with a fixed decimal point. If that value is 1/3 and you then display it in normal form you get 0.333333333333333333333333333- forever but then it says its a Fixed Decimal Point at 4 say, so you really get 0.3333 If you then say, no I want scale 5 you get 0.33333 who said you should only get 0.33330 just because you changed the scale?? Alan Knight wrote: It seems to me that the entire discussion here boils down to the VisualWorks FixedPoint class being poorly named. What it does is useful functionality, but it's not really fixed point, and there isn't anything in VisualWorks that does do real fixed point as far as I know. As John Brant said, one can just use fractions for indefinite precision, and that's really all that class is - a wrapper around fractions. To do real fixed point, you just use integers, so a wrapper around integers would accompish the same sort of thing. And then the only worry would be all the people using the existing class who weren't expecting it to go from essentially infinite precision to extremely limited precision. Or we could name it ReallyFixedPoint :-) -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Alan Knight-2
Am 16.12.2009 um 23:40 schrieb Alan Knight:
Now that you said this, I looked at the class implementation and realize all my concerns about rounding errors and losing precision were nonsense. I was of course assuming FixedPoint was real FixedPoint in the sense of integer math. Thanks for waking me up. Andre _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Dennis smith-4
Am 16.12.2009 um 23:58 schrieb Dennis Smith: > Hope you don't get an audit by a knowledgeable accountant -- they > won't accept it. Floats (and Doubles) have issues with accuracy in > accounting -- that is why we have various forms of FixedPoint > (ScaledDecimal). Most databases provide a storage and even a > computational form of Decimal values to handle those cases. Yep. My mistake was to think FixedPoint was based on a fixed point representation of the value. Undoubtedly an implementation based on fractions is superior. I just didn't realize how the class was implemented and took its name for real. I admit I'm not specialized in accounting software. For my purposes Doubles were sufficient. I would probably use FixedPoint now that I finally got around to read the entire class comment ;-) Sorry for the confusion. Andre _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by jtuchel
Joachim Tuchel wrote:
> Wouldn't ScaledDecimal be a good name? > Maybe not, since a ScaledDecimal is the equivalent of FixedPoint in > other Smalltalk dialects... ScaledDecimal might indeed be a good name. In VA, ScaledDecimal is an actual fixed point class, and the current proposal is that GemStone's "real" fixed point class will be named ScaledDecimal. For more information on the current thinking at GemStone, see James Foster's blog: http://programminggems.wordpress.com/2009/12/16/scaleddecimal/ Regards, -Martin _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Alan Knight-2
On Dec 16, 2009, at 2:40 PM, Alan Knight wrote:
> It seems to me that the entire discussion here boils down to the > VisualWorks FixedPoint class being poorly named. What it does is > useful functionality, but it's not really fixed point, and there > isn't anything in VisualWorks that does do real fixed point as far > as I know. As John Brant said, one can just use fractions for > indefinite precision, and that's really all that class is - a > wrapper around fractions. To do real fixed point, you just use > integers, so a wrapper around integers would accompish the same sort > of thing. And then the only worry would be all the people using the > existing class who weren't expecting it to go from essentially > infinite precision to extremely limited precision. Or we could name > it ReallyFixedPoint :-) Well put. Smalltalk FixedPoint (ScaledDecimal in other dialects) are really just FractionWithPrintPrecision numbers. We'll never get rid of it, or "correct" it (for some definition of the word correct). It is after all an integrated literal type (even though Fractions aren't) and documented in the ANSI spec I believe. Someone knew what they were doing as far as implementing a type of numeric object that retains a display precision, and didn't know what they were doing when they were choosing names. -- Travis Griggs Objologist "The project was so plagued by politics and ego that when the engineers requested technical oversight, our manager hired a psychologist instead." -- Ron Avitzur _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Travis Griggs wrote: If you take that point of view, is Integer misnamed because 1 / 3 doesn't produce an integer?On Dec 16, 2009, at 2:40 PM, Alan Knight wrote:It seems to me that the entire discussion here boils down to the VisualWorks FixedPoint class being poorly named. What it does is useful functionality, but it's not really fixed point, and there isn't anything in VisualWorks that does do real fixed point as far as I know. As John Brant said, one can just use fractions for indefinite precision, and that's really all that class is - a wrapper around fractions. To do real fixed point, you just use integers, so a wrapper around integers would accompish the same sort of thing. And then the only worry would be all the people using the existing class who weren't expecting it to go from essentially infinite precision to extremely limited precision. Or we could name it ReallyFixedPoint :-)Well put. Smalltalk FixedPoint (ScaledDecimal in other dialects) are really just FractionWithPrintPrecision numbers. We'll never get rid of it, or "correct" it (for some definition of the word correct). It is after all an integrated literal type (even though Fractions aren't) and documented in the ANSI spec I believe. Someone knew what they were doing as far as implementing a type of numeric object that retains a display precision, and didn't know what they were doing when they were choosing names. In fact 1 / 3 * 2 also does not produce an integer. Why should FixedPoint be any different? Why should 1s / 3 * 2 produce 0s as a result?? -- Travis Griggs Objologist "The project was so plagued by politics and ego that when the engineers requested technical oversight, our manager hired a psychologist instead." -- Ron Avitzur _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Dennis Smith wrote:
> > Travis Griggs wrote: >> We'll never get rid of it, or "correct" it (for some definition of the >> word correct). It is after all an integrated literal type (even though >> Fractions aren't) and documented in the ANSI spec I believe. I think VA Smalltalk implements ScaledDecimal as a true fixed point number (http://en.wikipedia.org/wiki/Fixed-point_arithmetic). Also, the ANSI spec says that the <scaledDecimal> protocol "Provides a numeric representation of fixed point decimal numbers." The VW FixedPoint class does not implement a fixed point number. >> Someone knew what they were doing as far as implementing a type of >> numeric object that retains a display precision, and didn't know what >> they were doing when they were choosing names. >> > If you take that point of view, is Integer misnamed because 1 / 3 > doesn't produce an integer? > In fact > 1 / 3 * 2 > also does not produce an integer. As defined by the ANSI standard: 1/3 produces a fraction and the fraction (1/3) * 2 produces another fraction. > Why should FixedPoint be any different? Why should > 1s / 3 * 2 > produce 0s as a result?? Because that's what a fixed point calculation (with no fractional digits) would produce. The ANSI standard says that 1s / 3 is evaluated as "1s / 3s" and that / is a flooring division operation so 1s / 3 is 0s. Dennis, I'm not saying that what VW provides isn't useful. I'm saying that it isn't a fixed point number and doesn't provide the <scaledDecimal> protocol from the ANSI standard. John Brant _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
John Brant wrote: What the ANSI standard says and what is of value for accounting appear to be two different things.Dennis Smith wrote:Travis Griggs wrote:We'll never get rid of it, or "correct" it (for some definition of the word correct). It is after all an integrated literal type (even though Fractions aren't) and documented in the ANSI spec I believe.I think VA Smalltalk implements ScaledDecimal as a true fixed point number (http://en.wikipedia.org/wiki/Fixed-point_arithmetic). Also, the ANSI spec says that the <scaledDecimal> protocol "Provides a numeric representation of fixed point decimal numbers." The VW FixedPoint class does not implement a fixed point number.Someone knew what they were doing as far as implementing a type of numeric object that retains a display precision, and didn't know what they were doing when they were choosing names.If you take that point of view, is Integer misnamed because 1 / 3 doesn't produce an integer? In fact 1 / 3 * 2 also does not produce an integer.As defined by the ANSI standard: 1/3 produces a fraction and the fraction (1/3) * 2 produces another fraction.Why should FixedPoint be any different? Why should 1s / 3 * 2 produce 0s as a result??Because that's what a fixed point calculation (with no fractional digits) would produce. The ANSI standard says that 1s / 3 is evaluated as "1s / 3s" and that / is a flooring division operation so 1s / 3 is 0s. Dennis, I'm not saying that what VW provides isn't useful. I'm saying that it isn't a fixed point number and doesn't provide the <scaledDecimal> protocol from the ANSI standard. At the very least we must have truncation not rounding -- nothing else rounds. Look at Java Decimal type Decimal abc (2) is a 2 scale value which retains 5 points of precision -- I wonder why? You can override that, but that is the default -- well thought through. As s/w engineers we should not be defining how accounting needs to work. John Brant _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc -- Dennis Smith +1 416.798.7948 Cherniak Software Development Corporation Fax: +1 416.798.0948 509-2001 Sheppard Avenue East [hidden email] Toronto, ON M2J 4Z8 <a class="moz-txt-link-freetext" href="sip:dennis@CherniakSoftware.com">sip:dennis@... Canada http://www.CherniakSoftware.com Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |