Do we have a "money" package for Pharo available? http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
Hi Torsten, On 10 Jun 2013, at 19:09, "Torsten Bergmann" <astares@gmx.de> wrote:
Do we have a "money" package for Pharo available?
http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
http://www.squeaksource.com/Money.html Paul DeBruicker ported it to Pharo. Sven -- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org
For anybody who cares it originally comes from last chapter of Smalltalk Best Practices Patterns by Kent Beck and was uploaded by Avi Bryant. I've been decreasing the code quality for a little while. ;) I'll move it to Smalltalkhub later now. Sven Van Caekenberghe-2 wrote
Hi Torsten,
On 10 Jun 2013, at 19:09, "Torsten Bergmann" <
astares@
> wrote:
Do we have a "money" package for Pharo available?
http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
http://www.squeaksource.com/Money.html
Paul DeBruicker ported it to Pharo.
Sven
-- Sven Van Caekenberghe Proudly supporting Pharo http://pharo.org http://association.pharo.org http://consortium.pharo.org
-- View this message in context: http://forum.world.st/Pharo-dev-Monetary-package-tp4692670p4693053.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
Paul DeBruicker wrote
I'll move it to Smalltalkhub later now.
I mean now. Its here: http://smalltalkhub.com/#!/~pdebruic/Money -- View this message in context: http://forum.world.st/Pharo-dev-Monetary-package-tp4692670p4693062.html Sent from the Pharo Smalltalk Developers mailing list archive at Nabble.com.
What the difference from scaled decimal or fixed decimal? On video I not see any currency concept. In past I used Units package to model money. It is very convinient to calculate currency exchange operations. What the advantage of Money package? Best regards, Denis 2013/6/10 Torsten Bergmann <astares@gmx.de>
Do we have a "money" package for Pharo available?
http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
I wondered the same. Can someone explain? On Tue, Jun 11, 2013 at 3:17 AM, Denis Kudriashov <dionisiydk@gmail.com>wrote:
What the difference from scaled decimal or fixed decimal?
On video I not see any currency concept. In past I used Units package to model money. It is very convinient to calculate currency exchange operations. What the advantage of Money package?
Best regards, Denis
2013/6/10 Torsten Bergmann <astares@gmx.de>
Do we have a "money" package for Pharo available?
http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
-- Mariano http://marianopeck.wordpress.com
First, is FixedDecimal used in the Money package? I didn't see is referenced there, so I'm curious where it came from. There is a definite different between ScaledDecimal and FixedDecimal. ScaledDecimal (unless it's been changed recently) keeps the full precision of the original number. FixedDecimal (and Money, from my short perusal of it), do not - they make sure that the displayed value is exactly what the internal value is. As an example, check out the following: x := ((1/3) asScaledDecimal: 2). x ==> 0.33s2 x = (1/3) ==> true ((33/100) asScaledDecimal: 2) ==> 0.33s2 x = ((33/100) asScaledDecimal: 2) ==> false (!) x + x ==> 0.67s2 (!) In general, the last 2 statements are NOT what you want when dealing with Money - if you have an amount, it is a definite amount, and not an approximate amount. (With the possible exceptions of interim results - but for those, you probably need strict control over exactly how precise the interim results are - which isn't readily available in ScaleDecimal). This is the main reason I built the FixedDecimal package on SqueakSource. There, the above statements show: x := ((1/3) asFixedDecimal: 2). x ==> 0.33 x = (1/3) ==> true ((33/100) asFixedDecimal: 2) ==> 0.33 x = ((33/100) asFixedDecimal: 2) ==> true x + x ==> 0.66
From my perspecive, ScaledDecimal is great when you want to keep as much precision as possible, but need to SHOW less precision. It reminds me of science, where you have this measurement that is way more precise than you can really measure, so you 'scale' it back to a precision that is reliable.
-Chris On Tue, Jun 11, 2013 at 1:21 PM, Mariano Martinez Peck < marianopeck@gmail.com> wrote:
I wondered the same. Can someone explain?
On Tue, Jun 11, 2013 at 3:17 AM, Denis Kudriashov <dionisiydk@gmail.com>wrote:
What the difference from scaled decimal or fixed decimal?
On video I not see any currency concept. In past I used Units package to model money. It is very convinient to calculate currency exchange operations. What the advantage of Money package?
Best regards, Denis
2013/6/10 Torsten Bergmann <astares@gmx.de>
Do we have a "money" package for Pharo available?
http://www.jarober.com/blog/blogView?showComments=true&title=ST+4U+396%3A+Mo...
-- Mariano http://marianopeck.wordpress.com
participants (6)
-
Chris Cunningham -
Denis Kudriashov -
Mariano Martinez Peck -
Paul DeBruicker -
Sven Van Caekenberghe -
Torsten Bergmann