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

World: r3wp

[!REBOL3-OLD1]

Henrik
7-Jul-2009
[16166]
still false for that one
Geomol
7-Jul-2009
[16167]
ok. Do you guys know, if there's a CureCode ticket about it?
BrianH
7-Jul-2009
[16168]
If you use <= you get true. It could be within the margin of error.
Geomol
7-Jul-2009
[16169]
I'm wondering, if it could have consequences in other functions/mezzanines.
BrianH
7-Jul-2009
[16170]
The decimal-digits option is only used for display. All other comparisons 
use 15 digits.
Geomol
7-Jul-2009
[16171]
I think, decimals should be treated as binary data and converted 
to integers, when doing comparison and the like.
BrianH
7-Jul-2009
[16172]
Wait for the proposed equivalency function changes in the next version.
Geomol
7-Jul-2009
[16173]
Like:


>> (to-integer  #{3fef ffff ffff ffff}) < to-integer #{3ff0 0000 
0000 0000}
== true
BrianH
7-Jul-2009
[16174x2]
Having a margin of error is standard operating procedure for IEEE754 
floating point numbers, because anything over 15 digits are subject 
to rounding errors inherent in the encoding.
That is why the 15-digit default.
Geomol
7-Jul-2009
[16176]
Maybe for equal, but I'm not sure with greater-than and less-than.
BrianH
7-Jul-2009
[16177]
If you can't count on differences in the greater-than-15-digit range 
to be accurate, why should you consider them for comparisons?
Geomol
7-Jul-2009
[16178x2]
Well, I see no reason, why this return false, no matter of precision:


(to-decimal #{3fef ffff ffff ffff}) < to-decimal #{3ff0 0000 0000 
0000}

But maybe I need to think about it some more.
It's like the decimal-digits have internal consequences, it shouldn't 
have.
BrianH
7-Jul-2009
[16180x4]
For instance:
>> 0.3 < (0.1 + 0.1 + 0.1)
== false
>> 0.3 <= (0.1 + 0.1 + 0.1)
== true


Those values differ in the greater-than-15-digits range due to encoding 
errors.
Those encoding errors are inherent in the IEEE754 format. The standard 
way to work around this is to not consider differences in the past-15-digits 
range. This is the case for all sorts of systems.
If you want exact comparisons, use money! ot integer! - decimal! 
is not appropriate.
Or you can wait for the next version, and have EQUIV?, ==, !== and 
=? do 17-digit comparisons, and the rest do the 15-digit comparisons 
that make values like 0.1 work.
Geomol
7-Jul-2009
[16184x2]
Maybe strict-lesser? is a needed function? ;-)
(I need to think about it some more.)
BrianH
7-Jul-2009
[16186]
If you need to do exact comparisons with floating point numbers you 
need to use subtraction and comparison to 0.0 - it's the only way 
to be sure. Exact comparisons with floating point numbers have to 
take into account that the numbers themselves are not exact the vast 
majority of the time.
Sunanda
9-Jul-2009
[16187]
A little sameness oddity for Ladislav. Two identical tuples can have 
different last elements :-)
    >> (to-tuple "1") =  1.0.0
    == true
    >> (last to-tuple "1") = last 1.0.0
    == false
BrianH
9-Jul-2009
[16188]
That's an error in TO tuple!.
Pekr
9-Jul-2009
[16189]
hmm, also first second last give strange results. First works, but 
others don't ....
BrianH
9-Jul-2009
[16190]
Having trouble parsing that sentence - code?
Pekr
9-Jul-2009
[16191]
Don't understand ...
BrianH
9-Jul-2009
[16192]
Nevermind, I got it. I'm writing the ticket now.
Pekr
9-Jul-2009
[16193]
Carl asked me to ask, what is general opinion to my suggestion - 
to remove parse /all refinement altogether. Current proposal is to 
swith parse by default to /all mode for block rules, and to recent 
default behaviour for string rule. As for myself I don't mind compatibility, 
so I prefer removing /all refinement and switching pase internally 
to /all mode ....
BrianH
9-Jul-2009
[16194]
I proposed an /ignore stuff option that would replace the old default 
behavior, and be more general. Then we could toss /all.
Pekr
9-Jul-2009
[16195]
That tuple bug applies also to R2 ... will such bugs be fixed?
BrianH
9-Jul-2009
[16196x2]
Not in R2, unless we can prove that code won't be broken. We have 
a lot of incompatible fixes of R2 problems in R3..
Submitted as bug#1069.
Pekr
9-Jul-2009
[16198]
What do you think about current progress? Progress is imo great, 
but when do you think we will get to more strategic parts like Plugins, 
etc?
BrianH
9-Jul-2009
[16199x2]
I think pretty soon. That got delayed because Ladislav and meijeru 
started being really thorough about reporting inconsistencies in 
the core semantics of the language, so we started working on resolving 
those in case any changes affect the rest of the system. For instance, 
the equality change includes changing the equality actions to natives, 
which changes the action list - that might affect plugins.
Removing binary! from any-string! definitely would affect plugins. 
It affected everything else - there's a lot less buggy code now :)
Pekr
9-Jul-2009
[16201]
That is good to hear :-) Was there any resolution to various make 
methods? Will we be able to precisely decide, what gets copied and 
what gets referenced?
BrianH
9-Jul-2009
[16202]
That is still pending, but the discussion about that reached a consensus, 
so it will come after we finish up the equality changes.
Sunanda
9-Jul-2009
[16203]
re tuple....

....I thought it technically was  not a bug. Just a surprise that 
is explicable when you remember that tuples are padded with zeroes 
for equality tests:
    1.0.0 = 1.0.0.0
    == true
     (length? 1.0.0) = length? 1.0.0.0
    == false
BrianH
9-Jul-2009
[16204x4]
It turns out that the length of a tuple is set at tuple creation 
time, and that length affects LENGTH? and PICK, which are called 
by LAST.
It was technically not either a bug or a feature - it was a side 
effect that had not been discussed. The bug ticket will start the 
discussion
The amount of space a tuple takes is fixed, as are the trailing zeros. 
The "length" is just a number.
The result of all of these discussions is that R3 is going to be 
much more rigorously thought through and consistent than R2. The 
little improvements are going to be the ones with the greatest impact 
in the long run.
Pekr
9-Jul-2009
[16208]
Brian - I don't understand proposal for invalid-utf-8 function. What 
is it good for? Is it about some binary code not being able to be 
converted to regular char?
BrianH
9-Jul-2009
[16209]
It's about finding UTF-8 encoding errors, particularly the overlong 
forms that are used for security breaches. We can't do that check 
in TO-STRING because of the overhead (+50%), but it can still be 
a good idea to check in some cases, and the code is better written 
in C than REBOL.
Pekr
9-Jul-2009
[16210]
That is what came to my mind - if to-string should not care itself. 
Well, not even sure it is about to-string, but about particular decoder?
BrianH
9-Jul-2009
[16211]
TO-STRING is the primary decoder of UTF-8 in REBOL.. TO-CHAR is the 
other one, and it complains about invalid UTF because it can.
Sunanda
9-Jul-2009
[16212]
How do I get 
   stack
to do anything useful?
I assume I have to enable it with
   system/options/debug   or secure

But just poking around has not found the magic words (ditto, web 
searching).
BrianH
9-Jul-2009
[16213x2]
You mentioned the security, but the trick is that STACK is undocumented 
and you have to poke around and try things out for it to work. To 
my knowledge, I am the only one who has come up with proof-of-concept 
code that uses STACK, but the concepts proven were meant to highlight 
security holes :(
I haven't tried out all of its options yet either.
Sunanda
10-Jul-2009
[16215]
Stack has teaser documentation, but the examples no longer seem to 
work:
  http://www.rebol.net/r3blogs/0075.html