Log In  


Cart #g42calc-0 | 2022-12-11 | Code ▽ | Embed ▽ | No License
4

Logarithm Function: https://pico-8.fandom.com/wiki/Math

A simple calculator cartridge.

Controls:

(D-pad) Move Cursor
(O) Selected Button

Limitations:

• Numbers only go up to 32767 before wrapping around
• Numbers are rounded to 4 digits
• Logarithm function is approximated
• Generally bad code

4


I tried to get the square root of 7, @girres42, and it only gave back zero.

I pushed two buttons. 7 and the SQRT button.


@dw817 In that case, you would do (7), (√), (2), then (=). I tried making the UI as clear as possible within the 64x64 size.


Wow. That is - very different from my calculator, @girres42. Here I just type 7 and the square root key. I was expecting instant calculation thus: answer=sqrt(x)

I see what you are doing here is quite clever x^(1/y) so you can get any root you want, square or cube if desired. Neat !

Let me try that.

Okay 27 3 = 2.9996

Hmm .. Oh, but that's not right. It should be 3.


@dw817 PICO-8 rounds (1/3) to .3333. So, it's actually doing 27^(.3333) (which equals 2.9996). I can't really think of a work around.


Let me try in Blitz, @girres42.

27^(1/3)

3.0000000982235946

Oh, even worse. Isn't there a way to get a nice cube root of 27 in Pico-8 with the correct result of 3 ?

Tried Windows Calculator:

27^(1/3)

Ah ! It got 3. So it is possible anyways.



[Please log in to post a comment]