<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Take a look at the capabilities of the mpfr library. In the long
run, it might be good to be able to switch between the boxed float
primitive of squeak/pharo, and the extended capabilities of the
external lib: <a class="moz-txt-link-freetext" href="http://www.mpfr.org/">http://www.mpfr.org/</a> and the capabilities of mpfr
might be a good guideline for what an extended floating point class
should be able to do. <br>
<br>
<br>
Lawson<br>
<br>
<br>
<br>
<br>
On 5/22/12 3:53 PM, Nicolas Cellier wrote:
<blockquote
cite="mid:CAKnRiT5+jLpmOre1WPHWPpSYVTi=3qFNSCMM-8WUHiHRukbezA@mail.gmail.com"
type="cite">
<pre wrap="">Here is a set of experimental classes for controlling floating point
output format.
The ideas are:
- 1) we can extend these formatting capabilities without creating a
bunch of new messages combinations
instead, we just have parameterized FloatPrinter object (+
subclasses), and use cascade of elementary messages
The capabilities are right now limited to scientific, free
format, fixed point and storeOn: format.
But features are growable, and we could as well control
localization, thousand separators, padding (total width, width left of
fraction point, force + sign, etc...)
- 2) The complex algorithm for printing accurately
(Burger/Dybvig/Steele) has been split into private methods in order to
be reusable by various format (fixed number of decimal places and
fixed number of significand digits)
I choosed to store above algorithm internal states in inst var
in order to avoid explosion of meaningless parameters...
This turns the functional implementation into a stateful
implementation, but encapsulated in a class and private messages...
It's a bit the same design choice as SqNumberParser.
Having more comments is also a benefit (it's still preferable to
read the paper though)
The good news is that, despite parametrization and FloatPrinter
instantiation, slow down is typically limited to 3% (we can optimize
the default case eventually)...
Comments, extensions and alternate design are welcome.
Nicolas
</pre>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">
</pre>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Squeak from the very start (introduction to Squeak and Pharo Smalltalk for the (almost) complete and compleate beginner).
<a class="moz-txt-link-freetext" href="https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all">https://www.youtube.com/playlist?list=PL6601A198DF14788D&feature=view_all</a> </pre>
</body>
</html>