nathanielbabiak 2021-12-22 03:33 (Edited)
Hey I was wondering if there was any reason for the various ways floats are typecast to integers?
I've updated this with a new heading. It shows all the choices.
I don't have much background on the subject, so the pattern isn't immediately obvious to me.
I'm just wondering if a pattern exists? Or if you maybe just copy-pasted the code from some source?
Just curious :-)
nathanielbabiak 2021-12-22 03:36 (Edited)
I'm asking because, if there's a term for the pattern, or a citation for the source code, it would be something I could investigate further, maybe learn about, maybe write code that runs faster.
But right now it's just a pattern I noticed.
Anyway, I'm uploading a sample program that shows all this, just in case you're wondering if it's correct first.
Timo 2021-12-23 09:11
The INT function uses “floor” from the C library. All other functions simply cast to int.
The array index code I couldn’t find now…
nathanielbabiak 2021-12-27 05:31
Thanks Timo, I appreciate the info.
FYI - I'm trying to minimize clock cycles during array indexing by omitting the `INT` instruction, although some of my floats are negative, but near-zero. (I think it's fair to assume you never intended the fantasy console to be used this way!)