World: r4wp
[#Red] Red language group
older newer | first last |
Kaj 11-Jul-2012 [650] | You should check the allocation for being a null pointer, though |
Rebolek 11-Jul-2012 [651] | how that can happen? |
Kaj 11-Jul-2012 [652x3] | If you don't get the memory from the operating system |
The form-* functions in the C library binding do pretty much that: | |
http://red.esperconsultancy.nl/Red-C-library/artifact/a1a55e070454c421657185b1d9d09f480d6c5587 | |
Rebolek 12-Jul-2012 [655] | Another question :) Is there any easy way to convert integer! to float! ? I wrote something for float! to integer!, but with integer! to float! I'm bit lost. |
Ladislav 12-Jul-2012 [656x3] | Another question :) Is there any easy way to convert integer! to float! ? I wrote something for float! to integer!, but with integer! to float! I'm bit lost. - see http://www.fm.tul.cz/~ladislav/rebol/library-utils.r |
The approach is as follows: 1) convert integer to double (=decimal!) 2) convert double to float | |
aha, sorry, this is a Red group... | |
Rebolek 12-Jul-2012 [659x2] | yes, I'm looking for Red/System solution. |
Why does this code throw *** Runtime Error 11: float stack check ? i: 0 f: 0.0 p: declare pointer! [float!] arr: allocate 100 while [i < 10][ p: as pointer! [float!] arr + (i * 8) p/value: f f: f + 0.1 i: i + 1 ] | |
Kaj 12-Jul-2012 [661x5] | Sounds like a bug, although the program is overly complex |
i: 0 f: 0.0 arr: as pointer! [float!] allocate 10 * size? float! while [i < 10][ p/i/value: f f: f + 0.1 i: i + 1 ] | |
That should work, and be more secure | |
arr/i/value: f | |
Oh, with path notation, you need to adjust the loop to start counting the index from 1 | |
Rebolek 12-Jul-2012 [666] | I'm still discovering how Red/System works :) |
Kaj 12-Jul-2012 [667] | If your original program keeps erroring out, please enter it in the bug tracker |
Rebolek 13-Jul-2012 [668] | Kaj, your code throws compilation error invalid struct member i in: arr/i/value |
Kaj 13-Jul-2012 [669x4] | Ah, it's actually even simpler :-) |
i: 1 f: 0.0 arr: as pointer! [float!] allocate 10 * size? float! while [i <= 10] [ arr/i: f f: f + 0.1 i: i + 1 ] | |
In Linux, on your original code, I get: | |
*** Runtime Error 9: float invalid operation *** at: 08048397h | |
Rebolek 13-Jul-2012 [673] | With your latest version I get *** Runtime Error 11: float stack check (on windows). |
Kaj 13-Jul-2012 [674] | Better enter both in the bug tracker, then |
DocKimbel 13-Jul-2012 [675] | Rebolek: yes, add them to the bugtracker, I will fix them this weekend. |
Rebolek 13-Jul-2012 [676x2] | That's great, thanks! |
Just an update, I just tried latest Kaj's code on Ubuntu under VirtualBox and I get *** Runtime Error 9: float invalid operation | |
DocKimbel 13-Jul-2012 [678] | It looks like we haven't tested floats pointer arithmetic enough. |
Kaj 13-Jul-2012 [679] | Is that 64 bit Ubuntu? |
Rebolek 13-Jul-2012 [680] | 32bit Lubuntu |
DocKimbel 15-Jul-2012 [681] | Rebolek: I've pushed a fix for your issue (Intel CPU). I'm looking on the other issue you had with ARMv5TE. |
Rebolek 15-Jul-2012 [682] | Great! But I've got another one... putting it to bugtracker. |
DocKimbel 15-Jul-2012 [683] | For the ARM isse, I'm testing with an emulated ARMv5TEJL, and both Fibonacci and Mandelbrot perform correctly. I've added some questions to the ticket on the bugtracker. |
Rebolek 15-Jul-2012 [684] | I will provide the info tomorrow when I have access to the machine. |
DocKimbel 15-Jul-2012 [685] | I've answered to your ticket #220. |
Rebolek 15-Jul-2012 [686] | Thanks, it's getting late, I better should left testing for tommorrow :) |
DocKimbel 15-Jul-2012 [687x2] | I've located the cause of bug #220, you should have a fix when you'll wake up. ;-) |
Fix for issue #220 pushed. | |
Rebolek 16-Jul-2012 [689x2] | Wow, that' was fast! :) |
I've added information about my machine to #219 (no gcc info, as it doesn't have gcc installed). | |
Rebolek 17-Jul-2012 [691] | Doc, another float! problem found (#221). |
Rebolek 18-Jul-2012 [692] | Can anybody check this code? https://gist.github.com/3135678 It's not a bug, but I wonder why the obviously more complex sine-osc is cca 50% faster than square-osc. These are the results I get on my machine: sine-osc time: 1068 square-osc time: 1790 |
PeterWood 18-Jul-2012 [693] | Are you running on OSX? |
Rebolek 18-Jul-2012 [694] | Windows |
PeterWood 18-Jul-2012 [695x2] | If I remember correctly, the Windows clock function is a bit different from the LibC one. |
I use Query PerformnceCounter in Windows in my Date-Time lib. | |
Rebolek 18-Jul-2012 [697] | So you think that the 50% speed difference between these two functions is due to Windows clock? |
Pekr 18-Jul-2012 [698x2] | Windows clock is bitch :-) |
http://www.codeproject.com/Articles/1236/Timers-Tutorial | |
older newer | first last |