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

World: r3wp

[Core] Discuss core issues

Andreas
14-Jul-2010
[17474x2]
Funny, what platform?
>> mold/all 0.1
== "0.1"
BrianH
14-Jul-2010
[17476]
Andreas, you are not getting that the whole point of MOLD and SAVE 
is to be a pretty-printer.
Ladislav
14-Jul-2010
[17477]
Windows
Andreas
14-Jul-2010
[17478]
What is FORM supposed to be then?
BrianH
14-Jul-2010
[17479]
A pretty-printer for users rather than developers.
Steeve
14-Jul-2010
[17480]
;-) Someone should start to write our chronicles. When I will be 
an old hag, I would be fun to read our old debates.
BrianH
14-Jul-2010
[17481]
Andreas, please use R3 when talking about MOLD/all for decimals - 
it's broken on R2.
Andreas
14-Jul-2010
[17482x2]
Fair enough. So your take is that LOAD/SAVE forms no duality because 
of MOLD is supposed to do "developer pretty printing" but for absolute 
newbie developers, not for developers familiar with e.g. #[] syntax.
>> mold/all 0.1
== "0.1"
Ladislav
14-Jul-2010
[17484]
the whole point of MOLD and SAVE is to be a pretty-printer

 - looks true for MOLD, but SAVE does not print, so this does not 
 apply in any reasonable sense
Andreas
14-Jul-2010
[17485]
Well, that's the SAVE should be symmetric to MOLD argument. It's 
a fair point; just one I personally disagree with.
BrianH
14-Jul-2010
[17486x2]
MOLD doesn't priint either. Very few pretty-printers print. It's 
a jargon term.
For that matter, PRINT doesn't really print either :)
Steeve
14-Jul-2010
[17488]
btw, we are not really here
Ladislav
14-Jul-2010
[17489]
As I said, I can actually live with it, but, what I am unable to 
live with is, that this gotcha is nowhere documented, and it is a 
gotcha par excellence, as demonstrated
BrianH
14-Jul-2010
[17490]
Andreas, which platform are you using? That is a serious platform-specific 
bug you are demonstrating there, and should be reported.
Andreas
14-Jul-2010
[17491]
Linux
Ladislav
14-Jul-2010
[17492]
Brian, I would correct this "bug", if I were able to
BrianH
14-Jul-2010
[17493]
I'll check CureCode to see if the bug is already there.
Ladislav
14-Jul-2010
[17494]
the problem is, that Microsoft does not allow me to do what I want 
in Windows
Andreas
14-Jul-2010
[17495]
Btw, I consider my implementation to be far more correct than yours.
Ladislav
14-Jul-2010
[17496x2]
No need to put it to CC, the code that generates the string was written 
by me (both for Linux and for Windows), and I did my best
Linux yields a "better value", since I had more freedom in coding 
the conversion
Andreas
14-Jul-2010
[17498]
0.10000000000000001 is not discernible from 0.1 in double precision 
IEEE754. 0.10000000000000002 is, though.
BrianH
14-Jul-2010
[17499]
The behavior as designed in R3 is this:
>> mold 0.1
== "0.1"
>> mold/all 0.1
== "0.10000000000000001"

This is because 0.1 is not directly representable in a IEEE754 value. 
If it does not work this way on a platform, then the platform code 
is broken. And you, Ladislav, were the one who made the rule in the 
first place.
Andreas
14-Jul-2010
[17500]
If that is intended behaviour for R3, then R3 is broken (or designed 
to use single-precision floating point).
Steeve
14-Jul-2010
[17501]
Wow, that'"s a direct attack :-)
Andreas
14-Jul-2010
[17502]
Well, I take that back.
Ladislav
14-Jul-2010
[17503x2]
Neither 0.10000000000000001, nor  0.1 violate IEEE754 norm
(as Andreas found out)
BrianH
14-Jul-2010
[17505]
Andreas, it is the latter. The decimal! type is designed to use single-precision 
floating point. And that behavior is in the standard (according to 
Ladislav, the last time this discussion came up a year ago or so). 
I told you the decimal! type was misnamed.
Andreas
14-Jul-2010
[17506x2]
0.1 and 0.10000000000000001 are represented differently in single-precision 
IEEE754.
Well, forget it.
Ladislav
14-Jul-2010
[17508]
You mean double precision, I suppose?
Andreas
14-Jul-2010
[17509]
I am mainly about how to regain a decimal representation from IEEE754 
encoding.
Ladislav
14-Jul-2010
[17510]
(i.e. 64-bit)?
BrianH
14-Jul-2010
[17511x2]
Or double, whatever. But the current behavior was argued for by Ladislav, 
and is consistent with all other IEEE754 implementations, according 
to the standard. Ladislav, if that behavior doesn't match what the 
standard says, and what you requested, then it needs reporting.
Or we can reopen your ticket.
Ladislav
14-Jul-2010
[17513]
It matches the standard
Andreas
14-Jul-2010
[17514x2]
Brian, have you read IEEE754 or are you otherwise intimately familiar 
with it?
But more directly: _both_ behaviours match the standard.
Ladislav
14-Jul-2010
[17516x2]
The standard is, that every result shall be rounded "to the nearest 
representable number"
And, "the nearest representable number" to 0.1 and 0.10000000000000001 
is the same
BrianH
14-Jul-2010
[17518]
Which matches the standard? Andreas's demonstrated behavior on Linux, 
or mine on Windows? Because they need to behave exactly the same. 
If they don't, one of the platforms has a platform-specific bug. 
Pick one.
Andreas
14-Jul-2010
[17519x3]
Depends on what you consider the nearest representable number to 
be :)
And what FP precision you use in the process.
0.1 is 3DCCCCCD in single-precision, which is 9.9999994e-2 when converted 
to decimal representation without rounding.
Ladislav
14-Jul-2010
[17522x2]
Representable numbers
 are described in http://www.rebol.net/wiki/Decimals-64
http://www.rebol.net/wiki/Decimals-64#IEEE_754_Standard