| Peter-Michael Hager 2004-10-13, 3:55 pm |
| Good formatting news: I have written a full precision format
function, which will do in various cases a much better job
than the weak <format> or []FMT.
Every APL numeric value, regardless of its internal format,
can be converted into a precise decimal formatted value.
And this accurately is what the "FmtFull" does.
[http://members.prima.de/~he/apl/fmtfull.dws]
Imagine, you could set []PP to infinite.
No more loss of exactness.
Here is James sample in compare between <format> and FmtFull:
[]CT <- 0
[]PP <- 16
x <- (<iota>10)<divide>3
x = <execute><format>x
0 0 1 0 0 1 0 0 1 0
x = <execute><each>FmtFull x
1 0 1 1 0 1 1 1 1 1
Now 80% of the values remain precise, while <format> only did
its job on whole numbers below 1997100652223524. The remaining
differences result from a further weakness in APL's <execute>.
Here are the results in detail:
<format><each>11 1<rho>x,1997100652223524
0.3333333333333336
0.6666666666666671
1
1.333333333333333
1.666666666666667
2
2.333333333333334
2.666666666666668
3
3.333333333333335
1997100652223525
FmtFull<each>11 1<rho>x,1997100652223524
0. 3333333333333333148296162562473909929394
72198486328125
0. 6666666666666666296592325124947819858789
4439697265625
1
1. 3333333333333332593184650249895639717578
887939453125
1. 6666666666666667406815349750104360282421
112060546875
2
2. 3333333333333334813630699500208720564842
22412109375
2. 6666666666666665186369300499791279435157
77587890625
3
3. 3333333333333334813630699500208720564842
22412109375
1997100652223524
Might be these results look a bit like paranoia. But as they
are fully precise they may help you to understand the nature
of the underlying numerical system.
On the other side, the weak precision of the <format> function
and its workaround using underscores to hide the worst results,
should be reason enough not to get it used in critical fields
at insurance companies or financial institutions.
If you want to get an ultra performing highspeed formatter and
activator, please do not hesitate to contact me to get FmtFull,
as well as more user friendly precise formatters, rewritten in
assembly language. Such a solution will even outperform all
current formatting tools.
Peter-Michael [mailto:hager@dortmund.net]
PS As FmtFull is a generated function, please wait
some seconds to complete its generation.
As I think the subject needs seriously be mentioned,
I apologize, if you might have got this message twice.
|