hello! i'm just posting, because i was wondering if anyone else has made some kind of floating point type thing here on pico-8! i just really wanna see if anyone has broken free from pico-8's fixed-point numbers. if you have, or know somebody that has, please let me know!



This is not exactly what you asked for, but I made an object with metamethods that handle fractions of arbitrary size. Internally, the numerator and denominator are stored as string.
Only + - * / and conversion to string with N decimals specified are available.
Comparaisons also require a function call.
Currently not at home, but i ça share the code in a week if you’re interested.
Could you maybe specify more precisely what your need is ?



@RealShadowCaster i was really looking for an implementation of floating-point numbers, which doesnt use fractions, but i really do think its a good idea to internally store it as a table of bits, like {true, true, false, true}... and so on, and only do string-based math when we are converting to and from a string. floating point numbers in base-10 rather than binary is practically just storing the whole number, because you barely get to use the exponent.
still, i would love to see the code for this, just to be curious.



as it happens, I just put a code snippet on exponential integers up the other day that may be of interest to you! It's not technically floating point, but it's based off the same concept of using the same 16:16 structure to represent a significand and an exponent (instead of the current number type of a 16:16 integer and fraction portion):
[Please log in to post a comment]