r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3-OLD1]

PeterWood
27-Apr-2009
[13539x3]
But it should be useful in R3:


The money datatype now uses a coded decimal representation, allowing 
accurate number representation up to 26 decimal digits in length. 
Due to its accuracy, this datatype is useful for financial, banking, 
commercial, transactional, and even some types of scientific applications.
..which I believe Ladislav supplied.
I suspect some rounding is being automatically applied with the money! 
datatype

>> round .3 - .2 - .1
== 0
Henrik
27-Apr-2009
[13542]
R3:

>> $.3 - $.2 - $.1
== $0
Pekr
27-Apr-2009
[13543]
Dockimbel - sorry, please accept my apology. It was not you, it was 
actually Geomol on 8-Apr, who too refused to submit bugs, as those 
might not be corrected anyway :-) You just contacted me privately 
the same day, expressing your opinion to me.
Henrik
27-Apr-2009
[13544]
My only problem is that you have to use the money datatype to use 
this number format. It could be useful in other places. But I think 
we've had this discussion before.

If you do a ? datatype!, in R3 you get:


money!          datatype! high precision decimals with denomination 
(opt)

So you may wonder as a beginner why the description is like that.
Pekr
27-Apr-2009
[13545]
yes, we have had that discussion before. I better don't jump into 
that discussion once again :-), because I never used money!, and 
I don't know why such general functionality as math precision should 
be expressed by the datatype called money! I would prefer BCD! precise!, 
or something else. Also very weird to use $ in front of it ...
Dockimbel
27-Apr-2009
[13546x2]
PeterWood: thanks for the documentation reminder, I should have read 
it to refresh my mind about that before posting. I wonder if the 
R3 money! implementation could be easily backported to R2? It shouldn't 
be dependent on new R3 features.
Pekr: Apologies accepted, I guess I shouldn't post to you privately 
when you're already upset ;-).
PeterWood
27-Apr-2009
[13548]
I guess Ladilsav can answer your question about the ease of back-porting 
to R2 but I would guess that it's c code which means it is likely 
to be a long time before it would get back-ported.
BrianH
27-Apr-2009
[13549]
Well for one thing, the space for the underlying data is less in 
R2 than in R3.
Dockimbel
27-Apr-2009
[13550]
If R3 still uses 128bits slots for values, it shouldn't change memory 
usage from a user POV?
BrianH
27-Apr-2009
[13551]
R3 uses larger slots for values, a side effect of the 64bit integers 
and such.
Dockimbel
27-Apr-2009
[13552]
Does that mean that the average memory usage will increase in R3?
BrianH
27-Apr-2009
[13553]
Between that and the Unicode strings, basic data does take more RAM. 
We're making up for it by making all of the standard object types 
more efficient, so that overall memory usage will likely be less.
Dockimbel
27-Apr-2009
[13554]
While we're talking about memory management, will it be possible 
to add in R3, a mean to adjust or tune GC behaviour by exposing some 
of the internal parameters? The goal is being able to adapt the tradeoff 
between speed and memory usage in various situations. For example 
: being able to set a max amount of memory for a REBOL session.
BrianH
27-Apr-2009
[13555x2]
String, number and block data will be more; binary data will be the 
same; port and graphics objects will be much less. When we get vector! 
working that will drop memory usage in many data processing scenarios. 
Many of the changes to the mezzanines and natives (including changes 
in alpha 49) lower the number of block copies, so that cuts down 
memory overhead.
Adjusting the GC: I don't know.
Henrik
27-Apr-2009
[13557]
I've asked on chat.
Steeve
27-Apr-2009
[13558]
R3 uses larger slots for values, a side effect of the 64bit integers 
and such.
Can you be more precise Brian ?
How long are the new slots ?
Pekr
27-Apr-2009
[13559]
Long enough but not longer? :-)
Steeve
27-Apr-2009
[13560]
uhm... something like that
BrianH
27-Apr-2009
[13561]
Don't know off the top of my head. Not double in size, as the slot 
overhead hasn't doubled, just the data part.
Steeve
27-Apr-2009
[13562]
Is Carl hiding from you such important infos ? :)
BrianH
27-Apr-2009
[13563]
I don't ask - haven't needed to know.
Steeve
27-Apr-2009
[13564]
You're not Brian, the Brian i know would have killed some kitten 
to know that
BrianH
27-Apr-2009
[13565x2]
I think of memory in terms of number of elements (which i can affect) 
rather than element size (which I can't). I don't think of RAM size 
except for at a overall process level.
He mentioned the real sizes at some point (in a blog I think), but 
I don't remember the exact numbers.
Steeve
27-Apr-2009
[13567]
don't remember that
BrianH
27-Apr-2009
[13568x2]
For my code I find that I only need to think in terms of number of 
copies, or preallocation. On an algorithmic level you can save orders 
of magnitude in memory overhead (space and time) by controlling the 
number of copies.
The FOREACH changes in alpha 49 were done to reduce memory overhead, 
for instance.
Steeve
27-Apr-2009
[13570]
Don't force me to disassemble the binary to know that, otherwise 
i'm afraid that Dockimbel will kill me.
BrianH
27-Apr-2009
[13571]
Same with exposing COLLECT-WORDS so it can be used instead of BIND/set 
into a temporary object.
Steeve
27-Apr-2009
[13572x3]
Oh the FOREACH overhead has been reduced ?
nice news
not anymore  bind/copy with FOREACH ?
BrianH
27-Apr-2009
[13575x2]
The BIND/copy overhead is still there, but being able to use FOREACH 
on map!, object!, module!, port! and error! means that you don't 
have to generate a block! copy of those types in order to work on 
them. Plus you don't need the EITHER or CASE to screen for those 
cases.
In general the size of the code block passed to FOREACH is much smaller 
than the size of the data passed to it.
Steeve
27-Apr-2009
[13577]
foreach works now on ports ? are you sure of that ?
BrianH
27-Apr-2009
[13578x2]
In theory, but I think it works on the port fields as if it were 
an object, not on the returned data.
I haven't checked though.
Steeve
27-Apr-2009
[13580x2]
Uhm, was not my request, it would be more usefull to be able to use 
FOREACH as an ACTOR in a scheme.
So on data, rather than to populate properties of an object port
BrianH
27-Apr-2009
[13582]
Yeah, I didn't request that either. Did you file a CureCode ticket 
for FOREACH on ports? I recall some overly general ticket you filed 
that was requested to be broken up iinto individual tickets, but 
not the individual tickets.
Steeve
27-Apr-2009
[13583]
have to
BrianH
27-Apr-2009
[13584x3]
Ticket 556.
You might be a little late here - port! has been added to the any-object! 
typeset (I can't say for sure). You gotta file tickets if you want 
to get things done.
At least on a native level. On a mezzanine level you can do it yourself, 
as long as it's a good idea :)
Steeve
27-Apr-2009
[13587x2]
uhm, the any-object! type is troublemaker
Port should not be in it, to allow functions to behave as scheme 
actors