2024-11-13 20:53:31 in gforth, is there a way to loop through a floating point range - like pi pi negate fdo ... 0.1 +floop or similar? 2024-11-13 20:54:54 or do i have to fake it with begin/until kinda thing? 2024-11-13 20:59:45 You could define your own loop words 2024-11-13 21:00:28 sure - but nothing built in then? 2024-11-13 21:01:23 Sorry, I don't know of any 2024-11-13 21:01:32 no worries :) 2024-11-13 21:02:07 https://forth-standard.org/standard/rationale#paragraph.A.3.2.3.2 2024-11-13 21:09:05 i guess another simple way to do it would be to iterate though an arbitray integer range (like say, 0 to 99 inclusive) and derive the float value from that 2024-11-13 21:26:28 yeah, that's probably the best way to do it in Forth (or in C or JS) 2024-11-13 21:36:52 in c/c++/js, i would just do something really simple like for ( float x = -pi; x < pi; x += 0.1 ) or some such 2024-11-13 21:37:28 it doesn't work reliably in those languages 2024-11-13 21:38:02 reliably enough, surely 2024-11-13 21:41:59 no, try http://canonical.org/~kragen/sw/dev3/floatfor.c 2024-11-13 21:42:09 you'll see it iterates an extra time due to rounding erorr 2024-11-13 21:45:14 fair enough, but if you switch to double it's fine :p 2024-11-13 21:46:06 in that specific case, but not in others 2024-11-13 21:46:29 in some cases it will actually give you an infinite loop when it should have been a finite loop 2024-11-13 21:46:37 i know - and in my specific case, the inaccuracy isn't a big issue either - but yea, i know what you mean 2024-11-13 21:49:22 I've done things that are more questionable than that, though 2024-11-13 21:49:42 such as? 2024-11-13 21:50:53 like http://canonical.org/~kragen/sw/netbook-misc-devel/rotcube.py 2024-11-13 21:52:44 quite neat :) and in the same domain as i was messing around with myself (using ansi csi codes for funky presentations of 2d graphs and shapes) 2024-11-13 21:53:12 thanks! 2024-11-13 21:53:52 terminals are coming back :D 2024-11-13 21:54:00 man, fuck that so much 2024-11-13 21:54:13 :D 2024-11-13 21:54:36 I realize now that this is probably something I could have done in BASIC on an 8080 or a 6809 when I was a little kid if I'd known then what I know now 2024-11-13 21:54:50 that would have been the coolest fucking thing 2024-11-13 21:55:46 for sure - and ditto, messing around with the terminal for presentation is really reminiscient of those days (z80 kiddlie myself) 2024-11-13 21:55:57 no problem looping with floats - just switch to decimal floats :P 2024-11-13 21:56:09 or rationals :) 2024-11-13 21:57:16 you still have the approximation problem with decimal floats, it just takes more code to demonstrate it 2024-11-13 21:58:18 you have two rounding errors with regular floats: converting decimal in your source to binary floats and rounding from calculation 2024-11-13 21:58:45 decimal floats eliminates the conversion rounding error so you don't have the approximation error there 2024-11-13 21:58:51 right 2024-11-13 21:58:57 only error from calculation 2024-11-13 21:59:17 that Python code only has to do 48 floating-point multiplies per frame (though it's doing some other math it doesn't have to, including divisions) 2024-11-13 21:59:52 I feel like 48 multiplies at 60 frames per second is within the capabilities of even an 8080 doing software floating-point 2024-11-13 22:01:14 You could try running it on a Z80 calculator 2024-11-13 22:01:42 which at this point must greatly outnumber retro Z80 systems 2024-11-13 22:02:29 people have probably done this 2024-11-13 22:03:01 like https://www.youtube.com/watch?v=E_FHGYX_WL4 maybe 2024-11-13 22:03:56 or https://www.youtube.com/watch?v=hFhYKzZWAcI 2024-11-13 22:05:08 though apparently it's having a bit of trouble drawing the lines 2024-11-13 22:08:27 neat