• Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r4wp

[#Red] Red language group

Kaj
30-Jul-2013
[9774]
There would be some compiler option, -32 or something
Arnold
30-Jul-2013
[9775x2]
That was easy on XCode. Getting closer now. (still differences :( 
)
(changing target)
Kaj
30-Jul-2013
[9777]
Shooting rabbits now?
Arnold
30-Jul-2013
[9778x2]
pow pow pow!
all hits now :-)
Arnold
31-Jul-2013
[9780]
There were some more hooks and traps, in the end the same generated 
numbers! Now removing a real truckload of dumps and prints from the 
source.
Kaj
31-Jul-2013
[9781]
So does the C program produce different results in 32 and 64 bit 
versions?
Arnold
31-Jul-2013
[9782]
That is what I concluded Tue 9:52. Still stands.
Kaj
31-Jul-2013
[9783x2]
That's very strange for such an algorithm
Is the code supposed to support 64 bit?
Arnold
31-Jul-2013
[9785x2]
After current test, I conclude otherwise :) Output is the same. Output 
in C source is unsigned, output in R/S is signed.
C: 10 outputs of genrand_int32()
1067595299  955945823  477289528 4107218783 4228976476 
3344332714 3355579695  227628506  810200273 2591290167 
R/S:--- Test 3 10 outputs of genrand-int32 ---
--------------------------------------------
1067595299 955945823 477289528 -187748513 -65990820 
-950634582 -939387601 227628506 810200273 -1703677129 
----------------------------------

(Where the negative values are bitwise equal to their unsigned counterpart 
in the C output.)
I was mislead by an incorrect intermediate result in the Red/System 
source that I expected to be correct already but had not fixed on 
this machine, together with a short blackout overseeing that adding 
nonzerobits to the left of a binary number changes the decimal representation 
in the lower digits too. Lots of output lines, many output terminal 
windows, small laptopscreen.
Same results make sense.
Kaj
31-Jul-2013
[9787]
Syncing problems? Better use Fossil :-)
Bo
31-Jul-2013
[9788]
Kaj made a big breakthrough today on the commercial project we are 
using Red to develop.  That means we are close to getting paid.  
In turn, that means that Doc is close to getting as big a donation 
as we can afford for creating Red and helping us develop the functionality 
we needed in Red.  And if we can successfully market the product, 
Doc will be getting a donation for each one sold.  We are doing a 
presentation of the product on August 19th to people in the Computer-Aided 
Design industry toward that goal.
DocKimbel
31-Jul-2013
[9789]
Wow, congrats to both of you! :-)
amacleod
31-Jul-2013
[9790]
Great
Kaj
31-Jul-2013
[9791]
I'll note that the breakthrough was facilitated by the environment 
set up for me by Bo. It would have been hard to do it without that
Arnold
31-Jul-2013
[9792x2]
SUperprogress guys!
I'll wait for the fossil tutorial video ;-)
Kaj
31-Jul-2013
[9794x3]
https://www.youtube.com/watch?v=ClJ5lwl_wM0
https://www.youtube.com/watch?v=hmJ4ulhZtoQ
https://www.youtube.com/watch?v=53d4txkdeq8
Geomol
31-Jul-2013
[9797]
Congratulations! Good to hear, that these projects are used for something 
real.
Arnold
31-Jul-2013
[9798]
1st video nice song and clip.

2nd video Lizzen vewy cawefully, Eye willl zay zhis oonly whonze... 
is distracting me, trying to watch that tomorrow again
3rd video demo? Demo of the symbolic view in Mac finder :)
Bo
31-Jul-2013
[9799]
Fortunately, Respectech has several cloud servers.  I had my system 
administrator create a couple of Windows 8 x64 virtual machines so 
we could simulate a Windows network environment with Solidworks.
Pekr
1-Aug-2013
[9800]
guys, is your project the surveilance camera related, or a newe stuff? 
As for the breakthrough - some kind of optimisation, or some important 
functionality, etc?
Kaj
1-Aug-2013
[9801]
A new project. The breakthrough is the coming together of the key 
functionality that is the identity of the product
DocKimbel
1-Aug-2013
[9802]
@Arnold: once you finish with the PRNG algorithms, you could have 
a look at Lz4, I would love to have it built in Red! ;-) 

https://code.google.com/p/lz4/
Bo
1-Aug-2013
[9803x2]
It is like Kaj is performing brain surgery with the lower levels 
of Windows.
Doc also did some of that with Red where he developed a non-Microsoft 
method to interface with the Microsoft kernel.  Microsoft doesn't 
provide complete documentation for doing that sort of thing, but 
he did it anyway.
Arnold
1-Aug-2013
[9805]
@Doc, I will take a look at that. It is another thing of magnitude. 
Downloaded the source for starters.

@Bo, you understand why Kaj need to drive the Windows Kernel. M$ 
is not able to do so anymore?
Arnold
2-Aug-2013
[9806x3]
Testing user.reds by Rebolek. 
one-eight: 0.125
testint: 4
myresult: 1.0 ;initialize as float
print [" myresult was: " myresult lf]
myresult: one-eight * int-to-float testint
print [" myresult is : " myresult lf]
myresult: myresult * 2
print [" myresult is : " myresult lf]
Guess the result game..
Results I get: 
 myresult was: 1
 myresult is : 0.5
 myresult is : 1.3563418576693e+243
Ieks!
Kaj
2-Aug-2013
[9809]
I seem to remember that floats and integers can't be intermixed yet
Arnold
2-Aug-2013
[9810x2]
As the float functions from the mt19937 source depend on int-to-float 
conversion, this better be tested some more.
that is why int-to-float from user.reds by Rebolek from the contributions 
link was recommended to me earlier.
Kaj
2-Aug-2013
[9812x2]
int-to-float seems OK here, but not * 2: try * 2.0
Or even * int-to-float 2
Arnold
2-Aug-2013
[9814x2]
Ah sure! Good you are here tonight.
How easy it is to make this error!
Kaj
2-Aug-2013
[9816]
It would be better if it gave an error
Arnold
2-Aug-2013
[9817]
Better so indeed or just compute to what it should be.
Kaj
2-Aug-2013
[9818]
Sure, but then something else would be unimplemented instead
Arnold
2-Aug-2013
[9819x2]
This looks much better again.
Now it prints that 0.5 times 2.0 is 1 (note not 1.0)
Kaj
2-Aug-2013
[9821]
Yes, that's a bit unexpected
Arnold
2-Aug-2013
[9822x2:last]
myresult was: 1
 myresult is : 0.5
 myresult is : 1
It did also on the first printed line. Could be a design choice.
int-to-float causes a error. Or does it? I added some prints and 
inbetween steps
	genrand-real2: func [
		return: [float!] 
		/local result [float!] between [float!] intermediate [integer!]
	][  
	    intermediate: genrand-int32
	    print ["intermediate: " intermediate lf]
		;result: int-to-float genrand-int32
		between: int-to-float intermediate
        print ["between: " between lf]
		result: ((1.0 / 4294967296.0) * between) ;; divided by 2^32 
		return result
	]

ON the second value the program errs:
intermediate: -1734706621
between: -1734706560
-0.40389284491539 intermediate: -1052231088

*** Runtime Error 9: float invalid operation
*** at: 00002033h
logout

When I make my testprogram for user.reds tell me why int-to-float 
behaves like this:
intval: -1052231088
floval: int-to-float intval
print ["intval: " intval " lets floval become: " floval lf]
The output is not a runtime error:
intval: -1052231088 lets floval become: -1052231040

But the print line was not executed in my real program? I only have 
one user.reds file in my directory. Suggestions?