Log In  

I'm just tossing this out there. Is there any way to have 32-bit or 64-bit numbers in Pico-8 ?
I have a need for this in a project I'm working on.

Now years back I wrote a program to count well past a trillion, really exceeding 64-digits of numbers where you could add, subtract, and multiply, but no division or any other math formulae such as SIN(), COS(), etc.

https://www.lexaloffle.com/bbs/?tid=35715

Even a regular 99 cent calculator can have up to 8-digits of integer storage, yet Pico-8 is limited to 4.

To go over the number formats we have:

BIT: on or off / zero or one / true or false / black or white
BYTE: -128 to 127 / 0 to 255
WORD: -32768 to 32767 (which is odd as I think most systems are -32768 to 32767 / 0 to 65535
Pico-8: 4-byte storage: -32768.9999 to 32767.9999

Cart #ruzihedana-0 | 2021-10-30 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

This code though shows that there is greater accuracy than 4-decimal places for Pico-8 as by changing the first value does not show anything greater than zero until you reach 007 in the left numeric input.

Pico-8 needs a jumpstart to the heart for greater number control.

What I would like to suggest for future Pico-8 is a numbering option. Have 4-bytes take numbers as usual, however, allow calculations to be integer and from -2147483648 to 2147483647. That would cover the 8-digits of display on a calculator and even have a bonus digit left over.

To do so you could define these custom variables thus:

A=||||

For arrays

a={||||}

Use a - to allow for negative numbers

Using the pipe character. or use whatever convenient notation desired.

Then you could easily have:

a=-|||| -- defines it
a=2147483647
b={||||} -- defines it
b[999999]=4294967295

And you could use it in calculations, - + * / sin() cos(), etc. understanding the result would always be integer.

Also you could have ||| for 24-bit numbers, || for 16-bit, | for 8-bit, and ! for boolean.

P#99391 2021-10-30 21:26 ( Edited 2021-10-30 22:09)


[Please log in to post a comment]