World: r4wp
[#Red] Red language group
older | first |
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? | |
older | first |