2024-11-14 09:00:55 lilo_booter: To iterate through floats you can increment them as an integer (or decrement if negative) 2024-11-14 09:01:39 Assuming they're IEEE 754 2024-11-14 09:03:57 Oh I see that's not what you were asking lol 2024-11-14 09:17:57 I would use BEGIN / WHILE / REPEAT : 3.14159265359E FCONSTANT PI FVARIABLE X : MY-LOOP PI FNEGATE X F! BEGIN X F@ PI F< WHILE .... REPEAT ; 2024-11-14 09:20:13 Making ?FDO ... FLOOP with the standard word set would be painful because there's no way to put floats on the return stack portably 2024-11-14 09:20:29 At least not in ANS Forth 2024-11-14 09:21:07 A lot of stuff is painful with ANS floats, they're really not a first-class type, they're just there because they know you need it 2024-11-14 09:22:35 You'd think they'd let you use FVARIABLE to start a region of float-aligned addresses, but the standard disclaims this in general 2024-11-14 09:22:48 I would guess most Forths do let you do that though, like gforth 2024-11-14 13:19:29 hmm, is there any way to start a region of float-aligned addresses in the standard? 2024-11-14 13:19:48 or to float-align here 2024-11-14 13:20:00 float aligned? 2024-11-14 13:20:13 oh as in. aligned to the size of a float 2024-11-14 13:20:30 https://forth-standard.org/standard/float/FALIGN 2024-11-14 13:20:43 aha! 2024-11-14 13:21:38 not necessarily the size, just the necessary alignment so you don't blow up with a bus error or get unreasonably slow code 2024-11-14 13:21:54 yeah 2024-11-14 13:22:30 I see there's also https://forth-standard.org/standard/float/DFALIGN https://forth-standard.org/standard/float/DFLOATS https://forth-standard.org/standard/float/DFLOATPlus https://forth-standard.org/standard/float/FLOATPlus https://forth-standard.org/standard/float/FLOATS 2024-11-14 13:22:45 Also https://forth-standard.org/standard/float/FALIGNED 2024-11-14 13:22:48 yes 2024-11-14 13:23:27 and https://forth-standard.org/standard/float/DFALIGNED 2024-11-14 13:23:49 so you have everything you need to make structs or arrays with floats or doubles on the heap or in the dictionary 2024-11-14 22:35:04 a devious thought occured to me: an js/ts to a forth compiler 2024-11-14 23:22:32 xentrac: But annoyingly there's no FCREATE etc 2024-11-14 23:22:39 So it's a bit lopsided 2024-11-14 23:25:13 I end up doing stuff like : F, HERE >R 1 FLOATS ALLOT R> F! ; FALIGN HERE x F, x F, x F, CONSTANT MY-ARRAY