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

P#122209 2022-12-11 01:29

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.

P#122213 2022-12-11 02:08 ( Edited 2022-12-11 02:09)

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

P#122219 2022-12-11 03:51 ( Edited 2022-12-11 03:52)

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.

P#122220 2022-12-11 04:16

@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.

P#122221 2022-12-11 04:25

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.

P#122223 2022-12-11 04:35 ( Edited 2022-12-11 04:48)

[Please log in to post a comment]